diff --git a/CarpetX/src/valid.cxx b/CarpetX/src/valid.cxx index 8fc815253..908311056 100644 --- a/CarpetX/src/valid.cxx +++ b/CarpetX/src/valid.cxx @@ -326,6 +326,7 @@ void check_valid(const GHExt::PatchData::LevelData &leveldata, struct info_t { where_t where; + int patch, level, block; vect I; vect X; CCTK_REAL val; @@ -337,38 +338,55 @@ void check_valid(const GHExt::PatchData::LevelData &leveldata, const Loop::GridDescBaseDevice grid(cctkGH); const Loop::GF3D2layout layout(cctkGH, groupdata.indextype); const Loop::GF3D2 gf( - layout, static_cast(CCTK_VarDataPtrI( + layout, static_cast(CCTK_VarDataPtrI( cctkGH, tl, groupdata.firstvarindex + vi))); +#pragma omp critical(CarpetX_check_valid) + std::cerr << "valid grid=" << grid << "\n"; if (valid.valid_int) - grid.loop_idx( - where_t::interior, groupdata.indextype, groupdata.nghostzones, - [&](const Loop::PointDesc &p) { - if (nan_check(grid, gf, p)) + grid.loop_idx(where_t::interior, groupdata.indextype, + groupdata.nghostzones, [&](const Loop::PointDesc &p) { + if (nan_check(grid, gf, p)) #pragma omp critical(CarpetX_check_valid) - infos.push_back(info_t{where_t::interior, p.I, p.X, gf(p.I)}); - }); + infos.push_back(info_t{where_t::interior, p.patch, + p.level, p.block, p.I, p.X, + gf(p.I)}); + }); if (valid.valid_outer) - grid.loop_idx( - where_t::boundary, groupdata.indextype, groupdata.nghostzones, - [&](const Loop::PointDesc &p) { - if (nan_check(grid, gf, p)) + grid.loop_idx(where_t::boundary, groupdata.indextype, + groupdata.nghostzones, [&](const Loop::PointDesc &p) { + if (nan_check(grid, gf, p)) #pragma omp critical(CarpetX_check_valid) - infos.push_back(info_t{where_t::interior, p.I, p.X, gf(p.I)}); - }); + infos.push_back(info_t{where_t::boundary, p.patch, + p.level, p.block, p.I, p.X, + gf(p.I)}); + }); if (valid.valid_ghosts) - grid.loop_idx( - where_t::ghosts, groupdata.indextype, groupdata.nghostzones, - [&](const Loop::PointDesc &p) { - if (nan_check(grid, gf, p)) + grid.loop_idx(where_t::ghosts, groupdata.indextype, + groupdata.nghostzones, [&](const Loop::PointDesc &p) { + if (nan_check(grid, gf, p)) #pragma omp critical(CarpetX_check_valid) - infos.push_back(info_t{where_t::interior, p.I, p.X, gf(p.I)}); - }); + infos.push_back(info_t{where_t::ghosts, p.patch, + p.level, p.block, p.I, p.X, + gf(p.I)}); + }); }); synchronize(); std::sort(infos.begin(), infos.end(), [](const info_t &a, const info_t &b) { + if (a.level < b.level) + return true; + if (a.level > b.level) + return false; + if (a.patch < b.patch) + return true; + if (a.patch > b.patch) + return false; + if (a.block < b.block) + return true; + if (a.block > b.block) + return false; const std::less > lt; return lt(reversed(a.I), reversed(b.I)); }); @@ -377,7 +395,9 @@ void check_valid(const GHExt::PatchData::LevelData &leveldata, buf << setprecision(std::numeric_limits::digits10 + 1); for (const auto &info : infos) buf << "\n" - << info.where << " " << info.I << " " << info.X << " " << info.val; + << info.where << " level " << info.level << " patch " << info.patch + << " block " << info.block << " " << info.I << " " << info.X << " " + << info.val; CCTK_WARN(CCTK_WARN_ALERT, buf.str().c_str()); CCTK_VERROR("%s: Grid function \"%s\" contains nans, infinities, or "