summaryrefslogtreecommitdiff
path: root/src/fracture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fracture.cpp')
-rw-r--r--src/fracture.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/fracture.cpp b/src/fracture.cpp
index 77af253..0aad56e 100644
--- a/src/fracture.cpp
+++ b/src/fracture.cpp
@@ -11,7 +11,23 @@
#include <hooks.hpp>
#include "measurements.hpp"
+#include <csignal>
+#include <cstring>
+#include <atomic>
+
+std::atomic<bool> quit(false); // signal flag
+
+void got_signal(int) {
+ quit.store(true);
+}
+
int main(int argc, char* argv[]) {
+ struct sigaction sa;
+ memset( &sa, 0, sizeof(sa) );
+ sa.sa_handler = got_signal;
+ sigfillset(&sa.sa_mask);
+ sigaction(SIGINT, &sa, NULL);
+
int opt;
unsigned int N = 1;
@@ -36,12 +52,10 @@ int main(int argc, char* argv[]) {
cholmod_common c;
CHOL_F(start)(&c);
- c.supernodal = CHOLMOD_SUPERNODAL;
-
graph G(L);
network base_network(G, &c);
- ma meas(N, L, beta);
+ ma meas(L, beta);
randutils::auto_seed_128 seeds;
std::mt19937 rng{seeds};
@@ -50,6 +64,9 @@ int main(int argc, char* argv[]) {
network tmp_network(base_network);
tmp_network.set_thresholds(beta, rng);
tmp_network.fracture(meas);
+
+ if (quit.load())
+ break;
}
CHOL_F(finish)(&c);