From 0f6782c9e5a9171d69d8e62dff33a558ba542d58 Mon Sep 17 00:00:00 2001 From: pants Date: Wed, 31 Aug 2016 11:57:40 -0400 Subject: did some refactoring --- src/fracture.h | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src/fracture.h') diff --git a/src/fracture.h b/src/fracture.h index fea0caf..91b2bfc 100644 --- a/src/fracture.h +++ b/src/fracture.h @@ -23,15 +23,18 @@ #include #include -// these two defs allow me to switch to long int cholmod in a sitch -#define CHOL_INT long int -#define CHOL_F(x) cholmod_l_##x +// these defs allow me to switch to long int cholmod in a sitch +#define int_t int +#define uint_t unsigned int +#define CINT_MAX INT_MAX +#define CHOL_F(x) cholmod_##x -typedef enum boundary_type { +typedef enum bound_t { FREE_BOUND, CYLINDER_BOUND, - TORUS_BOUND -} boundary_type; + TORUS_BOUND, + EMBEDDED_BOUND +} bound_t; typedef struct { unsigned int num_edges; @@ -56,7 +59,7 @@ typedef struct { unsigned int num_dual_verts; unsigned int break_dim; cholmod_sparse *voltcurmat; - boundary_type boundary; + bound_t boundary; } fnet; typedef struct { @@ -81,7 +84,7 @@ typedef struct { double *extern_field; } break_data; -intptr_t *run_voronoi(unsigned int num_coords, double *coords, double xmin, double xmax, double ymin, double ymax); +intptr_t *run_voronoi(unsigned int num_coords, double *coords, bool periodic, double xmin, double xmax, double ymin, double ymax); int update_components(const cholmod_sparse *laplacian, unsigned int *marks, int old_num_components, int v1, int v2, int exclude); @@ -133,7 +136,7 @@ cholmod_sparse *gen_voltcurmat(unsigned int num_edges, unsigned int num_verts, finst *copy_instance(const finst *instance, cholmod_common *c); -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); void free_fnet(fnet *network, cholmod_common *c); @@ -142,8 +145,8 @@ void free_instance(finst *instance, cholmod_common *c); finst *create_instance(fnet *network, double inf, bool voltage_bound, bool startnow, cholmod_common *c); -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); bool check_instance(const finst *instance, cholmod_common *c); @@ -158,8 +161,8 @@ unsigned int *get_clusters(finst *instance, cholmod_common *c); unsigned int *get_cluster_dist(finst *instance, cholmod_common *c); -double *genfunc_uniform(unsigned int L, gsl_rng *r, unsigned int *num); -double *genfunc_hyperuniform(unsigned int L, gsl_rng *r, unsigned int *num); +double *genfunc_uniform(unsigned int L, bound_t boundary, gsl_rng *r, unsigned int *num); +double *genfunc_hyperuniform(unsigned int L, bound_t boundary, gsl_rng *r, unsigned int *num); void randfunc_flat(gsl_rng *r, double *x, double *y); void randfunc_gaus(gsl_rng *r, double *x, double *y); double beta_scaling_flat(double beta, double x, double y); -- cgit v1.2.3-70-g09d2