Skip to content

Commit d91a96a

Browse files
committed
checks_*: +exit_on_failure option
1 parent 5d7bfcb commit d91a96a

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/include/checks_params.hxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ struct CheckParams
77
double err_threshold = 1e-13; // maximum acceptable error
88
bool print_max_err_always = true; // always print error, even if acceptable
99
bool dump_always = false; // always dump compared fields, even if acceptable
10+
bool exit_on_failure = false; // exit the program if check fails
1011

1112
bool enabled() { return check_interval > 0; }
1213

src/libpsc/psc_checks/checks_impl.hxx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#pragma once
32

43
#include "fields.hxx"
@@ -102,7 +101,10 @@ public:
102101
MPI_Barrier(grid.comm());
103102
}
104103

105-
assert(max_err < err_threshold);
104+
if (exit_on_failure && max_err >= err_threshold) {
105+
LOG_ERROR("exiting due to failed continuity check\n");
106+
}
107+
106108
last_max_err = max_err;
107109
}
108110

@@ -185,7 +187,10 @@ public:
185187
writer_.end_step();
186188
}
187189

188-
assert(max_err < err_threshold);
190+
if (exit_on_failure && max_err >= err_threshold) {
191+
LOG_ERROR("exiting due to failed gauss check\n");
192+
}
193+
189194
last_max_err = max_err;
190195
}
191196

0 commit comments

Comments
 (0)