From fd14c5e39d962be94a1f68b0d4cacb7a4aa9c3e7 Mon Sep 17 00:00:00 2001 From: pants Date: Fri, 2 Sep 2016 15:24:34 -0400 Subject: embedded systems with crack fully supported --- src/instance.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/instance.c') diff --git a/src/instance.c b/src/instance.c index 098ed92..cc33591 100644 --- a/src/instance.c +++ b/src/instance.c @@ -14,7 +14,18 @@ finst *create_instance(fnet *network, double inf, bool voltage_bound, instance->voltage_bound = voltage_bound; instance->boundary_cond = CHOL_F(zeros)( network->break_dim, 1, CHOLMOD_REAL, c); - if (network->boundary != TORUS_BOUND) { + if (network->boundary == TORUS_BOUND) { + for (unsigned int i = 0; i < network->bound_inds[1]; i++) { + ((double *)instance->boundary_cond->x)[network->bound_verts[i]] = 1; + ((double *)instance->boundary_cond->x)[network->num_verts + i] = -1; + } + ((double *)instance->boundary_cond->x)[network->bound_verts[0]] = 1; + } else if (network->boundary == EMBEDDED_BOUND) { + // do nothing + for (unsigned int i = 0; i < network->bound_inds[1]; i++) { + ((double *)instance->boundary_cond->x)[network->bound_verts[i]] =1; + } + } else { if (voltage_bound) { for (unsigned int i = 0; i < network->bound_inds[1]; i++) { ((double *)instance->boundary_cond->x)[network->bound_verts[i]] =1; @@ -24,12 +35,6 @@ finst *create_instance(fnet *network, double inf, bool voltage_bound, ((double *)instance->boundary_cond->x)[network->num_verts] = 1; ((double *)instance->boundary_cond->x)[network->num_verts + 1] = -1; } - } else { - for (unsigned int i = 0; i < network->bound_inds[1]; i++) { - ((double *)instance->boundary_cond->x)[network->bound_verts[i]] = 1; - ((double *)instance->boundary_cond->x)[network->num_verts + i] = -1; - } - ((double *)instance->boundary_cond->x)[network->bound_verts[0]] = 1; } if (network->boundary != TORUS_BOUND) instance->adjacency = gen_adjacency(instance, false, false, 0, c); -- cgit v1.2.3-70-g09d2