summaryrefslogtreecommitdiff
path: root/src/ini_network.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ini_network.c')
-rw-r--r--src/ini_network.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/ini_network.c b/src/ini_network.c
index f1dbe70..edf1539 100644
--- a/src/ini_network.c
+++ b/src/ini_network.c
@@ -96,7 +96,7 @@ unsigned int *get_verts_to_edges(unsigned int num_verts, unsigned int num_edges,
return output;
}
-fnet *ini_square_network(unsigned int width, boundary_type boundary, bool side_bounds,
+fnet *ini_square_network(unsigned int width, bound_t boundary, bool side_bounds,
cholmod_common *c) {
fnet *network = (fnet *)calloc(1, sizeof(fnet));
@@ -300,8 +300,8 @@ unsigned int *get_voro_dual_edges(unsigned int num_edges,
return dual_edges;
}
-fnet *ini_voronoi_network(unsigned int L, boundary_type boundary, bool use_dual,
- double *(*genfunc)(unsigned int, gsl_rng *, unsigned int *),
+fnet *ini_voronoi_network(unsigned int L, bound_t boundary, bool use_dual,
+ double *(*genfunc)(unsigned int, bound_t, gsl_rng *, unsigned int *),
cholmod_common *c) {
fnet *network = (fnet *)calloc(1, sizeof(fnet));
@@ -315,12 +315,15 @@ fnet *ini_voronoi_network(unsigned int L, boundary_type boundary, bool use_dual,
fread(&seed, sizeof(unsigned long int), 1, rf);
fclose(rf);
gsl_rng_set(r, seed);
- lattice = genfunc(L, r, &num);
+ lattice = genfunc(L, boundary, r, &num);
gsl_rng_free(r);
}
// retrieve a periodic voronoi tesselation of the lattice
- intptr_t *vout = run_voronoi(num, lattice, 0, 1, 0, 1);
+ bool run_periodic;
+ if (boundary == EMBEDDED_BOUND) run_periodic = false;
+ else run_periodic = true;
+ intptr_t *vout = run_voronoi(num, lattice, run_periodic, 0, 1, 0, 1);
unsigned int tmp_num_verts = ((unsigned int *)vout[0])[0];
unsigned int tmp_num_edges = ((unsigned int *)vout[0])[1];
@@ -595,6 +598,19 @@ fnet *ini_voronoi_network(unsigned int L, boundary_type boundary, bool use_dual,
network->break_dim = num_verts;
break;
}
+ case EMBEDDED_BOUND: {
+ num_bounds = 4;
+ bound_inds = (unsigned int *)malloc(5 * sizeof(unsigned int));
+ bound_verts = (unsigned int *)malloc(2 * L * sizeof(unsigned int));
+ for (unsigned int i = 0; i < 5; i++) bound_inds[i] = i * L / 2;
+ for (unsigned int i = 0; i < 2 * L; i++) bound_verts[i] = i;
+ num_edges = tmp_num_edges;
+ num_verts = tmp_num_verts;
+ edges = tmp_edges;
+ dual_edges = tmp_dual_edges;
+ num_edges = tmp_num_edges;
+ vert_coords = tmp_vert_coords;
+ }
}
network->boundary = boundary;