From 4c4ebb87ead363d6d6e11a8b95b07a0f93af5c88 Mon Sep 17 00:00:00 2001 From: pants Date: Tue, 6 Sep 2016 15:05:27 -0400 Subject: finished implementing embedded systems, refactored a bunch --- src/get_conductivity.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/get_conductivity.c') diff --git a/src/get_conductivity.c b/src/get_conductivity.c index 7ef08a8..793987e 100644 --- a/src/get_conductivity.c +++ b/src/get_conductivity.c @@ -1,16 +1,16 @@ #include "fracture.h" -double get_conductivity(finst *inst, double *voltage, cholmod_common *c) { +double get_conductivity(net_t *inst, double *voltage, cholmod_common *c) { if (inst->voltage_bound) { double tot_cur = 0; - for (unsigned int i = 0; i < inst->network->num_spanning_edges; i++) { - unsigned int e = inst->network->spanning_edges[i]; + for (unsigned int i = 0; i < inst->graph->num_spanning_edges; i++) { + unsigned int e = inst->graph->spanning_edges[i]; if (!inst->fuses[e]) { - unsigned int v1 = inst->network->edges_to_verts[2*e]; - unsigned int v2 = inst->network->edges_to_verts[2*e+1]; - double v1y = inst->network->vert_coords[2 * v1 + 1]; - double v2y = inst->network->vert_coords[2 * v2 + 1]; + unsigned int v1 = inst->graph->ev[2*e]; + unsigned int v2 = inst->graph->ev[2*e+1]; + double v1y = inst->graph->vert_coords[2 * v1 + 1]; + double v2y = inst->graph->vert_coords[2 * v2 + 1]; unsigned int s1 = v1y < v2y ? v1 : v2; unsigned int s2 = v1y < v2y ? v2 : v1; tot_cur += voltage[s1] - voltage[s2]; @@ -19,6 +19,6 @@ double get_conductivity(finst *inst, double *voltage, cholmod_common *c) { return fabs(tot_cur); } else { - return 1 / fabs(voltage[inst->network->num_verts] - voltage[inst->network->num_verts + 1]); + return 1 / fabs(voltage[inst->graph->nv] - voltage[inst->graph->nv + 1]); } } -- cgit v1.2.3-70-g09d2