Skip to content

Commit 8cbcd9e

Browse files
committed
signal handled
1 parent 5cb26d4 commit 8cbcd9e

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

cerealize.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
#include "spatialsim/spatialsimulator.h"
22
#include "spatialsim/mystruct.h"
3-
#include "cerealize.h"
3+
#include "spatialsim/cerealize.h"
44
#include "sbml/SBMLTypes.h"
55
#include "sbml/packages/spatial/common/SpatialExtensionTypes.h"
66
#include "sbml/packages/spatial/extension/SpatialModelPlugin.h"
77
#include <float.h>
8-
#include <vector.h>
8+
#include <vector>
99

1010
using namespace std;
1111
LIBSBML_CPP_NAMESPACE_USE
1212

13-
void cerealize(){
13+
void cerealize(int signal){
1414

15+
cout << endl;
1516
cout << "simulation is canceled" << endl;
1617

1718
exit(1);

spatialsim/cerealize.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
#include "mystruct.h"
55

6-
void cerealize();
6+
void cerealize(int signal);
77

88
#endif

spatialsimulator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,9 @@ void simulate(optionList options)
11231123
}
11241124
outputGeo3dImage(geoInfoList, Xdiv, Ydiv, Zdiv, fname, outpath);
11251125
cout << "finished" << endl << endl;
1126+
1127+
//### DUMP ###//
1128+
std::signal(SIGINT, cerealize);
11261129

11271130
//simulation
11281131
cout << "simulation starts" << endl;
@@ -1521,9 +1524,6 @@ void simulate(optionList options)
15211524
cout << "assign_time: "<< (assign_time / static_cast<double>(CLOCKS_PER_SEC)) << endl;
15221525
cout << "output_time: "<< (output_time / static_cast<double>(CLOCKS_PER_SEC)) << endl;
15231526

1524-
//### DUMP ###//
1525-
std::signal(SIGINT, cerealize);
1526-
15271527
//free
15281528
delete[] geo_edge;//mashimo
15291529
//for (i = 0; i < freeConstList.size(); i++) {

0 commit comments

Comments
 (0)