diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2019-06-11 00:11:30 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2019-06-11 00:11:30 -0400 |
commit | 48191298e80e9655a4cd3c8f3bf9010935ddf551 (patch) | |
tree | 6929304c121bbfff1a1b39245239c1625e9a501c /lib | |
parent | 50df04bf63c443a9578917648521fa256bf4ed13 (diff) | |
download | fuse_networks-48191298e80e9655a4cd3c8f3bf9010935ddf551.tar.gz fuse_networks-48191298e80e9655a4cd3c8f3bf9010935ddf551.tar.bz2 fuse_networks-48191298e80e9655a4cd3c8f3bf9010935ddf551.zip |
fixed current cutoffs
Diffstat (limited to 'lib')
-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; } } |