summaryrefslogtreecommitdiff
path: root/src/fracture.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/fracture.h')
-rw-r--r--src/fracture.h44
1 files changed, 17 insertions, 27 deletions
diff --git a/src/fracture.h b/src/fracture.h
index a9973ea..17ab8fd 100644
--- a/src/fracture.h
+++ b/src/fracture.h
@@ -37,38 +37,35 @@ typedef enum bound_t {
} bound_t;
typedef struct {
- uint_t ne; // number of edges
- uint_t nv; // number of vertices
- uint_t dnv; // number of dual vertices
+ uint_t ne;
+ uint_t nv;
+ uint_t dnv;
uint_t nv_break;
uint_t num_bounds;
- // 2*ne length array. edge i connects vertices ev[2*i], ev[2*i+1] < nv
uint_t *ev;
uint_t *ev_break;
- // nv+1 length array. vertex i has degree vei[i+1]-vei[i], vei[0] = 0
uint_t *vei;
- // vei[nv] length array. vertex i is connected to edges ve[vei[i]+j], 0 <= j < vei[i+1]-vei[i]
uint_t *ve;
uint_t *bound_inds;
uint_t *bound_verts;
- double *vert_coords;
- double *edge_coords;
+ double *vx;
+ double *ex;
uint_t *dev;
uint_t *dvei;
uint_t *dve;
- double *dual_vert_coords;
+ double *dvx;
uint_t num_spanning_edges;
uint_t *spanning_edges;
- double L;
+ uint_t L;
uint_t break_dim;
cholmod_sparse *voltcurmat;
bound_t boundary;
} graph_t;
typedef struct {
- graph_t *graph;
- unsigned int num_remaining_edges;
+ const graph_t *graph;
bool *fuses;
+ double *thres;
double inf;
cholmod_dense *boundary_cond;
cholmod_factor *factor;
@@ -112,18 +109,13 @@ double dual_vert_to_coord(unsigned int width, bool periodic, unsigned int vert,
bool update_factor(cholmod_factor *factor, unsigned int v1, unsigned int v2,
cholmod_common *c);
-data_t *fracture_network(net_t *instance, double *fuse_thres,
- cholmod_common *c, double cutoff);
+data_t *net_fracture(net_t *net, cholmod_common *c, double cutoff);
double *get_current(const net_t *instance, cholmod_common *c);
double *get_current_v(const net_t *instance, double *voltages, cholmod_common *c);
double *get_voltage(const net_t *instance, cholmod_common *c);
-double *gen_fuse_thres(unsigned int num_edges, double *edge_coords, double beta,
- double (*beta_scale)(double, double, double));
-
-bool gen_crack(net_t *instance, double crack_len, double crack_width,
- cholmod_common *c);
+void net_notch(net_t *net, double notch_len, cholmod_common *c);
void update_boundary(net_t *instance, const double *avg_field);
@@ -137,18 +129,17 @@ double update_beta(double beta, unsigned int width, const double *stress,
cholmod_sparse *gen_voltcurmat(unsigned int num_edges, unsigned int num_verts,
unsigned int *edges_to_verts, cholmod_common *c);
-net_t *copy_instance(const net_t *instance, 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,
cholmod_common *c);
-void free_net(graph_t *network, cholmod_common *c);
-void free_instance(net_t *instance, cholmod_common *c);
+void graph_free(graph_t *network, cholmod_common *c);
+void net_free(net_t *instance, cholmod_common *c);
-net_t *create_instance(graph_t *network, double inf, bool voltage_bound,
- bool startnow, 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_voronoi_network(unsigned int L, bound_t boundary, bool use_dual,
+graph_t *ini_voro_graph(unsigned int L, bound_t boundary, bool use_dual,
double *(*genfunc)(unsigned int, bound_t, gsl_rng *, unsigned int *),
cholmod_common *c);
@@ -178,7 +169,7 @@ double *get_corr(net_t *instance, unsigned int **dists, cholmod_common *c);
double *bin_values(graph_t *network, unsigned int width, double *values);
-void voronoi_bound_ini(net_t *instance, uint_t L, double crack_len);
+cholmod_dense *bound_set(const graph_t *g, bool vb, double notch_len, cholmod_common *c);
data_t *alloc_break_data(unsigned int num_edges);
void free_break_data(data_t *data);
@@ -186,4 +177,3 @@ void update_break_data(data_t *data, unsigned int last_broke, double strength, d
double get_conductivity(net_t *inst, double *current, cholmod_common *c);
-void gen_voro_crack(net_t *instance, double crack_len, cholmod_common *c);