diff options
Diffstat (limited to 'src/sample_fracture_square.cpp')
-rw-r--r-- | src/sample_fracture_square.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/sample_fracture_square.cpp b/src/sample_fracture_square.cpp new file mode 100644 index 0000000..fb2eb33 --- /dev/null +++ b/src/sample_fracture_square.cpp @@ -0,0 +1,67 @@ + +#include <random> +#include <iostream> + +#include <cholmod.h> + +#include "randutils/randutils.hpp" + +#include <graph.hpp> +#include <network.hpp> +#include <hooks.hpp> +#include "sample.hpp" + +#include <csignal> +#include <cstring> +#include <atomic> + +int main(int argc, char* argv[]) { + + int opt; + + unsigned N = 1; + unsigned Lx = 16; + unsigned Ly = 16; + double beta = 0.5; + + while ((opt = getopt(argc, argv, "N:X:Y:b:")) != -1) { + switch (opt) { + case 'N': + N = (unsigned)atof(optarg); + break; + case 'X': + Lx = atoi(optarg); + break; + case 'Y': + Ly = atoi(optarg); + break; + case 'b': + beta = atof(optarg); + break; + default: + exit(1); + } + } + + cholmod_common c; + CHOL_F(start)(&c); + + sample meas(Lx, Ly, beta); + + randutils::auto_seed_128 seeds; + std::mt19937 rng{seeds}; + + graph G(Lx, Ly); + network perm_network(G, &c); + + for (unsigned trial = 0; trial < N; trial++) { + network tmp_network(perm_network); + tmp_network.set_thresholds(beta, rng); + tmp_network.fracture(meas); + } + + CHOL_F(finish)(&c); + + return 0; +} + |