From aad91479b4e32ca090d7cf36e5b3b30d5458a7f4 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Wed, 13 Mar 2019 18:08:19 -0400 Subject: now measuring clusters before last avalanche --- src/measurements.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/measurements.cpp') diff --git a/src/measurements.cpp b/src/measurements.cpp index 0b570cd..2af1ba3 100644 --- a/src/measurements.cpp +++ b/src/measurements.cpp @@ -143,18 +143,21 @@ ma::ma(unsigned n, double a, unsigned Mx, unsigned My, double beta) : sm(3 * n, 0), sa(3 * n, 0), sl(3 * n, 0), + sb(3 * n, 0), sD(3 * n, 0), ccc((Mx / 2) * (My / 2), 0), css((Mx / 2) * (My / 2), 0), cmm((Mx / 2) * (My / 2), 0), caa((Mx / 2) * (My / 2), 0), cll((Mx / 2) * (My / 2), 0), + cbb((Mx / 2) * (My / 2), 0), cDD((Mx / 2) * (My / 2), 0), csD((Mx / 2) * (My / 2), 0) { N = 0; Nc = 0; Na = 0; + Nb = 0; if (beta != 0.0) { model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_" + std::to_string(beta) + "_"; @@ -183,18 +186,21 @@ ma::ma(double Lx, double Ly, unsigned Mx, unsigned My, double beta) : sm(3 * (unsigned)ceil(Lx * Ly / 2), 0), sa(3 * (unsigned)ceil(Lx * Ly / 2), 0), sl(3 * (unsigned)ceil(Lx * Ly / 2), 0), + sb(3 * (unsigned)ceil(Lx * Ly / 2), 0), sD(3 * (unsigned)ceil(Lx * Ly / 2), 0), ccc((Mx / 2) * (My / 2), 0), css((Mx / 2) * (My / 2), 0), cmm((Mx / 2) * (My / 2), 0), caa((Mx / 2) * (My / 2), 0), cll((Mx / 2) * (My / 2), 0), + cbb((Mx / 2) * (My / 2), 0), cDD((Mx / 2) * (My / 2), 0), csD((Mx / 2) * (My / 2), 0) { N = 0; Nc = 0; Na = 0; + Nb = 0; if (beta != 0.0) { model_string = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_" + std::to_string(beta) + "_"; @@ -233,6 +239,7 @@ ma::~ma() { update_distribution_file("sm", sm, N, model_string); update_distribution_file("sa", sa, Na, model_string); update_distribution_file("sl", sl, N, model_string); + update_distribution_file("sb", sb, Nb, model_string); update_distribution_file("sD", sD, N, model_string); update_field_file("ccc", ccc, Nc, model_string, Mx, My); @@ -240,6 +247,7 @@ ma::~ma() { update_field_file("cmm", cmm, N, model_string, Mx, My); update_field_file("caa", caa, Na, model_string, Mx, My); update_field_file("cll", cll, N, model_string, Mx, My); + update_field_file("cbb", cbb, Nb, model_string, Mx, My); update_field_file("cDD", cDD, N, model_string, Mx, My); update_field_file("csD", csD, N, model_string, Mx, My); @@ -262,8 +270,10 @@ void ma::bond_broken(const network& net, const current_info& cur, unsigned i) { lv = c; avalanches.push_back({net.G.edges[i].r}); + last_avalanche = {i}; } else { avalanches.back().push_back(net.G.edges[i].r); + last_avalanche.push_back(i); } boost::add_edge(net.G.dual_edges[i].v[0], net.G.dual_edges[i].v[1], {i}, G); @@ -328,6 +338,27 @@ void ma::post_fracture(network &n) { autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cll, avalanches.back()); + for (unsigned e : last_avalanche) { + boost::remove_edge(n.G.dual_edges[e].v[0], n.G.dual_edges[e].v[1], G); + } + + num = boost::connected_components(G, &component[0]); + + std::vector> new_components(num); + + for (unsigned i = 0; i < n.G.dual_vertices.size(); i++) { + new_components[component[i]].push_back(n.G.dual_vertices[i].r); + } + + for (unsigned i = 0; i < num; i++) { + if (new_components[i].size() > 0) { + sb[new_components[i].size() - 1]++; + Nb++; + + autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cbb, new_components[i]); + } + } + N++; } -- cgit v1.2.3-70-g09d2