summaryrefslogtreecommitdiff
path: root/src/fracture.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/fracture.h')
-rw-r--r--src/fracture.h91
1 files changed, 8 insertions, 83 deletions
diff --git a/src/fracture.h b/src/fracture.h
index 0a3a687..b1114fb 100644
--- a/src/fracture.h
+++ b/src/fracture.h
@@ -23,6 +23,10 @@
#include <sys/types.h>
#include <unistd.h>
+#include <jst/graph.h>
+#include <jst/rand.h>
+
+
// these defs allow me to switch to long int cholmod in a sitch
#define int_t int
#define uint_t unsigned int
@@ -31,54 +35,6 @@
#define GSL_RAND_GEN gsl_rng_mt19937
-typedef enum lattice_t {
- VORONOI_LATTICE,
- SQUARE_LATTICE,
- VORONOI_HYPERUNIFORM_LATTICE
-} lattice_t;
-
-typedef enum bound_t {
- FREE_BOUND,
- CYLINDER_BOUND,
- TORUS_BOUND,
- EMBEDDED_BOUND
-} bound_t;
-
-typedef struct {
- uint_t ne;
- uint_t nv;
- uint_t dnv;
- uint_t *ev;
- uint_t *dev;
- double *vx;
- double *dvx;
-} frame_t;
-
-typedef struct {
- uint_t L;
- bound_t boundary;
- uint_t ne;
- uint_t nv;
- uint_t dnv;
- uint_t nb;
- uint_t *ev;
- uint_t *dev;
- double *vx;
- double *dvx;
- uint_t *vei;
- uint_t *ve;
- uint_t *dvei;
- uint_t *dve;
- uint_t *bi;
- uint_t *b;
- uint_t *nbi;
- uint_t *bni;
- bool *bq;
- uint_t *spanning_edges;
- uint_t num_spanning_edges;
- cholmod_sparse *voltcurmat;
-} graph_t;
-
typedef struct {
const graph_t *graph;
bool *fuses;
@@ -91,6 +47,7 @@ typedef struct {
uint_t dim;
uint_t nep;
uint_t *evp;
+ cholmod_sparse *voltcurmat;
} net_t;
typedef struct {
@@ -102,11 +59,6 @@ typedef struct {
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, uint_t *marks,
- int old_num_components, int v1, int v2, int exclude);
-
-uint_t *find_components(const cholmod_sparse *laplacian, uint_t skip);
-
cholmod_sparse *gen_adjacency(const net_t *net, bool dual, bool use_gp, bool symmetric, cholmod_common *c);
cholmod_sparse *gen_laplacian(const net_t *net, cholmod_common *c);
@@ -121,6 +73,7 @@ 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);
+void factor_update2(cholmod_factor *factor, uint_t v1, cholmod_common *c);
void net_notch(net_t *net, double notch_len, cholmod_common *c);
data_t *net_fracture(net_t *net, cholmod_common *c, double cutoff);
@@ -142,35 +95,19 @@ cholmod_sparse *gen_voltcurmat(uint_t num_edges, uint_t num_verts,
net_t *net_copy(const net_t *net, cholmod_common *c);
-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);
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(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, 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);
-
-uint_t *get_clusters(net_t *instance, cholmod_common *c);
+components_t *get_clusters(net_t *instance);
-uint_t *get_cluster_dist(net_t *instance, cholmod_common *c);
+uint_t *get_cluster_dist(net_t *instance);
-double *genfunc_uniform(uint_t num, gsl_rng *r);
-double *genfunc_hyperuniform(uint_t num, gsl_rng *r);
void randfunc_flat(gsl_rng *r, double *x, double *y);
void randfunc_gaus(gsl_rng *r, double *x, double *y);
-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, uint_t width, double *values);
@@ -181,18 +118,6 @@ data_t *data_create(uint_t num_edges);
void data_free(data_t *data);
void data_update(data_t *data, uint_t last_broke, long double strength, double conductivity);
-graph_t *graph_create(lattice_t lattice, bound_t bound, uint_t L, bool dual, cholmod_common *c);
-
-uint_t find_cycles(uint_t num_edges, const bool *fuses, const uint_t *ev, const uint_t *vei, const uint_t *ve, int **cycles);
-
-bool set_connected(const cholmod_sparse *laplacian, uint_t *marks, int vertex, int label, int stop_at, int exclude);
-
-unsigned long int rand_seed();
-
long double rand_dist_pow(const gsl_rng *r, double beta);
-double *spheres(int N, double bidispersityratio, double bidispersityfraction, double maxpf, double maxpressure, double maxcollisionrate);
-
-frame_t *frame_create(lattice_t lattice, uint_t L, bool dual);
-void frame_free(frame_t *frame);
bool is_in(uint_t len, uint_t *list, uint_t element);