From 2969d1ef1352b22252c766372388cc3998997a72 Mon Sep 17 00:00:00 2001 From: pants Date: Mon, 19 Sep 2016 15:51:16 -0400 Subject: added some features --- src/fracture.h | 59 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 30 insertions(+), 29 deletions(-) (limited to 'src/fracture.h') diff --git a/src/fracture.h b/src/fracture.h index f0a22e8..0b078ff 100644 --- a/src/fracture.h +++ b/src/fracture.h @@ -76,42 +76,42 @@ typedef struct { double inf; cholmod_dense *boundary_cond; cholmod_factor *factor; - unsigned int *marks; - unsigned int *dual_marks; + uint_t *marks; + uint_t *dual_marks; bool voltage_bound; - unsigned int num_components; + uint_t num_components; cholmod_sparse *adjacency; cholmod_sparse *dual_adjacency; bool debug_stop; } net_t; typedef struct { - unsigned int num_broken; - unsigned int *break_list; + uint_t num_broken; + uint_t *break_list; double *conductivity; double *extern_field; } data_t; -intptr_t *run_voronoi(unsigned int num_coords, double *coords, bool periodic, double xmin, double xmax, double ymin, double ymax); +intptr_t *run_voronoi(uint_t 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 update_components(const cholmod_sparse *laplacian, uint_t *marks, int old_num_components, int v1, int v2, int exclude); -unsigned int *find_components(const cholmod_sparse *laplacian, unsigned int skip); +uint_t *find_components(const cholmod_sparse *laplacian, uint_t skip); cholmod_sparse *gen_adjacency(const net_t *instance, bool dual, bool breakv, - unsigned int pad, cholmod_common *c); + uint_t pad, cholmod_common *c); cholmod_sparse *gen_laplacian(const net_t *instance, cholmod_common *c, bool symmetric); -int edge_to_verts(unsigned int width, bool periodic, unsigned int edge, +int edge_to_verts(uint_t width, bool periodic, uint_t edge, bool index); -int dual_edge_to_verts(unsigned int width, bool periodic, unsigned int edge, +int dual_edge_to_verts(uint_t width, bool periodic, uint_t edge, bool index); -double dual_vert_to_coord(unsigned int width, bool periodic, unsigned int vert, +double dual_vert_to_coord(uint_t width, bool periodic, uint_t vert, bool index); void factor_update(cholmod_factor *factor, uint_t v1, uint_t v2, cholmod_common *c); @@ -124,19 +124,19 @@ double net_conductivity(const net_t *net, const double *voltages); void update_boundary(net_t *instance, const double *avg_field); -FILE *get_file(const char *prefix, unsigned int width, unsigned int crack, - double beta, unsigned int iter, unsigned int num_iter, - unsigned int num, bool read); +FILE *get_file(const char *prefix, uint_t width, uint_t crack, + double beta, uint_t iter, uint_t num_iter, + uint_t num, bool read); -double update_beta(double beta, unsigned int width, const double *stress, +double update_beta(double beta, uint_t width, const double *stress, const double *damage, double bound_total); -cholmod_sparse *gen_voltcurmat(unsigned int num_edges, unsigned int num_verts, - unsigned int *edges_to_verts, cholmod_common *c); +cholmod_sparse *gen_voltcurmat(uint_t num_edges, uint_t num_verts, + uint_t *edges_to_verts, cholmod_common *c); net_t *net_copy(const net_t *net, cholmod_common *c); -graph_t *ini_square_network(unsigned int width, bound_t boundary, bool side_bounds, +graph_t *ini_square_network(uint_t width, bound_t boundary, bool side_bounds, cholmod_common *c); void graph_free(graph_t *network, cholmod_common *c); @@ -144,29 +144,30 @@ void net_free(net_t *instance, cholmod_common *c); net_t *net_create(const graph_t *g, double inf, double beta, double notch_len, bool vb, cholmod_common *c); -graph_t *ini_voro_graph(unsigned int L, bound_t boundary, bool use_dual, - double *(*genfunc)(unsigned int, bound_t, gsl_rng *, unsigned int *), +graph_t *ini_voro_graph(uint_t L, bound_t boundary, bool use_dual, + double *(*genfunc)(uint_t, bound_t, gsl_rng *, uint_t *), cholmod_common *c); -bool break_edge(net_t *instance, unsigned int edge, cholmod_common *c); +bool break_edge(net_t *instance, uint_t edge, cholmod_common *c); void finish_instance(net_t *instance, cholmod_common *c); net_t *coursegrain_square(net_t *instance, graph_t *network_p, cholmod_common *c); -unsigned int *get_clusters(net_t *instance, cholmod_common *c); +uint_t *get_clusters(net_t *instance, cholmod_common *c); -unsigned int *get_cluster_dist(net_t *instance, cholmod_common *c); +uint_t *get_cluster_dist(net_t *instance, cholmod_common *c); -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); +double *genfunc_uniform(uint_t L, bound_t boundary, gsl_rng *r, uint_t *num); +double *genfunc_hyperuniform(uint_t L, bound_t boundary, gsl_rng *r, uint_t *num); void randfunc_flat(gsl_rng *r, double *x, double *y); void randfunc_gaus(gsl_rng *r, double *x, double *y); -unsigned int **get_dists(const graph_t *network); -double *get_corr(net_t *instance, unsigned int **dists, cholmod_common *c); +uint_t **get_dists(const graph_t *network); +uint_t *dijkstra(const graph_t *g, uint_t source); +double *get_corr(net_t *instance, uint_t **dists, cholmod_common *c); -double *bin_values(graph_t *network, unsigned int width, double *values); +double *bin_values(graph_t *network, uint_t width, double *values); cholmod_dense *bound_set(const graph_t *g, bool vb, double notch_len, cholmod_common *c); -- cgit v1.2.3-70-g09d2