diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2010-03-18 15:39:41 -0700 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2011-12-14 16:45:37 +0000 |
commit | 9860dd154631392f33ec40229b5b17d1e26b6dad (patch) | |
tree | 83785031db35d83235b3c6558c4f7da929d78af6 | |
parent | 361bc07818a53dab9ce2d65f5639ab54d80238be (diff) |
CarpetRegrid2: Check for nans in the region locations and sizes
-rw-r--r-- | Carpet/CarpetRegrid2/src/regrid.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Carpet/CarpetRegrid2/src/regrid.cc b/Carpet/CarpetRegrid2/src/regrid.cc index c5ea20a80..bf7a43afb 100644 --- a/Carpet/CarpetRegrid2/src/regrid.cc +++ b/Carpet/CarpetRegrid2/src/regrid.cc @@ -66,6 +66,15 @@ namespace CarpetRegrid2 { this->num_levels = num_levels[n]; this->active = active[n]; this->position = rvect (position_x[n], position_y[n], position_z[n]); + if (any (not CarpetLib::good::isfinite(this->position))) { + CCTK_VWarn (CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING, + "The position of region %d is [%g,%g,%g], which is not finite", + n + 1, + double(this->position[0]), + double(this->position[1]), + double(this->position[2])); + found_error = true; + } this->radius.resize (this->num_levels); this->radius.at(0) = rvect(-1.0, -1.0, -1.0); // unused for (int rl = 1; rl < this->num_levels; ++ rl) { @@ -74,6 +83,15 @@ namespace CarpetRegrid2 { CCTK_REAL const ry = radius_y[ind] < 0.0 ? radius[ind] : radius_y[ind]; CCTK_REAL const rz = radius_z[ind] < 0.0 ? radius[ind] : radius_z[ind]; rvect const rad (rx, ry, rz); + if (any (not CarpetLib::good::isfinite(rad))) { + CCTK_VWarn (CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING, + "The radius of refinement level %d of region %d is [%g,%g,%g], which is not finite", + rl, n + 1, + double(this->radius.at(rl)[0]), + double(this->radius.at(rl)[1]), + double(this->radius.at(rl)[2])); + found_error = true; + } if (any (rad < 0.0)) { CCTK_VWarn (CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING, "The radius of refinement level %d of region %d is [%g,%g,%g], which is non-negative", |