diff options
-rw-r--r-- | lib/include/network.hpp | 2 | ||||
-rw-r--r-- | lib/src/network.cpp | 4 | ||||
-rw-r--r-- | src/measurements.cpp | 14 |
3 files changed, 13 insertions, 7 deletions
diff --git a/lib/include/network.hpp b/lib/include/network.hpp index d95b3c3..6012228 100644 --- a/lib/include/network.hpp +++ b/lib/include/network.hpp @@ -74,7 +74,7 @@ class elastic_network : public network { elastic_network(const graph&, cholmod_common*); elastic_network(const elastic_network&); - void fracture(hooks&, double weight = 0.5, double cutoff = 1e-11); + void fracture(hooks&, double weight = 0.5, double cutoff = 1e-12); current_info get_current_info(); }; diff --git a/lib/src/network.cpp b/lib/src/network.cpp index 0cacdf9..250a38e 100644 --- a/lib/src/network.cpp +++ b/lib/src/network.cpp @@ -296,8 +296,8 @@ void elastic_network::fracture(hooks& m, double weight, double cutoff) { current_info cx = hook_x.solve(fuses); current_info cy = hook_y.solve(fuses); - bool done_x = cx.conductivity < cutoff * G.vertices.size() || cx.conductivity != cx.conductivity; - bool done_y = cy.conductivity < cutoff * G.vertices.size() || cy.conductivity != cy.conductivity; + bool done_x = cx.conductivity < 0.1 / G.edges.size(); + bool done_y = cy.conductivity < 0.1 / G.edges.size(); if (done_x && done_y) { break; diff --git a/src/measurements.cpp b/src/measurements.cpp index 841e61a..baead2c 100644 --- a/src/measurements.cpp +++ b/src/measurements.cpp @@ -146,7 +146,8 @@ ma::ma(unsigned n, double a, unsigned Mx, unsigned My, double beta) : G(2 * n), sc(2 * n), sm(2 * n), - sa(3 * n) + sa(3 * n), + sl(2 * n) { if (beta != 0.0) { model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_" + std::to_string(beta) + "_"; @@ -157,9 +158,10 @@ ma::ma(unsigned n, double a, unsigned Mx, unsigned My, double beta) : ma::ma(unsigned Lx, unsigned Ly, double beta) : G(Lx * Ly / 2), - sc(Lx * Ly / 2, 0), - sm(Lx * Ly / 2, 0), - sa(Lx * Ly, 0) + sc(Lx * Ly / 2), + sm(Lx * Ly / 2), + sa(Lx * Ly), + sl(Lx * Ly / 2) { if (beta != 0.0) { model_string = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_" + std::to_string(beta) + "_"; @@ -172,6 +174,7 @@ ma::~ma() { update_distribution_file("sc", sc, model_string); update_distribution_file("sm", sm, model_string); update_distribution_file("sa", sa, model_string); + update_distribution_file("sl", sl, model_string); } void ma::pre_fracture(const network&) { @@ -199,6 +202,9 @@ void ma::post_fracture(network &n) { if (post_cracks.size() > 2 || post_cracks.size() == 0) { throw badcycleex; } + for (auto c : post_cracks) { + sl[c.second.size() - 1]++; + } unsigned crack_component = component[n.G.dual_edges[post_cracks.front().second.front()].v[0]]; std::vector<std::list<graph::coordinate>> components(num); |