summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/anal_process.c13
-rw-r--r--src/fracture.c14
2 files changed, 24 insertions, 3 deletions
diff --git a/src/anal_process.c b/src/anal_process.c
index 694b453..c66aea0 100644
--- a/src/anal_process.c
+++ b/src/anal_process.c
@@ -31,6 +31,8 @@ int main(int argc, char *argv[]) {
uint_t nc = argc - 1;
uint_t *Ls_c = (uint_t *)malloc(nc * sizeof(uint_t));
double *betas_c = (double *)malloc(nc * sizeof(double));
+ double *vals_c1 = (double *)malloc(nc * sizeof(double));
+ double *errors_c1 = (double *)malloc(nc * sizeof(double));
double *vals_c2 = (double *)malloc(nc * sizeof(double));
double *errors_c2 = (double *)malloc(nc * sizeof(double));
double *vals_c3 = (double *)malloc(nc * sizeof(double));
@@ -43,7 +45,7 @@ int main(int argc, char *argv[]) {
char *fn = argv[1 + i];
char *buff = (char *)malloc(20 * sizeof(char));
uint_t pos = 0; uint_t c = 0;
- while (c < 4) {
+ while (c < 5) {
if (fn[pos] == '_') {
c++;
}
@@ -78,6 +80,11 @@ int main(int argc, char *argv[]) {
fread(dist, sizeof(uint32_t), dist_len, dist_file);
fclose(dist_file);
{
+ double mom1[2];
+ mom(dist_len, 1, dist, mom1);
+ vals_c1[i] = mom1[0];
+ errors_c1[i] = mom1[1];
+
double mom2[2];
mom(dist_len, 2, dist, mom2);
vals_c2[i] = mom2[0];
@@ -100,7 +107,7 @@ int main(int argc, char *argv[]) {
FILE *out_file = fopen(out_filename, "w");
for (uint_t i = 0; i < nc; i++) {
- fprintf(out_file, "%u %g %g %g %g %g\n", Ls_c[i], betas_c[i], vals_c2[i], errors_c2[i], vals_c3[i], errors_c3[i]);
+ fprintf(out_file, "%u %g %g %g %g %g %g %g\n", Ls_c[i], betas_c[i], vals_c1[i], errors_c1[i], vals_c2[i], errors_c2[i], vals_c3[i], errors_c3[i]);
}
fclose(out_file);
@@ -108,6 +115,8 @@ int main(int argc, char *argv[]) {
free(Ls_c);
free(betas_c);
+ free(vals_c1);
+ free(errors_c1);
free(vals_c2);
free(errors_c2);
free(vals_c3);
diff --git a/src/fracture.c b/src/fracture.c
index 79558c2..74ed676 100644
--- a/src/fracture.c
+++ b/src/fracture.c
@@ -361,7 +361,19 @@ int main(int argc, char *argv[]) {
if (save_conductivity) conductivity[i] = data->conductivity[max_pos];
- if (save_damage) damage[max_pos]++;
+ if (save_damage) {
+ uint_t num_dead = 0;
+ double *tmp_voltages = net_voltages(net, &c);
+ double *tmp_currents = net_currents(net, tmp_voltages, &c);
+ for (uint_t i = 0; i < g->ne; i++) {
+ if (!net->fuses[i] && fabs(tmp_currents[i]) < cutoff) {
+ num_dead++;
+ }
+ }
+ damage[max_pos + num_dead]++;
+ free(tmp_voltages);
+ free(tmp_currents);
+ }
if (save_stress_field || save_voltage_field) {
double *tmp_voltages = net_voltages(net, &c);