diff options
Diffstat (limited to 'src/sample_fracture.cpp')
-rw-r--r-- | src/sample_fracture.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/sample_fracture.cpp b/src/sample_fracture.cpp new file mode 100644 index 0000000..42a6a5a --- /dev/null +++ b/src/sample_fracture.cpp @@ -0,0 +1,65 @@ + +#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; + double Lx = 16; + double 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 = atof(optarg); + break; + case 'Y': + Ly = atof(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}; + + for (unsigned trial = 0; trial < N; trial++) { + graph G(Lx, Ly, rng); + network network(G, &c); + network.set_thresholds(beta, rng); + network.fracture(meas); + } + + CHOL_F(finish)(&c); + + return 0; +} + |