diff options
-rw-r--r-- | src/measurements.cpp | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/src/measurements.cpp b/src/measurements.cpp index cc4188a..57f85f5 100644 --- a/src/measurements.cpp +++ b/src/measurements.cpp @@ -291,7 +291,7 @@ void ma::bond_broken(const network& net, const current_info& cur, unsigned int i sa[avalanches.back().size() - 1]++; Na++; - memset(fftw_forward_in, 0.0, net.G.edges.size()); + std::fill_n(fftw_forward_in, net.G.edges.size(), 0.0); for (auto e : avalanches.back()) { fftw_forward_in[e] = 1.0; @@ -316,6 +316,29 @@ void ma::post_fracture(network &n) { unsigned int crack_component = component[n.G.dual_edges[crack.front()][0]]; + // non-spanning clusters + for (unsigned int i = 0; i < num; i++) { + if (i != crack_component) { + unsigned int size = 0; + + for (unsigned int j = 0; j < n.G.edges.size(); j++) { + if (component[n.G.dual_edges[j][0]] == i && n.fuses[j]) { + size++; + fftw_forward_in[j] = 1.0; + } else{ + fftw_forward_in[j] = 0.0; + } + } + + if (size > 0) { + sc[size - 1]++; + autocorrelation(L, Ccc, forward_plan, fftw_forward_in, fftw_forward_out, reverse_plan, fftw_reverse_in, fftw_reverse_out); + Nc++; + } + } + } + + // bin counting for (unsigned int be = 0; be < log2(L); be++) { unsigned int bin = pow(2, be); @@ -348,7 +371,7 @@ void ma::post_fracture(network &n) { autocorrelation(L, Cmm, forward_plan, fftw_forward_in, fftw_forward_out, reverse_plan, fftw_reverse_in, fftw_reverse_out); // crack surface correlations - memset(fftw_forward_in, 0.0, n.G.edges.size()); + std::fill_n(fftw_forward_in, n.G.edges.size(), 0.0); for (auto edge : crack) { fftw_forward_in[edge] = 1.0; @@ -370,7 +393,7 @@ void ma::post_fracture(network &n) { autocorrelation(L, Cee, forward_plan, fftw_forward_in, fftw_forward_out, reverse_plan, fftw_reverse_in, fftw_reverse_out); - memset(fftw_forward_in, 0.0, n.G.edges.size()); + std::fill_n(fftw_forward_in, n.G.edges.size(), 0.0); // rewind the last avalanche for (auto e : avalanches.back()) { @@ -381,28 +404,6 @@ void ma::post_fracture(network &n) { autocorrelation(L, Cll, forward_plan, fftw_forward_in, fftw_forward_out, reverse_plan, fftw_reverse_in, fftw_reverse_out); - // cluster size distribution and cluster-cluster correlation - num = boost::connected_components(G, &component[0]); - - for (unsigned int i = 0; i < num; i++) { - unsigned int size = 0; - - for (unsigned int j = 0; j < n.G.edges.size(); j++) { - if (component[n.G.dual_edges[j][0]] == i && n.fuses[j]) { - size++; - fftw_forward_in[j] = 1.0; - } else{ - fftw_forward_in[j] = 0.0; - } - } - - if (size > 0) { - sc[size - 1]++; - autocorrelation(L, Ccc, forward_plan, fftw_forward_in, fftw_forward_out, reverse_plan, fftw_reverse_in, fftw_reverse_out); - Nc++; - } - } - // damage size distribution unsigned int total_broken = 0; |