aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/gh.cc
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2008-03-19 16:43:33 -0500
committerErik Schnetter <schnetter@cct.lsu.edu>2008-03-19 16:43:33 -0500
commitc7bbd2f7401eeaece92daa48ef773e7388e8644b (patch)
tree7709237d0feae04e5571dda6a64dcb9b6b82955d /Carpet/CarpetLib/src/gh.cc
parent315da175d4fa2ac1143b99ea7d9ef912bc47c75d (diff)
Enhance support for multi-patch simulations
Carpet: Ensure that at most one of GetDomainSpecificatio or MultiPatch_GetDomainSpecification is defined. Allow the boundary case of having zero regions on a refinement level. CarpetLib: Allow the boundary case of having zero components on a patch, if there are still more than zero components overall. CarpetIOASCII: Loop over the components using explicit light-weight for loops instead of Carpet's looping macros. This is faster, since less state information needs to be updated. Correct an inconsistency in converting between integer indices and coordinates in multi-patch simulations. CarpetRegrid2: Take multi-patch systems into account.
Diffstat (limited to 'Carpet/CarpetLib/src/gh.cc')
-rw-r--r--Carpet/CarpetLib/src/gh.cc53
1 files changed, 28 insertions, 25 deletions
diff --git a/Carpet/CarpetLib/src/gh.cc b/Carpet/CarpetLib/src/gh.cc
index 6a7738048..fa9ff2125 100644
--- a/Carpet/CarpetLib/src/gh.cc
+++ b/Carpet/CarpetLib/src/gh.cc
@@ -108,7 +108,7 @@ regrid (mregs const & regs)
// Check component consistency
for (int ml=0; ml<mglevels(); ++ml) {
for (int rl=0; rl<reflevels(); ++rl) {
- assert (components(rl)>0);
+ assert (components(rl)>=0);
for (int c=0; c<components(rl); ++c) {
ibbox const & b = extent(ml,rl,c);
ibbox const & b0 = extent(ml,rl,0);
@@ -136,31 +136,34 @@ regrid (mregs const & regs)
bool have_error = false;
for (int ml=0; ml<mglevels(); ++ml) {
for (int rl=1; rl<reflevels(); ++rl) {
- assert (all (extent(ml,rl,0).stride() * reffacts.AT(rl) ==
- extent(ml,rl-1,0).stride() * reffacts.AT(rl-1)));
- // Check contained-ness:
- // first take all coarse grids
- ibset coarse;
- for (int c=0; c<components(rl-1); ++c) {
- coarse += extent(ml,rl-1,c);
- }
- coarse.normalize();
- // then check all fine grids
- for (int c=0; c<components(rl); ++c) {
- ibbox const & fine =
- extent(ml,rl,c).contracted_for(extent(ml,rl-1,0));
- if (not (fine <= coarse)) {
- if (not have_error) {
- cout << "The following components are not properly nested, i.e.," << endl
- << "they are not contained within the next coarser level's components:" << endl;
- have_error = true;
- }
- cout << " ml " << ml << " rl " << rl << " c " << c << ": "
- << fine << endl;
+ if (components(rl)>0) {
+ assert (components(rl-1)>0);
+ assert (all (extent(ml,rl,0).stride() * reffacts.AT(rl) ==
+ extent(ml,rl-1,0).stride() * reffacts.AT(rl-1)));
+ // Check contained-ness:
+ // first take all coarse grids
+ ibset coarse;
+ for (int c=0; c<components(rl-1); ++c) {
+ coarse += extent(ml,rl-1,c);
}
- } // for c
- } // for rl
- } // for ml
+ coarse.normalize();
+ // then check all fine grids
+ for (int c=0; c<components(rl); ++c) {
+ ibbox const & fine =
+ extent(ml,rl,c).contracted_for(extent(ml,rl-1,0));
+ if (not (fine <= coarse)) {
+ if (not have_error) {
+ cout << "The following components are not properly nested, i.e.," << endl
+ << "they are not contained within the next coarser level's components:" << endl;
+ have_error = true;
+ }
+ cout << " ml " << ml << " rl " << rl << " c " << c << ": "
+ << fine << endl;
+ }
+ } // for c
+ } // if c
+ } // for rl
+ } // for ml
if (have_error) {
cout << "The grid hierarchy is:" << endl;
for (int ml=0; ml<mglevels(); ++ml) {