diff options
-rw-r--r-- | lib/src/network.cpp | 11 |
1 files 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 <iostream> + +#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<long double>::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; } } |