From 24cee5501ea08e9611c514be604cd66ad8a4c03c Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Fri, 2 Dec 2016 12:18:41 -0500 Subject: removed percolation thing, changed definition of damage to make percolation exponents work --- src/net.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'src/net.c') diff --git a/src/net.c b/src/net.c index 1be5613..21a2139 100644 --- a/src/net.c +++ b/src/net.c @@ -1,7 +1,7 @@ #include "fracture.h" -long double *get_thres(uint_t ne, double beta, bool perc) { +long double *get_thres(uint_t ne, double beta) { long double *thres = (long double *)malloc(ne * sizeof(long double)); assert(thres != NULL); @@ -9,8 +9,7 @@ long double *get_thres(uint_t ne, double beta, bool perc) { gsl_rng_set(r, rand_seed()); for (uint_t i = 0; i < ne; i++) { - if (perc) thres[i] = 1; - else thres[i] = rand_dist_pow(r, beta); + thres[i] = rand_dist_pow(r, beta); } gsl_rng_free(r); @@ -45,19 +44,7 @@ void net_notch(net_t *net, double notch_len, cholmod_common *c) { } } -void net_perc(net_t *net, double p, cholmod_common *c) { - gsl_rng *r = gsl_rng_alloc(GSL_RAND_GEN); - gsl_rng_set(r, rand_seed()); - - for (uint_t i = 0; i < net->graph->ne; i++) { - double x = gsl_rng_uniform_pos(r); - if (!net->fuses[i] && p > x) break_edge(net, i, c, false); - } - - gsl_rng_free(r); -} - -net_t *net_create(const graph_t *g, double inf, double beta, double notch_len, bool vb, bool perc, cholmod_common *c) { +net_t *net_create(const graph_t *g, double inf, double beta, double notch_len, bool vb, cholmod_common *c) { net_t *net = (net_t *)calloc(1, sizeof(net_t)); assert(net != NULL); @@ -65,7 +52,7 @@ net_t *net_create(const graph_t *g, double inf, double beta, double notch_len, b net->num_broken = 0; net->fuses = (bool *)calloc(g->ne, sizeof(bool)); assert(net->fuses != NULL); - net->thres = get_thres(g->ne, beta, perc); + net->thres = get_thres(g->ne, beta); net->inf = inf; net->voltage_bound = vb; @@ -90,8 +77,6 @@ net_t *net_create(const graph_t *g, double inf, double beta, double notch_len, b net_notch(net, notch_len, c); - if (perc) net_perc(net, beta, c); - { cholmod_sparse *laplacian = gen_laplacian(net, c, true); net->factor = CHOL_F(analyze)(laplacian, c); -- cgit v1.2.3-70-g09d2