summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2016-10-17 09:09:12 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2016-10-17 09:09:12 -0400
commit147f9655bfb70e89e12322d5e41dfde5e36664a0 (patch)
treee645ec82194c2aab811fd03acb601d6928f6913f
parentfe81403fe452750e072d292406a9718e4c48c652 (diff)
downloadfuse_networks-147f9655bfb70e89e12322d5e41dfde5e36664a0.tar.gz
fuse_networks-147f9655bfb70e89e12322d5e41dfde5e36664a0.tar.bz2
fuse_networks-147f9655bfb70e89e12322d5e41dfde5e36664a0.zip
fixed bug in computation of external current
-rw-r--r--src/graph_create.c2
-rw-r--r--src/net_fracture.c10
2 files changed, 10 insertions, 2 deletions
diff --git a/src/graph_create.c b/src/graph_create.c
index 1c06052..635b12b 100644
--- a/src/graph_create.c
+++ b/src/graph_create.c
@@ -11,7 +11,7 @@ uint_t *get_spanning_edges(uint_t num_edges, uint_t *edges_to_verts, double *ver
double v1y, v2y;
v1y = vert_coords[2 * v1 + 1];
v2y = vert_coords[2 * v2 + 1];
- if ((fabs(v1y - v2y) < 0.5) && ((v1y < cut && v2y > cut) || (v1y > cut && v2y < cut))) {
+ if ((fabs(v1y - v2y) < 0.5) && ((v1y <= cut && v2y > cut) || (v1y >= cut && v2y < cut))) {
spanning_edges[*n] = i;
(*n)++;
}
diff --git a/src/net_fracture.c b/src/net_fracture.c
index 54f37dd..dcf67c9 100644
--- a/src/net_fracture.c
+++ b/src/net_fracture.c
@@ -44,7 +44,15 @@ data_t *net_fracture(net_t *net, cholmod_common *c, double cutoff) {
uint_t last_broke = get_next_broken(net, currents, cutoff);
- data_update(data, last_broke, fabs(conductivity * (net->thres)[last_broke] / currents[last_broke]), conductivity);
+ double sim_current;
+
+ if (net->voltage_bound) {
+ sim_current = conductivity;
+ } else {
+ sim_current = 1;
+ }
+
+ data_update(data, last_broke, fabs(sim_current * (net->thres)[last_broke] / currents[last_broke]), conductivity);
free(voltages);
free(currents);