summaryrefslogtreecommitdiff
path: root/src/instance.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/instance.c')
-rw-r--r--src/instance.c19
1 files changed, 12 insertions, 7 deletions
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);