aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2007-09-18 11:25:00 +0000
committerErik Schnetter <schnetter@cct.lsu.edu>2007-09-18 11:25:00 +0000
commite927fec0377421da162413225c95ab36351b6110 (patch)
treee37432055cb031e4ee6a58fa24063f547d2ab667
parentf3f83a84b1e8373c34461f7c783f5129ac87d214 (diff)
CarpetRegrid2: Correct logic error in ensuring proper nesting
Correct logic error when ensuring proper nesting. Check for proper nesting after ensuring it. darcs-hash:20070918112539-dae7b-7161de9f758e0d81279994ece9bc476fc29d641c.gz
-rw-r--r--Carpet/CarpetRegrid2/src/regrid.cc63
1 files changed, 41 insertions, 22 deletions
diff --git a/Carpet/CarpetRegrid2/src/regrid.cc b/Carpet/CarpetRegrid2/src/regrid.cc
index da4023f6e..eea342919 100644
--- a/Carpet/CarpetRegrid2/src/regrid.cc
+++ b/Carpet/CarpetRegrid2/src/regrid.cc
@@ -318,10 +318,9 @@ namespace CarpetRegrid2 {
//
- // Ensure that this grid contains all finer ones
+ // Ensure that this grid contains the next finer grid
//
if (rl < regions.size() - 1) {
- bool is_properly_nested = true;
ibbox const & coarse0 = * regions.at(rl).begin();
@@ -329,37 +328,57 @@ namespace CarpetRegrid2 {
i2vect const cdistance =
i2vect (min_distance + dd.prolongation_stencil_size());
- for (ibboxset::const_iterator ibb = regions.at(rl+1).begin();
- ibb != regions.at(rl+1).end();
- ++ ibb)
- {
- ibbox const & fbb = * ibb;
+ if (ensure_proper_nesting) {
- bvect const lower_is_outer = fbb.lower() <= physical_ilower;
- bvect const upper_is_outer = fbb.upper() >= physical_iupper;
- b2vect const ob (lower_is_outer, upper_is_outer);
+ for (ibboxset::const_iterator ibb = regions.at(rl+1).begin();
+ ibb != regions.at(rl+1).end();
+ ++ ibb)
+ {
+ ibbox const & fbb = * ibb;
+
+ bvect const lower_is_outer = fbb.lower() <= physical_ilower;
+ bvect const upper_is_outer = fbb.upper() >= physical_iupper;
+ b2vect const ob (lower_is_outer, upper_is_outer);
+
+ ibbox const ebb = fbb.expand (i2vect (not ob) * fdistance);
+ ibbox const cbb = ebb.expanded_for (coarse0);
+ ibbox const ecbb = cbb.expand (i2vect (not ob) * cdistance);
+
+ // Enlarge this level
+ regions.at(rl) |= ecbb;
+ }
- ibbox const ebb = fbb.expand (i2vect (ob) * fdistance);
- ibbox const cbb = ebb.expanded_for (coarse0);
- ibbox const ecbb = cbb.expand (i2vect (ob) * cdistance);
+ regions.at(rl).normalize();
- is_properly_nested = is_properly_nested and ecbb <= regions.at(rl);
+ } // if ensure proper nesting
+
+ {
+ bool is_properly_nested = true;
- // Enlarge this level
- if (ensure_proper_nesting) {
- regions.at(rl) |= ecbb;
+ for (ibboxset::const_iterator ibb = regions.at(rl+1).begin();
+ ibb != regions.at(rl+1).end();
+ ++ ibb)
+ {
+ ibbox const & fbb = * ibb;
+
+ bvect const lower_is_outer = fbb.lower() <= physical_ilower;
+ bvect const upper_is_outer = fbb.upper() >= physical_iupper;
+ b2vect const ob (lower_is_outer, upper_is_outer);
+
+ ibbox const ebb = fbb.expand (i2vect (ob) * fdistance);
+ ibbox const cbb = ebb.expanded_for (coarse0);
+ ibbox const ecbb = cbb.expand (i2vect (ob) * cdistance);
+
+ is_properly_nested = is_properly_nested and ecbb <= regions.at(rl);
}
- }
-
- if (ensure_proper_nesting) {
- regions.at(rl).normalize();
- } else {
+
if (not is_properly_nested) {
ostringstream msg;
msg << "Level " << rl << " of the refinement hierarchy is not properly nested. It does not contain level " << (rl+1) << ".";
CCTK_WARN (CCTK_WARN_ALERT, msg.str().c_str());
}
}
+
}