From 48191298e80e9655a4cd3c8f3bf9010935ddf551 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Tue, 11 Jun 2019 00:11:30 -0400 Subject: fixed current cutoffs --- lib/src/network.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/src/network.cpp b/lib/src/network.cpp index b081a3c..05a208f 100644 --- a/lib/src/network.cpp +++ b/lib/src/network.cpp @@ -1,6 +1,7 @@ #include "network.hpp" -#include + +#define CURRENT_CUTOFF 1e-11 class nofuseException: public std::exception { @@ -53,7 +54,7 @@ void network::fracture(hooks& m, bool one_axis) { long double max_val = std::numeric_limits::lowest(); for (unsigned i = 0; i < G.edges.size(); i++) { - if (!fuses[i] && c.currents[i] > min_cond) { + if (!fuses[i] && c.currents[i] > CURRENT_CUTOFF) { long double val = logl(c.currents[i]) - thresholds[i]; if (val > max_val) { @@ -170,17 +171,15 @@ percolation_network::percolation_network(const percolation_network& n) : current_info percolation_network::get_current_info() { current_info ctot; - ctot.currents.resize(G.edges.size(), 0); + ctot.currents.resize(G.edges.size(), 0.0); current_info cx = px.solve(fuses); current_info cy = py.solve(fuses); ctot.conductivity = {cx.conductivity[0], cy.conductivity[1]}; - double min_cur = 1.0 / G.edges.size(); - for (unsigned i = 0; i < G.edges.size(); i++) { - if (fabs(cx.currents[i]) > min_cur || fabs(cy.currents[i]) > min_cur) { + if (fabs(cx.currents[i]) > CURRENT_CUTOFF || fabs(cy.currents[i]) > CURRENT_CUTOFF) { ctot.currents[i] = 1.0; } } -- cgit v1.2.3-54-g00ecf