From 50df04bf63c443a9578917648521fa256bf4ed13 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Tue, 4 Jun 2019 19:30:33 -0400 Subject: restored square lattice support to percolation --- src/perc_meas.cpp | 34 ++++++++++++++++++++++++++++++++++ src/percolation.cpp | 26 ++++++++++++++++++++++++-- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/src/perc_meas.cpp b/src/perc_meas.cpp index 9deda41..8270e1f 100644 --- a/src/perc_meas.cpp +++ b/src/perc_meas.cpp @@ -104,6 +104,40 @@ pm::pm(unsigned n, double a) : } } +pm::pm(unsigned Lx, unsigned Ly) : + G(Lx * Ly / 2), + rank(Lx * Ly / 2), + parent(Lx * Ly / 2), + ds(&rank[0], &parent[0]), + sm(Lx * Ly / 2), + sl(Lx * Ly / 2), + sn(Lx * Ly), + sN(Lx * Ly), + ss(Lx * Ly / 2), + sb(Lx * Ly), + sB(Lx * Ly), + sp(Lx * Ly), + sr(Lx * Ly), + sf(Lx * Ly) +{ + model_string = "percolation_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_"; + for (std::vector &x : sn) { + x.resize(Lx * Ly / 2); + } + for (std::vector &x : sb) { + x.resize(Lx * Ly); + } + for (std::vector &x : sN) { + x.resize(Lx * Ly / 2); + } + for (std::vector &x : sB) { + x.resize(Lx * Ly); + } + for (std::vector &x : sf) { + x.resize(Lx * Ly); + } +} + pm::~pm() { update_distribution_file("sm", sm, model_string); update_distribution_file("sl", sl, model_string); diff --git a/src/percolation.cpp b/src/percolation.cpp index 757ab44..383d5e6 100644 --- a/src/percolation.cpp +++ b/src/percolation.cpp @@ -31,8 +31,8 @@ int main(int argc, char* argv[]) { int opt; unsigned N = 1; - double Lx = 16; - double Ly = 16; + unsigned Lx = 16; + unsigned Ly = 16; double beta = 0.0001; unsigned n = 128; @@ -94,6 +94,28 @@ int main(int argc, char* argv[]) { break; */ } + } else { + pm meas(Lx, Ly); + + for (unsigned trial = 0; trial < N; trial++) { + /* + while (true) { + try { + */ + graph G(Lx, Ly); + percolation_network fuse_network(G, &c); + fuse_network.set_thresholds(beta, rng); + fuse_network.fracture(meas); + /* + break; + } catch (std::exception &e) { + std::cout << e.what() << '\n'; + } + } + if (quit.load()) + break; + */ + } } CHOL_F(finish)(&c); -- cgit v1.2.3-54-g00ecf