diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2017-01-17 00:48:25 -0500 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2017-01-17 00:48:25 -0500 |
commit | 78d754ff9ccbda3564694f0ccd92f33c9f7e1272 (patch) | |
tree | 64b5b8fc1342abbade4a70e1690d8189d19bec31 /src | |
parent | 9e5ae3a1b40513320126d87e3914d4456a38e9d9 (diff) | |
download | fuse_networks-78d754ff9ccbda3564694f0ccd92f33c9f7e1272.tar.gz fuse_networks-78d754ff9ccbda3564694f0ccd92f33c9f7e1272.tar.bz2 fuse_networks-78d754ff9ccbda3564694f0ccd92f33c9f7e1272.zip |
added support for saving relative load on final fuse
Diffstat (limited to 'src')
-rw-r--r-- | src/fracture.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/fracture.c b/src/fracture.c index 6ad2f26..168e519 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 save_data, save_cluster_dist, use_voltage_boundaries, use_dual, save_network, save_crit_stress, save_energy, save_conductivity, - save_damage, save_threshold; + save_damage, save_threshold, save_current_load; bound_t boundary; lattice_t lattice; @@ -42,6 +42,7 @@ int main(int argc, char *argv[]) { save_conductivity = false; save_energy = false; save_threshold = false; + save_current_load = false; uint8_t bound_i; @@ -145,6 +146,9 @@ int main(int argc, char *argv[]) { case 'T': save_threshold = true; break; + case 'C': + save_current_load = true; + break; default: /* '?' */ exit(EXIT_FAILURE); } @@ -240,6 +244,11 @@ int main(int argc, char *argv[]) { thresholds = (long double *)malloc(N * sizeof(long double)); } + long double *loads; + if (save_current_load) { + loads = (long double *)malloc(N * sizeof(long double)); + } + // start cholmod cholmod_common c; @@ -357,6 +366,9 @@ int main(int argc, char *argv[]) { thresholds[i] = net->thres[data->break_list[max_pos]]; } + if (save_current_load) { + loads[i] = data->extern_field[max_pos] / net->thres[data->break_list[max_pos]]; + } if (save_data) { for (uint_t j = 0; j < data->num_broken; j++) { @@ -454,6 +466,16 @@ int main(int argc, char *argv[]) { free(thresholds); } + if (save_current_load) { + char *load_filename = (char *)malloc(filename_len * sizeof(char)); + snprintf(load_filename, filename_len, "load_%c_%c_%c_%c_%d_%g_%g.dat", lattice_c, dual_c, boundc, boundc2, L, beta, crack_len); + FILE *load_file = fopen(load_filename, "ab"); + fwrite(loads, sizeof(long double), N, load_file); + fclose(load_file); + free(load_filename); + free(loads); + } + if (save_damage) { FILE *hdam_file = fopen(d_filename, "wb"); fwrite(damage, sizeof(uint32_t), max_edges, hdam_file); |