From f1825b6ca420f63e17ca69e3c9412b80adcdbb1c Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Thu, 6 Dec 2018 23:25:46 -0500 Subject: all threshold comparisons now done in log, so as to prevent underflows at small beta --- src/measurements.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/measurements.cpp b/src/measurements.cpp index 5dc6a64..98795f1 100644 --- a/src/measurements.cpp +++ b/src/measurements.cpp @@ -103,11 +103,11 @@ std::list find_minimal_crack(const Graph& G, const network& n) { std::array crossing_count{0,0}; for (auto edge : cycle) { - double dx = fabs(n.G.vertices[n.G.dual_edges[edge][0]].r.x - n.G.vertices[n.G.dual_edges[edge][1]].r.x); + double dx = fabs(n.G.dual_vertices[n.G.dual_edges[edge][0]].r.x - n.G.dual_vertices[n.G.dual_edges[edge][1]].r.x); if (dx > n.G.L.x / 2) { crossing_count[0]++; } - double dy = fabs(n.G.vertices[n.G.dual_edges[edge][0]].r.y - n.G.vertices[n.G.dual_edges[edge][1]].r.y); + double dy = fabs(n.G.dual_vertices[n.G.dual_edges[edge][0]].r.y - n.G.dual_vertices[n.G.dual_edges[edge][1]].r.y); if (dy > n.G.L.y / 2) { crossing_count[1]++; } @@ -292,7 +292,7 @@ void ma::pre_fracture(const network &) { } void ma::bond_broken(const network& net, const current_info& cur, unsigned int i) { - long double c = cur.conductivity / fabs(cur.currents[i]) * net.thresholds[i]; + long double c = logl(cur.conductivity / fabs(cur.currents[i])) + net.thresholds[i]; if (c > lv && avalanches.back().size() > 0) { sa[avalanches.back().size() - 1]++; Na++; -- cgit v1.2.3-70-g09d2