aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@aei.mpg.de>2005-05-08 17:10:00 +0000
committerErik Schnetter <schnetter@aei.mpg.de>2005-05-08 17:10:00 +0000
commitf788468f8518f4e5bff5735b49f32c5a736fa5f9 (patch)
tree192094f8fce2513fb8e5179139cf5088ce3cec01 /Carpet/CarpetLib
parent1e5b7c815812f3384e5779a0eb194655e5fbe2c8 (diff)
CarpetLib: Output nice error message when the levels are not properly nested
darcs-hash:20050508171047-891bb-16398b4f0a7d38f4de71e10f5ad2f6f3f4bf26e1.gz
Diffstat (limited to 'Carpet/CarpetLib')
-rw-r--r--Carpet/CarpetLib/src/gh.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/gh.cc b/Carpet/CarpetLib/src/gh.cc
index 2a0a631f5..105ca2a37 100644
--- a/Carpet/CarpetLib/src/gh.cc
+++ b/Carpet/CarpetLib/src/gh.cc
@@ -139,8 +139,11 @@ void gh::check_base_grid_extent ()
}
}
+// Check proper nesting, i.e., whether the fine grids are contained in
+// the coarser grids
void gh::check_refinement_levels ()
{
+ bool have_error = false;
for (int ml=0; ml<mglevels(); ++ml) {
for (int rl=1; rl<reflevels(); ++rl) {
assert (all(extents().at(ml).at(rl-1).at(0).stride()
@@ -152,6 +155,7 @@ void gh::check_refinement_levels ()
for (int c=0; c<components(rl-1); ++c) {
all |= extents().at(ml).at(rl-1).at(c);
}
+#if 0
// ... remember their size ...
const int sz = all.size();
// ... then add the coarsified fine grids ...
@@ -160,7 +164,33 @@ void gh::check_refinement_levels ()
}
// ... and then check the sizes:
assert (all.size() == sz);
+#endif
+ for (int c=0; c<components(rl); ++c) {
+ ibset const finebox
+ = (extents().at(ml).at(rl).at(c).contracted_for
+ (extents().at(ml).at(rl-1).at(0)));
+ if (! (finebox <= all)) {
+ if (! have_error) {
+ cout << "The following components are not properly nested, i.e., they are not" << endl
+ << "contained within their next coarser level's components:" << endl;
+ }
+ cout << " ml " << ml << " rl " << rl << " c " << c << endl;
+ have_error = true;
+ }
+ }
+ }
+ }
+ if (have_error) {
+ cout << "The grid hierarchy looks like:" << endl;
+ for (int ml=0; ml<mglevels(); ++ml) {
+ for (int rl=0; rl<reflevels(); ++rl) {
+ for (int c=0; c<components(rl); ++c) {
+ cout << " ml " << ml << " rl " << rl << " c " << c << ": "
+ << extents().at(ml).at(rl).at(c) << endl;
+ }
+ }
}
+ CCTK_WARN (0, "The refinement hierarchy is not properly nested.");
}
}