From 07906baa42470bad14d2c40f57967691f6118969 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Thu, 1 Nov 2018 12:33:37 -0400 Subject: revamped and simplied fracture code with c++ --- src/fracture.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/fracture.cpp (limited to 'src/fracture.cpp') 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 +#include + +#include + +#include "randutils/randutils.hpp" + +#include +#include +#include +#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; +} + -- cgit v1.2.3-70-g09d2