From 147f9655bfb70e89e12322d5e41dfde5e36664a0 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Mon, 17 Oct 2016 09:09:12 -0400 Subject: fixed bug in computation of external current --- src/graph_create.c | 2 +- src/net_fracture.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') 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); -- cgit v1.2.3-70-g09d2