diff options
Diffstat (limited to 'src/measurements.cpp')
-rw-r--r-- | src/measurements.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/measurements.cpp b/src/measurements.cpp index 0bd72c4..ed96855 100644 --- a/src/measurements.cpp +++ b/src/measurements.cpp @@ -38,8 +38,8 @@ std::list<unsigned int> find_minimal_crack(const Graph& G, const network& n) { class find_cycle : public boost::default_dfs_visitor { public: - unsigned int end; std::list<unsigned int>& E; + unsigned int end; struct done{}; find_cycle(std::list<unsigned int>& E, unsigned int end) : E(E), end(end) {} @@ -226,7 +226,7 @@ void autocorrelation(unsigned int L, std::vector<T>& out_data, fftw_plan forward } } -ma::ma(unsigned int N, unsigned int L, double beta) : L(L), G(2 * pow(L / 2, 2)), N(N), beta(beta), +ma::ma(unsigned int L, double beta) : L(L), beta(beta), G(2 * pow(L / 2, 2)), sc(pow(L, 2), 0), sa(pow(L, 2), 0), sd(pow(L, 2), 0), @@ -239,6 +239,7 @@ ma::ma(unsigned int N, unsigned int L, double beta) : L(L), G(2 * pow(L / 2, 2)) Cll(pow(L / 2 + 1, 2), 0), Cee(pow(L / 2 + 1, 2), 0) { + N = 0; Nc = 0; Na = 0; @@ -284,8 +285,9 @@ void ma::pre_fracture(const network &) { boost::remove_edge_if(trivial, G); } -void ma::bond_broken(const network& net, const std::pair<double, std::vector<double>>& cur, unsigned int i) { - if (cur.first / fabs(cur.second[i]) * net.thresholds[i] > lv) { +void ma::bond_broken(const network& net, const current_info& cur, unsigned int i) { + double c = cur.conductivity / fabs(cur.currents[i]) * net.thresholds[i]; + if (c > lv) { sa[avalanches.back().size()]++; Na++; @@ -297,7 +299,7 @@ void ma::bond_broken(const network& net, const std::pair<double, std::vector<dou autocorrelation(L, Caa, forward_plan, fftw_forward_in, fftw_forward_out, reverse_plan, fftw_reverse_in, fftw_reverse_out); - lv = cur.first / fabs(cur.second[i]) * net.thresholds[i]; + lv = c; avalanches.push_back({i}); } else { avalanches.back().push_back(i); @@ -373,7 +375,7 @@ void ma::post_fracture(network &n) { // rewind the last avalanche for (auto e : avalanches.back()) { boost::remove_edge(n.G.dual_edges[e][0], n.G.dual_edges[e][1], G); - n.add_edge(e); + n.break_edge(e, true); fftw_forward_in[e] = 1; } @@ -417,5 +419,6 @@ void ma::post_fracture(network &n) { sd[total_broken]++; + N++; } |