Skip to content

Commit b4ca9de

Browse files
committed
BUG: add report for nans
1 parent 757303d commit b4ca9de

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/neutrals.cpp

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,17 +286,28 @@ void Neutrals::nan_test(std::string variable) {
286286
//----------------------------------------------------------------------
287287

288288
bool Neutrals::check_for_nonfinites() {
289-
bool non_finites_exist = false;
289+
bool isBad = false;
290+
bool didWork = true;
291+
292+
isBad = !all_finite(density_scgc, "density_scgc");
293+
if (isBad) {
294+
report.error("non-finite found in neutral density!");
295+
didWork = false;
296+
}
290297

291-
if (!all_finite(density_scgc, "density_scgc") ||
292-
!all_finite(temperature_scgc, "temperature_scgc") ||
293-
!all_finite(velocity_vcgc, "velocity_vcgc"))
294-
non_finites_exist = true;
298+
isBad = !all_finite(temperature_scgc, "temperature_scgc");
299+
if (isBad) {
300+
report.error("non-finite found in neutral temperature!");
301+
didWork = false;
302+
}
295303

296-
if (non_finites_exist)
297-
throw std::string("Check for nonfinites failed!!!\n");
304+
isBad = !all_finite(velocity_vcgc, "velocity_vcgc");
305+
if (isBad) {
306+
report.error("non-finite found in neutral velocity!");
307+
didWork = false;
308+
}
298309

299-
return non_finites_exist;
310+
return didWork;
300311
}
301312

302313
//----------------------------------------------------------------------

0 commit comments

Comments
 (0)