From 63dd7320fbef9c9a95bf6953770072baf735c34e Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Fri, 26 Apr 2019 13:19:54 -0400 Subject: network now computes currents to be consistent with constant strain boundaries --- lib/src/network.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3-54-g00ecf