diff options
-rw-r--r-- | lib/src/network.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/src/network.cpp b/lib/src/network.cpp index 8b0e8df..712bf07 100644 --- a/lib/src/network.cpp +++ b/lib/src/network.cpp @@ -306,7 +306,13 @@ void elastic_network::fracture(hooks& m, double weight, double cutoff) { ctot.currents.resize(G.edges.size()); for (unsigned i = 0; i < G.edges.size(); i++) { - ctot.currents[i] = sqrt(pow((1 - weight) * cx.currents[i], 2) + pow(weight * cy.currents[i], 2)); + if (cx.conductivity < cutoff * G.vertices.size()) { + ctot.currents[i] = cy.currents[i] / cy.conductivity; + } else if (cy.conductivity < cutoff * G.vertices.size()) { + ctot.currents[i] = cx.currents[i] / cx.conductivity; + } else { + ctot.currents[i] = sqrt(pow((1 - weight) * cx.currents[i] / cx.conductivity, 2) + pow(weight * cy.currents[i] / cy.conductivity, 2)); + } } unsigned max_pos = UINT_MAX; |