summaryrefslogtreecommitdiff
path: root/src/net.c
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2016-12-02 12:18:41 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2016-12-02 12:18:41 -0500
commit24cee5501ea08e9611c514be604cd66ad8a4c03c (patch)
tree34030022e2a0ad7d25d84bfa6991657b53976848 /src/net.c
parent46fe4ba9b9388b771bec10598aad9dcee6f7a5c0 (diff)
downloadfuse_networks-24cee5501ea08e9611c514be604cd66ad8a4c03c.tar.gz
fuse_networks-24cee5501ea08e9611c514be604cd66ad8a4c03c.tar.bz2
fuse_networks-24cee5501ea08e9611c514be604cd66ad8a4c03c.zip
removed percolation thing, changed definition of damage to make percolation exponents work
Diffstat (limited to 'src/net.c')
-rw-r--r--src/net.c23
1 files changed, 4 insertions, 19 deletions
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);