summaryrefslogtreecommitdiff
path: root/src/fracture.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fracture.c')
-rw-r--r--src/fracture.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/fracture.c b/src/fracture.c
index 6798231..23bce03 100644
--- a/src/fracture.c
+++ b/src/fracture.c
@@ -151,7 +151,7 @@ int main(int argc, char *argv[]) {
(&c)->supernodal = CHOLMOD_SIMPLICIAL;
}
- fnet *network;
+ graph_t *network;
finst *perm_instance;
unsigned int c_dist_size;
unsigned int a_dist_size;
@@ -175,8 +175,8 @@ int main(int argc, char *argv[]) {
perm_instance = create_instance(network, inf, voltage_bound, false, &c);
gen_crack(perm_instance, crack_len, crack_width, &c);
finish_instance(perm_instance, &c);
- c_dist_size = network->num_dual_verts;
- a_dist_size = network->num_verts;
+ c_dist_size = network->dnv;
+ a_dist_size = network->nv;
}
// define arrays for saving cluster and avalanche distributions
@@ -279,7 +279,7 @@ int main(int argc, char *argv[]) {
printf("\033[F\033[JFRACTURE: %0*d / %d\n", (int)log10(num) + 1, DUMB + 1,
num);
- break_data *breaking_data = NULL;
+ data_t *breaking_data = NULL;
while (breaking_data == NULL) {
if (voronoi && !repeat_voronoi) {
while ((network = ini_voronoi_network(width, periodic,
@@ -293,7 +293,7 @@ int main(int argc, char *argv[]) {
}
}
double *fuse_thres = gen_fuse_thres(
- network->num_edges, network->edge_coords, beta, beta_scaling_flat);
+ network->ne, network->edge_coords, beta, beta_scaling_flat);
finst *instance = copy_instance(perm_instance, &c);
breaking_data = fracture_network(instance, fuse_thres, &c, cutoff);
free_instance(instance, &c);
@@ -350,19 +350,19 @@ int main(int argc, char *argv[]) {
if (save_cond) {
double *tmp_voltage = get_voltage(tmp_instance, &c);
- conductivity[DUMB] = fabs(tmp_voltage[tmp_instance->network->num_verts + 1] - tmp_voltage[tmp_instance->network->num_verts]);
+ conductivity[DUMB] = fabs(tmp_voltage[tmp_instance->graph->nv + 1] - tmp_voltage[tmp_instance->graph->nv]);
free(tmp_voltage);
}
if (save_homo_damage) {
- homo_damage[DUMB] = ((double)min_pos) / tmp_instance->network->num_edges;
+ homo_damage[DUMB] = ((double)min_pos) / tmp_instance->graph->ne;
}
if (save_avg_stress || save_avg_ztress) {
double *tmp_stress = get_current(tmp_instance, &c);
if (voronoi) {
double *tmp_stress_2 =
- bin_values(tmp_instance->network, width, tmp_stress);
+ bin_values(tmp_instance->graph, width, tmp_stress);
free(tmp_stress);
tmp_stress = tmp_stress_2;
}
@@ -380,12 +380,12 @@ int main(int argc, char *argv[]) {
}
if (save_damage) {
- double *tmp_damage = (double *)calloc(tmp_instance->network->num_edges, sizeof(double));
+ double *tmp_damage = (double *)calloc(tmp_instance->graph->ne, sizeof(double));
for (unsigned int i = 0; i < stop_at; i++) {
tmp_damage[breaking_data->break_list[i]] += 1;
}
if (voronoi) {
- double *tmp_damage_2 = bin_values(tmp_instance->network, width, tmp_damage);
+ double *tmp_damage_2 = bin_values(tmp_instance->graph, width, tmp_damage);
free(tmp_damage);
tmp_damage = tmp_damage_2;
}
@@ -397,7 +397,7 @@ int main(int argc, char *argv[]) {
if (save_clusters) {
unsigned int *tmp_cluster_dist = get_cluster_dist(tmp_instance, &c);
- for (unsigned int i = 0; i < network->num_dual_verts; i++) {
+ for (unsigned int i = 0; i < network->dnv; i++) {
cluster_size_dist[i] += tmp_cluster_dist[i];
}
free(tmp_cluster_dist);
@@ -405,7 +405,7 @@ int main(int argc, char *argv[]) {
if (save_corr) {
double *tmp_corr = get_corr(tmp_instance, dists, &c);
- for (unsigned int i = 0; i < tmp_instance->network->num_dual_verts; i++) {
+ for (unsigned int i = 0; i < tmp_instance->graph->dnv; i++) {
avg_corr[i] += tmp_corr[i] / num;
}
free(tmp_corr);
@@ -413,27 +413,27 @@ int main(int argc, char *argv[]) {
if (network_out) {
FILE *net_out = fopen("network.txt", "w");
- for (unsigned int i = 0; i < network->num_verts; i++) {
+ for (unsigned int i = 0; i < network->nv; i++) {
fprintf(net_out, "%f %f ", network->vert_coords[2 * i],
network->vert_coords[2 * i + 1]);
}
fprintf(net_out, "\n");
- for (unsigned int i = 0; i < network->num_edges; i++) {
- fprintf(net_out, "%u %u ", network->edges_to_verts[2 * i],
- network->edges_to_verts[2 * i + 1]);
+ for (unsigned int i = 0; i < network->ne; i++) {
+ fprintf(net_out, "%u %u ", network->ev[2 * i],
+ network->ev[2 * i + 1]);
}
fprintf(net_out, "\n");
- for (unsigned int i = 0; i < network->num_dual_verts; i++) {
+ for (unsigned int i = 0; i < network->dnv; i++) {
fprintf(net_out, "%f %f ", network->dual_vert_coords[2 * i],
network->dual_vert_coords[2 * i + 1]);
}
fprintf(net_out, "\n");
- for (unsigned int i = 0; i < network->num_edges; i++) {
- fprintf(net_out, "%u %u ", network->dual_edges_to_verts[2 * i],
- network->dual_edges_to_verts[2 * i + 1]);
+ for (unsigned int i = 0; i < network->ne; i++) {
+ fprintf(net_out, "%u %u ", network->dev[2 * i],
+ network->dev[2 * i + 1]);
}
fprintf(net_out, "\n");
- for (unsigned int i = 0; i < network->num_edges; i++) {
+ for (unsigned int i = 0; i < network->ne; i++) {
fprintf(net_out, "%d ", tmp_instance->fuses[i]);
}
fclose(net_out);
@@ -441,7 +441,7 @@ int main(int argc, char *argv[]) {
free_instance(tmp_instance, &c);
if (voronoi && !repeat_voronoi) {
- free_fnet(network, &c);
+ free_net(network, &c);
free_instance(perm_instance, &c);
}
if (include_breaking) {
@@ -510,7 +510,7 @@ int main(int argc, char *argv[]) {
if (!voronoi || repeat_voronoi) {
free_instance(perm_instance, &c);
- //free_fnet(network, &c);
+ //free_net(network, &c);
}
if (include_breaking) {