summaryrefslogtreecommitdiff
path: root/src/fracture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fracture.cpp')
-rw-r--r--src/fracture.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/fracture.cpp b/src/fracture.cpp
new file mode 100644
index 0000000..77af253
--- /dev/null
+++ b/src/fracture.cpp
@@ -0,0 +1,59 @@
+
+#include <random>
+#include <iostream>
+
+#include <cholmod.h>
+
+#include "randutils/randutils.hpp"
+
+#include <graph.hpp>
+#include <network.hpp>
+#include <hooks.hpp>
+#include "measurements.hpp"
+
+int main(int argc, char* argv[]) {
+ int opt;
+
+ unsigned int N = 1;
+ unsigned int L = 16;
+ double beta = 0.5;
+
+ while ((opt = getopt(argc, argv, "N:L:b:")) != -1) {
+ switch (opt) {
+ case 'N':
+ N = (unsigned int)atof(optarg);
+ break;
+ case 'L':
+ L = atoi(optarg);
+ break;
+ case 'b':
+ beta = atof(optarg);
+ break;
+ default:
+ exit(1);
+ }
+ }
+
+ cholmod_common c;
+ CHOL_F(start)(&c);
+ c.supernodal = CHOLMOD_SUPERNODAL;
+
+
+ graph G(L);
+ network base_network(G, &c);
+ ma meas(N, L, beta);
+
+ randutils::auto_seed_128 seeds;
+ std::mt19937 rng{seeds};
+
+ for (unsigned int trial = 0; trial < N; trial++) {
+ network tmp_network(base_network);
+ tmp_network.set_thresholds(beta, rng);
+ tmp_network.fracture(meas);
+ }
+
+ CHOL_F(finish)(&c);
+
+ return 0;
+}
+