diff options
-rw-r--r-- | src/graph_create.c | 2 | ||||
-rw-r--r-- | src/net_fracture.c | 10 |
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); |