summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-06-04 19:30:33 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-06-04 19:30:33 -0400
commit50df04bf63c443a9578917648521fa256bf4ed13 (patch)
treef01cc7175384fd36441fed089dead5d6f46b0bbc
parent2b0d533782501d7a35d7c69f62f75447d879e22e (diff)
downloadfuse_networks-50df04bf63c443a9578917648521fa256bf4ed13.tar.gz
fuse_networks-50df04bf63c443a9578917648521fa256bf4ed13.tar.bz2
fuse_networks-50df04bf63c443a9578917648521fa256bf4ed13.zip
restored square lattice support to percolation
-rw-r--r--src/perc_meas.cpp34
-rw-r--r--src/percolation.cpp26
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<uint64_t> &x : sn) {
+ x.resize(Lx * Ly / 2);
+ }
+ for (std::vector<uint64_t> &x : sb) {
+ x.resize(Lx * Ly);
+ }
+ for (std::vector<uint64_t> &x : sN) {
+ x.resize(Lx * Ly / 2);
+ }
+ for (std::vector<uint64_t> &x : sB) {
+ x.resize(Lx * Ly);
+ }
+ for (std::vector<uint64_t> &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);