diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2019-04-26 13:02:47 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2019-04-26 13:02:47 -0400 |
commit | c1b5cb662930965f1f4401c3c5759fb460ec24ea (patch) | |
tree | 13b8cbbfe3f07b4a09e99b555f62ebbc7ce2aa6c /src | |
parent | b43301e0bd766c1822bbde296b83fb9406443bc3 (diff) | |
download | fuse_networks-c1b5cb662930965f1f4401c3c5759fb460ec24ea.tar.gz fuse_networks-c1b5cb662930965f1f4401c3c5759fb460ec24ea.tar.bz2 fuse_networks-c1b5cb662930965f1f4401c3c5759fb460ec24ea.zip |
actually measuring avalanche sizes correctly
Diffstat (limited to 'src')
-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++; + } } |