From 386856afbb6ca347221c13cd606e25b204317929 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Wed, 14 Nov 2018 14:25:21 -0500 Subject: a lot of cleaning and simplification --- src/measurements.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/measurements.cpp') 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 find_minimal_crack(const Graph& G, const network& n) { class find_cycle : public boost::default_dfs_visitor { public: - unsigned int end; std::list& E; + unsigned int end; struct done{}; find_cycle(std::list& E, unsigned int end) : E(E), end(end) {} @@ -226,7 +226,7 @@ void autocorrelation(unsigned int L, std::vector& 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>& 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