diff options
-rw-r--r-- | src/measurements.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/measurements.cpp b/src/measurements.cpp index fa5189f..5a79bd7 100644 --- a/src/measurements.cpp +++ b/src/measurements.cpp @@ -172,11 +172,8 @@ void ma::pre_fracture(const network&) { } void ma::bond_broken(const network& net, const current_info& cur, unsigned i) { - long double c = net.thresholds[i] - logl(fabs(cur.currents[i])); + long double c = net.thresholds[i] - logl(cur.currents[i]); if (c > lv) { - if (avalanches.size() > 0) { - sa[avalanches.back().size() - 1]++; - } lv = c; avalanches.push_back({i}); } else { @@ -232,5 +229,12 @@ void ma::post_fracture(network &n) { for (unsigned i = 0; i < num; i++) { sc[new_components[i].size() - 1]++; } + + av_it++; + + while (av_it != avalanches.rend()) { + sa[(*av_it).size() - 1]++; + av_it++; + } } |