summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-04-26 13:19:54 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-04-26 13:19:54 -0400
commit63dd7320fbef9c9a95bf6953770072baf735c34e (patch)
treef58732ba33728b81badc1568ba64ea78a920d8d9
parentc1b5cb662930965f1f4401c3c5759fb460ec24ea (diff)
downloadfuse_networks-63dd7320fbef9c9a95bf6953770072baf735c34e.tar.gz
fuse_networks-63dd7320fbef9c9a95bf6953770072baf735c34e.tar.bz2
fuse_networks-63dd7320fbef9c9a95bf6953770072baf735c34e.zip
network now computes currents to be consistent with constant strain boundaries
-rw-r--r--lib/src/network.cpp8
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;