diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2019-06-11 00:11:51 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2019-06-11 00:11:51 -0400 |
commit | f8321b4b89e114dffc02b4741785fdca60f1b31e (patch) | |
tree | 93b6d3cc460da63a02849ea1ae5939c1cb7af025 /src/measurements.cpp | |
parent | 48191298e80e9655a4cd3c8f3bf9010935ddf551 (diff) | |
download | fuse_networks-f8321b4b89e114dffc02b4741785fdca60f1b31e.tar.gz fuse_networks-f8321b4b89e114dffc02b4741785fdca60f1b31e.tar.bz2 fuse_networks-f8321b4b89e114dffc02b4741785fdca60f1b31e.zip |
fixed manny of the research tools
Diffstat (limited to 'src/measurements.cpp')
-rw-r--r-- | src/measurements.cpp | 53 |
1 files changed, 38 insertions, 15 deletions
diff --git a/src/measurements.cpp b/src/measurements.cpp index 33056ef..aa0617c 100644 --- a/src/measurements.cpp +++ b/src/measurements.cpp @@ -144,13 +144,15 @@ unsigned edge_r_to_ind(graph::coordinate r, double Lx, double Ly, unsigned Mx, u ma::ma(unsigned n, double a, unsigned Mx, unsigned My, double beta) : G(2 * n), - sc(2 * n), - sm(2 * n), - sa(3 * n), - sl(2 * n), sn(2 * n), ss(2 * n), - sb(3 * n) + sm(2 * n), + sl(2 * n), + sb(n), + sd(3 * n), + sc(2 * n), + sa(3 * n), + sA(3 * n) { if (beta != 0.0) { model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_" + std::to_string(beta) + "_"; @@ -161,11 +163,15 @@ 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), + sn(Lx * Ly / 2), + ss(Lx * Ly / 2), sm(Lx * Ly / 2), - sa(Lx * Ly), sl(Lx * Ly / 2), - sn(Lx * Ly / 2) + sb(Lx * Ly / 2), + sd(Lx * Ly), + sc(Lx * Ly / 2), + sa(Lx * Ly), + sA(Lx * Ly) { if (beta != 0.0) { model_string = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_" + std::to_string(beta) + "_"; @@ -175,19 +181,22 @@ ma::ma(unsigned Lx, unsigned Ly, double beta) : } 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); update_distribution_file("sn", sn, model_string); update_distribution_file("ss", ss, model_string); + update_distribution_file("sm", sm, model_string); + update_distribution_file("sl", sl, model_string); update_distribution_file("sb", sb, model_string); + update_distribution_file("sd", sd, model_string); + update_distribution_file("sc", sc, model_string); + update_distribution_file("sa", sa, model_string); + update_distribution_file("sA", sA, model_string); } void ma::pre_fracture(const network&) { lv = std::numeric_limits<long double>::lowest(); boost::remove_edge_if(trivial, G); avalanches = {}; + num = 0; } void ma::bond_broken(const network& net, const current_info& cur, unsigned i) { @@ -200,6 +209,7 @@ void ma::bond_broken(const network& net, const current_info& cur, unsigned i) { } boost::add_edge(net.G.dual_edges[i].v[0], net.G.dual_edges[i].v[1], {i}, G); + num++; } void ma::post_fracture(network &n) { @@ -207,6 +217,7 @@ void ma::post_fracture(network &n) { std::vector<unsigned> component(boost::num_vertices(G)); unsigned num = boost::connected_components(G, &component[0]); if (post_cracks.size() > 2 || post_cracks.size() == 0) { + std::cout << post_cracks.size() << "\n"; throw badcycleex; } for (auto c : post_cracks) { @@ -260,15 +271,23 @@ void ma::post_fracture(network &n) { current_info ct = n.get_current_info(); - unsigned conducting_backbone_size = 0; + + std::vector<bool> vertex_in(n.G.vertices.size()); for (unsigned i = 0; i < n.G.edges.size(); i++) { if (ct.currents[i] > 1.0 / n.G.edges.size()) { - conducting_backbone_size++; + vertex_in[n.G.edges[i].v[0]] = true; + vertex_in[n.G.edges[i].v[1]] = true; } } - sb[conducting_backbone_size - 1]++; + unsigned bb_size = 0; + + for (unsigned i = 0; i < n.G.vertices.size(); i++) { + if (vertex_in[i]) bb_size++; + } + + sb[bb_size - 1]++; av_it++; @@ -276,5 +295,9 @@ void ma::post_fracture(network &n) { sa[(*av_it).size() - 1]++; av_it++; } + + sA[avalanches.back().size() - 1]++; + + sd[num - 1]++; } |