From c2164e4a38b79c8a02bd7c0f4481f222c7b4dae6 Mon Sep 17 00:00:00 2001 From: pants Date: Tue, 30 Aug 2016 13:57:08 -0400 Subject: added ability to fracture triangulation instead of tiling --- src/ini_network.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/ini_network.c') diff --git a/src/ini_network.c b/src/ini_network.c index 0434d98..f1dbe70 100644 --- a/src/ini_network.c +++ b/src/ini_network.c @@ -300,7 +300,7 @@ unsigned int *get_voro_dual_edges(unsigned int num_edges, return dual_edges; } -fnet *ini_voronoi_network(unsigned int L, boundary_type boundary, +fnet *ini_voronoi_network(unsigned int L, boundary_type boundary, bool use_dual, double *(*genfunc)(unsigned int, gsl_rng *, unsigned int *), cholmod_common *c) { fnet *network = (fnet *)calloc(1, sizeof(fnet)); @@ -337,6 +337,24 @@ fnet *ini_voronoi_network(unsigned int L, boundary_type boundary, unsigned int *tmp_dual_edges = get_voro_dual_edges(tmp_num_edges, tmp_num_verts, tmp_edges, tmp_tris); + // when use_dual is specificed, the edge and vertex sets are swapped with the + // dual edge and dual vertex sets. once formally relabelled, everything + // works the same way + if (use_dual) { + unsigned int *tmp_tmp_dual_edges = tmp_edges; + double *tmp_lattice = tmp_vert_coords; + unsigned int tmp_num = tmp_num_verts; + + tmp_edges = tmp_dual_edges; + tmp_dual_edges = tmp_tmp_dual_edges; + + tmp_vert_coords = lattice; + lattice = tmp_lattice; + + tmp_num_verts = num; + num = tmp_num; + } + // prune the edges of the lattice and assign boundary vertices based on the // desired boundary conditions unsigned int num_bounds; -- cgit v1.2.3-70-g09d2