diff options
author | Jaron Kent-Dobias <jkentdobias@g.hmc.edu> | 2016-09-22 17:31:05 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jkentdobias@g.hmc.edu> | 2016-09-22 17:31:05 -0400 |
commit | fe81403fe452750e072d292406a9718e4c48c652 (patch) | |
tree | d40fc1aff871dd65995479ad9685fb96c9e067f3 | |
parent | 77b52ecb19cf8415e67f67c78ece12b498ffa723 (diff) | |
download | fuse_networks-fe81403fe452750e072d292406a9718e4c48c652.tar.gz fuse_networks-fe81403fe452750e072d292406a9718e4c48c652.tar.bz2 fuse_networks-fe81403fe452750e072d292406a9718e4c48c652.zip |
added support for saving critical fuse thresholds
-rw-r--r-- | src/fracture.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/fracture.c b/src/fracture.c index dbe9ff5..305b5e3 100644 --- a/src/fracture.c +++ b/src/fracture.c @@ -12,7 +12,7 @@ int main(int argc, char *argv[]) { double beta, inf, cutoff, crack_len; bool crack_growth_crit, save_data, save_cluster_dist, use_voltage_boundaries, use_dual, save_network, save_crit_stress, save_stress_field, save_voltage_field, save_toughness, save_conductivity, - save_damage, save_damage_field; + save_damage, save_damage_field, save_threshold; bound_t boundary; lattice_t lattice; @@ -45,6 +45,7 @@ int main(int argc, char *argv[]) { save_damage_field = false; save_conductivity = false; save_toughness = false; + save_threshold = false; uint8_t bound_i; @@ -55,7 +56,7 @@ int main(int argc, char *argv[]) { // get commandline options - while ((opt = getopt(argc, argv, "n:L:b:B:q:dVcoNsCrtDSvel:g")) != -1) { + while ((opt = getopt(argc, argv, "n:L:b:B:q:dVcoNsCrtDSvel:gT")) != -1) { switch (opt) { case 'n': N = atoi(optarg); @@ -151,6 +152,9 @@ int main(int argc, char *argv[]) { case 't': save_toughness = true; break; + case 'T': + save_threshold = true; + break; default: /* '?' */ exit(EXIT_FAILURE); } @@ -259,6 +263,11 @@ int main(int argc, char *argv[]) { toughness = (double *)malloc(N * sizeof(double)); } + double *thresholds; + if (save_threshold) { + thresholds = (double *)malloc(N * sizeof(double)); + } + // start cholmod cholmod_common c; @@ -400,6 +409,10 @@ int main(int argc, char *argv[]) { toughness[i] = tmp_toughness; } + if (save_threshold) { + thresholds[i] = net->thres[data->break_list[max_pos]]; + } + if (save_cluster_dist) { uint_t *tmp_cluster_dist = get_cluster_dist(net, &c); for (uint_t j = 0; j < g->dnv; j++) { @@ -516,6 +529,16 @@ int main(int argc, char *argv[]) { free(toughness); } + if (save_threshold) { + char *thres_filename = (char *)malloc(filename_len * sizeof(char)); + snprintf(thres_filename, filename_len, "thrs_%c_%c_%c_%d_%g_%g.dat", lattice_c, boundc, boundc2, L, beta, crack_len); + FILE *thres_file = fopen(thres_filename, "ab"); + fwrite(thresholds, sizeof(double), N, thres_file); + fclose(thres_file); + free(thres_filename); + free(thresholds); + } + if (save_damage) { FILE *hdam_file = fopen(d_filename, "wb"); fwrite(damage, sizeof(uint32_t), max_edges, hdam_file); |