diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2007-01-12 22:53:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2007-01-12 22:53:00 +0000 |
commit | 156f5b4449079d8f0a7d5ca2ffb14eb11fec0c31 (patch) | |
tree | 0cc84a8698ed435f0e9ae950150836f418327600 /Carpet/CarpetRegrid/src | |
parent | f90cb457361ae2ad6aec6da1403610a712194f78 (diff) |
CarpetRegrid: Adapt to region_t changes
darcs-hash:20070112225327-dae7b-74ff79a72ca975876875ee6ec7494d3a6125ef17.gz
Diffstat (limited to 'Carpet/CarpetRegrid/src')
-rw-r--r-- | Carpet/CarpetRegrid/src/automatic.cc | 315 | ||||
-rw-r--r-- | Carpet/CarpetRegrid/src/baselevel.cc | 6 | ||||
-rw-r--r-- | Carpet/CarpetRegrid/src/centre.cc | 40 | ||||
-rw-r--r-- | Carpet/CarpetRegrid/src/manualcoordinatelist.cc | 113 | ||||
-rw-r--r-- | Carpet/CarpetRegrid/src/manualcoordinates.cc | 43 | ||||
-rw-r--r-- | Carpet/CarpetRegrid/src/manualgridpointlist.cc | 56 | ||||
-rw-r--r-- | Carpet/CarpetRegrid/src/manualgridpoints.cc | 46 | ||||
-rw-r--r-- | Carpet/CarpetRegrid/src/moving.cc | 35 | ||||
-rw-r--r-- | Carpet/CarpetRegrid/src/regrid.cc | 30 | ||||
-rw-r--r-- | Carpet/CarpetRegrid/src/regrid.hh | 66 |
10 files changed, 370 insertions, 380 deletions
diff --git a/Carpet/CarpetRegrid/src/automatic.cc b/Carpet/CarpetRegrid/src/automatic.cc index 18079de90..1325f855e 100644 --- a/Carpet/CarpetRegrid/src/automatic.cc +++ b/Carpet/CarpetRegrid/src/automatic.cc @@ -26,16 +26,14 @@ namespace CarpetRegrid { int Automatic (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss) + gh::mregs & regsss) { DECLARE_CCTK_PARAMETERS; assert (refinement_levels >= 1); - assert (bbsss.size() >= 1); - vector<vector<ibbox> > bbss = bbsss.at(0); + assert (regsss.size() >= 1); + vector<vector<region_t> > regss = regsss.at(0); @@ -57,38 +55,30 @@ namespace CarpetRegrid { assert (! smart_outer_boundaries); - vector<ibbox> bbs; - gh::cbnds obs; + vector<region_t> regs; Automatic_OneLevel (cctkGH, hh, reflevel, min(reflevels+1, (int)refinement_levels), - errorgf, bbs, obs); + errorgf, regs); // make multiprocessor aware - gh::cprocs ps; - SplitRegions (cctkGH, bbs, obs, ps); + SplitRegions (cctkGH, regs); - if (bbs.size() == 0) { + if (regs.size() == 0) { // remove all finer levels - bbss.resize(reflevel+1); - obss.resize(reflevel+1); - pss.resize(reflevel+1); + regss.resize(reflevel+1); } else { - assert (reflevel < (int)bbss.size()); - if (reflevel+1 == (int)bbss.size()) { + assert (reflevel < (int)regss.size()); + if (reflevel+1 == (int)regss.size()) { // add a finer level - bbss.push_back (bbs); - obss.push_back (obs); - pss.push_back (ps); + regss.push_back (regs); } else { // change a finer level - bbss.at(reflevel+1) = bbs; - obss.at(reflevel+1) = obs; - pss.at(reflevel+1) = ps; + regss.at(reflevel+1) = regs; } } // make multigrid aware - MakeMultigridBoxes (cctkGH, bbss, obss, bbsss); + MakeMultigridBoxes (cctkGH, regss, regsss); return 1; } @@ -100,8 +90,7 @@ namespace CarpetRegrid { const int rl, const int numrl, const gf<CCTK_REAL> & errorgf, - vector<ibbox> & bbs, - vector<bbvect> & obs) + vector<region_t> & regs) { DECLARE_CCTK_PARAMETERS; @@ -118,56 +107,49 @@ namespace CarpetRegrid { cout << endl << "MRA: Choosing regions to refine on level " << rl << " in " << hh.components(rl) << " components" << endl; } - list<ibbox> bbl; + list<region_t> regl; for (int c=0; c<hh.components(rl); ++c) { - const ibbox region = hh.extents().at(ml).at(rl).at(c); - assert (! region.empty()); + const region_t region = hh.regions().at(ml).at(rl).at(c); + assert (! region.extent.empty()); const data<CCTK_REAL>& errordata = *errorgf(tl,rl,c,ml); - Automatic_Recursive (cctkGH, hh, errordata, bbl, region, reffact); + Automatic_Recursive (cctkGH, hh, errordata, regl, region, reffact); } if (veryverbose) { int numpoints = 0; - for (list<ibbox>::const_iterator ibb = bbl.begin(); ibb != bbl.end(); ++ibb) { - numpoints += ibb->size(); + for (list<region_t>::const_iterator ireg = regl.begin(); ireg != regl.end(); ++ireg) { + numpoints += ireg->extent.size(); } - cout << "MRA: Chose " << bbl.size() << " regions with a total size of " << numpoints << " to refine." << endl << endl; + cout << "MRA: Chose " << regl.size() << " regions with a total size of " << numpoints << " to refine." << endl << endl; } - // Create bbs from bbl - assert (bbs.size() == 0); - bbs.reserve (bbl.size()); - for (list<ibbox>::const_iterator it = bbl.begin(); it != bbl.end(); ++it) { - bbs.push_back (*it); + // Create regs from regl + assert (regs.size() == 0); + regs.reserve (regl.size()); + for (list<region_t>::const_iterator it = regl.begin(); it != regl.end(); ++it) { + regs.push_back (*it); } // Remove grid points outside the outer boundary - bbvect const obp (false); - for (size_t c=0; c<bbs.size(); ++c) { - const ivect lb = either (xpose(obp)[0], - bbs.at(c).lower(), - max (bbs.at(c).lower(), hh.baseextent.lower())); - const ivect ub = either (xpose(obp)[1], - bbs.at(c).upper(), - min (bbs.at(c).upper(), hh.baseextent.upper())); - bbs.at(c) = ibbox(lb, ub, bbs.at(c).stride()); - } - - // Create obs from bbs - obs.resize (bbs.size()); - for (size_t c=0; c<bbs.size(); ++c) { - assert (hh.bases().size()>0 and hh.bases().at(0).size()>0); -#if 0 - obs.at(c) = zip ((vect<bool,2> (*) (bool, bool)) &vect<bool,2>::make, - bbs.at(c).lower() == hh.baseextent.lower(), - bbs.at(c).upper() == hh.baseextent.upper()); -#else - obs.at(c) = xpose (b2vect (bbs.at(c).lower() == hh.baseextent.lower(), - bbs.at(c).upper() == hh.baseextent.upper())); -#endif - + b2vect const obp (false); + for (size_t c=0; c<regs.size(); ++c) { + const ivect lb = either (obp[0], + regs.at(c).extent.lower(), + max (regs.at(c).extent.lower(), + hh.baseextent.lower())); + const ivect ub = either (obp[1], + regs.at(c).extent.upper(), + min (regs.at(c).extent.upper(), + hh.baseextent.upper())); + regs.at(c).extent = ibbox(lb, ub, regs.at(c).extent.stride()); + regs.at(c).outer_boundaries = + b2vect (regs.at(c).extent.lower() == hh.baseextent.lower(), + regs.at(c).extent.upper() == hh.baseextent.upper()); + regs.at(c).refinement_boundaries[0] = ! regs.at(c).outer_boundaries[0]; + regs.at(c).refinement_boundaries[1] = ! regs.at(c).outer_boundaries[1]; + regs.at(c).map = Carpet::map; } } @@ -177,14 +159,14 @@ namespace CarpetRegrid { void Automatic_Recursive (const cGH * const cctkGH, const gh & hh, const data<CCTK_REAL> & errordata, - list<ibbox> & bbl, - const ibbox & region, + list<region_t> & regl, + const region_t & region, const ivect & reffact) { DECLARE_CCTK_PARAMETERS; // Just to be sure - assert (! region.empty()); + assert (! region.extent.empty()); // Count grid points that need to be refined // (this doesn't work yet on multiple processors) @@ -192,11 +174,11 @@ namespace CarpetRegrid { int cnt = 0; { ivect const off - = (region.lower() - errordata.extent().lower()) / region.stride(); + = (region.extent.lower() - errordata.extent().lower()) / region.extent.stride(); ivect const len - = region.shape() / region.stride(); + = region.extent.shape() / region.extent.stride(); ivect const lsh - = errordata.extent().shape() / region.stride(); + = errordata.extent().shape() / region.extent.stride(); CCTK_REAL const * const errorptr = (CCTK_REAL const *) errordata.storage(); for (int k=0; k<len[2]; ++k) { @@ -209,57 +191,63 @@ namespace CarpetRegrid { } } } - const int width = maxval(region.shape() / region.stride()); - const CCTK_REAL fraction = (CCTK_REAL) cnt / region.size(); + const int width = maxval(region.extent.shape() / region.extent.stride()); + const CCTK_REAL fraction = (CCTK_REAL) cnt / region.extent.size(); if (cnt == 0) { // Don't refine } else if (any (reffact*width < (int)(2*minwidth)) or fraction >= minfraction) { // Refine the whole region - const ivect lo(region.lower()); - const ivect up(region.upper()); - const ivect str(region.stride()); - const ibbox region0(lo,up+str-str/reffact,str/reffact); - bbl.push_back (region0); + const ivect lo(region.extent.lower()); + const ivect up(region.extent.upper()); + const ivect str(region.extent.stride()); + const ibbox ext(lo,up+str-str/reffact,str/reffact); + region_t region0 (region); + region0.extent = ext; + regl.push_back (region0); if (veryverbose) { - cout << "MRA: Refining to " << region0 << " size " << region0.size() << " fraction " << fraction << endl; + cout << "MRA: Refining to " << region0.extent << " size " << region0.extent.size() << " fraction " << fraction << endl; } } else { // Split the region and check recursively - const int dir = maxloc(region.shape()); - const ivect lo(region.lower()); - const ivect up(region.upper()); - const ivect str(region.stride()); + const int dir = maxloc(region.extent.shape()); + const ivect lo(region.extent.lower()); + const ivect up(region.extent.upper()); + const ivect str(region.extent.stride()); ivect lo1(lo), lo2(lo); ivect up1(up), up2(up); const int mgstr = ipow(hh.mgfact, mglevels); // honour multigrid factors const int step = str[dir]*mgstr; lo2[dir] = ((up[dir]+lo[dir])/2/step)*step; up1[dir] = lo2[dir]-str[dir]; - const ibbox region1(lo1,up1,str); - const ibbox region2(lo2,up2,str); - assert (region1.is_contained_in(region)); - assert (region2.is_contained_in(region)); - assert ((region1 & region2).empty()); - assert (region1 + region2 == region); - list<ibbox> bbl1, bbl2; - Automatic_Recursive (cctkGH, hh, errordata, bbl1, region1, reffact); - Automatic_Recursive (cctkGH, hh, errordata, bbl2, region2, reffact); + const ibbox ext1(lo1,up1,str); + const ibbox ext2(lo2,up2,str); + assert (ext1.is_contained_in(region.extent)); + assert (ext2.is_contained_in(region.extent)); + assert ((ext1 & ext2).empty()); + assert (ext1 + ext2 == region.extent); + region_t region1(region); + region_t region2(region); + region1.extent = ext1; + region2.extent = ext2; + list<region_t> regl1, regl2; + Automatic_Recursive (cctkGH, hh, errordata, regl1, region1, reffact); + Automatic_Recursive (cctkGH, hh, errordata, regl2, region2, reffact); // Combine regions if possible up2 += str-str/reffact; up2[dir] = lo2[dir]; const ibbox iface(lo2,up2,str/reffact); - Automatic_Recombine (bbl1, bbl2, bbl, iface, dir); + Automatic_Recombine (regl1, regl2, regl, iface, dir); } } - void Automatic_Recombine (list<ibbox> & bbl1, - list<ibbox> & bbl2, - list<ibbox> & bbl, + void Automatic_Recombine (list<region_t> & regl1, + list<region_t> & regl2, + list<region_t> & regl, const ibbox & iface, const int dir) { @@ -268,53 +256,53 @@ namespace CarpetRegrid { assert (!iface.empty()); assert (iface.lower()[dir] == iface.upper()[dir]); - const int oldnumboxes = bbl.size() + bbl1.size() + bbl2.size(); + const int oldnumboxes = regl.size() + regl1.size() + regl2.size(); int numcombinedboxes = 0; int oldnumpoints = 0; - for (list<ibbox>::const_iterator ibb = bbl.begin(); - ibb != bbl.end(); - ++ibb) + for (list<region_t>::const_iterator ireg = regl.begin(); + ireg != regl.end(); + ++ireg) { - oldnumpoints += ibb->size(); + oldnumpoints += ireg->extent.size(); } - for (list<ibbox>::const_iterator ibb1 = bbl1.begin(); - ibb1 != bbl1.end(); - ++ibb1) + for (list<region_t>::const_iterator ireg1 = regl1.begin(); + ireg1 != regl1.end(); + ++ireg1) { - oldnumpoints += ibb1->size(); + oldnumpoints += ireg1->extent.size(); } - for (list<ibbox>::const_iterator ibb2 = bbl2.begin(); - ibb2 != bbl2.end(); - ++ibb2) + for (list<region_t>::const_iterator ireg2 = regl2.begin(); + ireg2 != regl2.end(); + ++ireg2) { - oldnumpoints += ibb2->size(); + oldnumpoints += ireg2->extent.size(); } #if 0 // remember old bounding boxes bboxset<int,dim> oldboxes; - for (list<ibbox>::const_iterator ibb1 = bbl1.begin(); - ibb1 != bbl1.end(); - ++ibb1) + for (list<region_t>::const_iterator ireg1 = regl1.begin(); + ireg1 != regl1.end(); + ++ireg1) { - oldboxes += *ibb1; + oldboxes += ireg1->extent; } - for (list<ibbox>::const_iterator ibb2 = bbl2.begin(); - ibb2 != bbl2.end(); - ++ibb2) + for (list<regino_t>::const_iterator ireg2 = regl2.begin(); + ireg2 != regl2.end(); + ++ireg2) { - oldboxes += *ibb2; + oldboxes += ireg2;->extent } #endif #if 0 cout << endl; cout << "MakeRegions_Adaptively_Recombine: initial list:" << endl; - cout << bbl << endl; + cout << regl << endl; cout << "MakeRegions_Adaptively_Recombine: initial list 1:" << endl; - cout << bbl1 << endl; + cout << regl1 << endl; cout << "MakeRegions_Adaptively_Recombine: initial list 2:" << endl; - cout << bbl2 << endl; + cout << regl2 << endl; #endif const ivect lo = iface.lower(); @@ -323,51 +311,51 @@ namespace CarpetRegrid { { // prune boxes on the left - list<ibbox>::iterator ibb1 = bbl1.begin(); - while (ibb1 != bbl1.end()) { + list<region_t>::iterator ireg1 = regl1.begin(); + while (ireg1 != regl1.end()) { // is this bbox just to the left of the interface? -// const ivect lo1 = ibb1->lower(); - const ivect up1 = ibb1->upper(); - const ivect str1 = ibb1->stride(); +// const ivect lo1 = ireg1->extent.lower(); + const ivect up1 = ireg1->extent.upper(); + const ivect str1 = ireg1->extent.stride(); assert (up1[dir]+str1[dir] <= lo[dir]); assert (all(str1 == str)); if (up1[dir]+str1[dir] < lo[dir]) { // no: forget it - bbl.push_back (*ibb1); - ibb1 = bbl1.erase(ibb1); + regl.push_back (*ireg1); + ireg1 = regl1.erase(ireg1); continue; } - ++ibb1; + ++ireg1; } // while } { // prune boxes on the right - list<ibbox>::iterator ibb2 = bbl2.begin(); - while (ibb2 != bbl2.end()) { - // is this bbox just to the right of the interface? - const ivect lo2 = ibb2->lower(); -// const ivect up2 = ibb2->upper(); - const ivect str2 = ibb2->stride(); + list<region_t>::iterator ireg2 = regl2.begin(); + while (ireg2 != regl2.end()) { + // is this regox just to the right of the interface? + const ivect lo2 = ireg2->extent.lower(); +// const ivect up2 = ireg2->extent.upper(); + const ivect str2 = ireg2->extent.stride(); assert (up[dir] <= lo2[dir]); assert (all(str2 == str)); if (up[dir] < lo2[dir]) { // no: forget it - bbl.push_back (*ibb2); - ibb2 = bbl2.erase(ibb2); + regl.push_back (*ireg2); + ireg2 = regl2.erase(ireg2); continue; } - ++ibb2; + ++ireg2; } // while } { // walk all boxes on the left - list<ibbox>::iterator ibb1 = bbl1.begin(); - while (ibb1 != bbl1.end()) { - ivect lo1 = ibb1->lower(); - ivect up1 = ibb1->upper(); - ivect str1 = ibb1->stride(); + list<region_t>::iterator ireg1 = regl1.begin(); + while (ireg1 != regl1.end()) { + ivect lo1 = ireg1->extent.lower(); + ivect up1 = ireg1->extent.upper(); + ivect str1 = ireg1->extent.stride(); assert (up1[dir]+str1[dir] == lo[dir]); lo1[dir] = lo[dir]; up1[dir] = up[dir]; @@ -375,11 +363,11 @@ namespace CarpetRegrid { { // walk all boxes on the right - list<ibbox>::iterator ibb2 = bbl2.begin(); - while (ibb2 != bbl2.end()) { - ivect lo2 = ibb2->lower(); - ivect up2 = ibb2->upper(); - ivect str2 = ibb2->stride(); + list<region_t>::iterator ireg2 = regl2.begin(); + while (ireg2 != regl2.end()) { + ivect lo2 = ireg2->extent.lower(); + ivect up2 = ireg2->extent.upper(); + ivect str2 = ireg2->extent.stride(); assert (lo2[dir] == up[dir]); lo2[dir] = lo[dir]; up2[dir] = up[dir]; @@ -387,49 +375,54 @@ namespace CarpetRegrid { // check for a match if (iface1 == iface2) { - const ibbox combined (ibb1->lower(), ibb2->upper(), str); - bbl.push_back (combined); - ibb1 = bbl1.erase(ibb1); - ibb2 = bbl2.erase(ibb2); + region_t combined (*ireg1); + combined.extent = ibbox (ireg1->extent.lower(), ireg2->extent.upper(), str); + combined.outer_boundaries[0] = ireg1->outer_boundaries[0]; + combined.outer_boundaries[1] = ireg2->outer_boundaries[0]; + combined.refinement_boundaries[0] = ireg1->refinement_boundaries[0]; + combined.refinement_boundaries[1] = ireg2->refinement_boundaries[0]; + regl.push_back (combined); + ireg1 = regl1.erase(ireg1); + ireg2 = regl2.erase(ireg2); ++numcombinedboxes; if (veryverbose) { assert (dir<3); - cout << "MRA: Combining along " << "xyz"[dir] << " to " << bbl.back() << " size " << bbl.back().size() << endl; + cout << "MRA: Combining along " << "xyz"[dir] << " to " << regl.back().extent << " size " << regl.back().extent.size() << endl; } goto continue_search; } - ++ibb2; + ++ireg2; } // while } - ++ibb1; + ++ireg1; continue_search:; } // while } - bbl.splice (bbl.end(), bbl1); - bbl.splice (bbl.end(), bbl2); + regl.splice (regl.end(), regl1); + regl.splice (regl.end(), regl2); - assert (bbl1.empty() and bbl2.empty()); + assert (regl1.empty() and regl2.empty()); - const int newnumboxes = bbl.size(); + const int newnumboxes = regl.size(); assert (newnumboxes + numcombinedboxes == oldnumboxes); int newnumpoints = 0; - for (list<ibbox>::const_iterator ibb = bbl.begin(); ibb != bbl.end(); ++ibb) { - newnumpoints += ibb->size(); + for (list<region_t>::const_iterator ireg = regl.begin(); ireg != regl.end(); ++ireg) { + newnumpoints += ireg->extent.size(); } assert (newnumpoints == oldnumpoints); #if 0 // find new bounding boxes bboxset<int,dim> newboxes; - for (list<ibbox>::const_iterator ibb = bbl.begin(); - ibb != bbl.end(); - ++ibb) + for (list<region_t>::const_iterator ireg = regl.begin(); + ireg != regl.end(); + ++ireg) { - newboxes += *ibb; + newboxes += ireg->extent; } // Check that they are equal @@ -439,7 +432,7 @@ namespace CarpetRegrid { #endif #if 0 cout << "MakeRegions_Adaptively_Recombine: final list:" << endl; - cout << bbl << endl; + cout << regl << endl; cout << endl; #endif } diff --git a/Carpet/CarpetRegrid/src/baselevel.cc b/Carpet/CarpetRegrid/src/baselevel.cc index a2579d8ec..105b9f72c 100644 --- a/Carpet/CarpetRegrid/src/baselevel.cc +++ b/Carpet/CarpetRegrid/src/baselevel.cc @@ -19,15 +19,13 @@ namespace CarpetRegrid { int BaseLevel (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss) + gh::mregs & regsss) { DECLARE_CCTK_PARAMETERS; assert (refinement_levels == 1); - assert (bbsss.size() == 1); + assert (regsss.size() == 1); return 0; } diff --git a/Carpet/CarpetRegrid/src/centre.cc b/Carpet/CarpetRegrid/src/centre.cc index 26871b576..466f3de13 100644 --- a/Carpet/CarpetRegrid/src/centre.cc +++ b/Carpet/CarpetRegrid/src/centre.cc @@ -19,9 +19,7 @@ namespace CarpetRegrid { int Centre (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss) + gh::mregs & regsss) { DECLARE_CCTK_PARAMETERS; @@ -30,12 +28,10 @@ namespace CarpetRegrid { // do nothing if the levels already exist if (reflevel == refinement_levels) return 0; - assert (bbsss.size() >= 1); - vector<vector<ibbox> > bbss = bbsss.at(0); + assert (regsss.size() >= 1); + vector<vector<region_t> > regss = regsss.at(0); - bbss.resize (refinement_levels); - obss.resize (refinement_levels); - pss.resize (refinement_levels); + regss.resize (refinement_levels); bvect const symmetric (symmetry_x, symmetry_y, symmetry_z); ivect const zero(0), one(1), two(2); @@ -46,7 +42,7 @@ namespace CarpetRegrid { assert (! smart_outer_boundaries); - for (size_t rl=1; rl<bbss.size(); ++rl) { + for (size_t rl=1; rl<regss.size(); ++rl) { // save old values ivect const oldrlb = rlb; @@ -63,26 +59,28 @@ namespace CarpetRegrid { rub = oldrub - symmetric.ifthen(half, quarter); assert (all(rlb >= oldrlb and rub <= oldrub)); - ibbox const bb (rlb, rub, rstr); - vector<ibbox> bbs (1); - bbs.at(0) = bb; + vector<region_t> regs (1); - bbvect const ob (false); - gh::cbnds obs (1); - obs.at(0) = ob; + ibbox const ext (rlb, rub, rstr); + regs.at(0).extent = ext; + + b2vect const ob (false); + regs.at(0).outer_boundaries = ob; + + b2vect const rb (true); + regs.at(0).refinement_boundaries = rb; + + regs.at(0).map = Carpet::map; // make multiprocessor aware - gh::cprocs ps; - SplitRegions (cctkGH, bbs, obs, ps); + SplitRegions (cctkGH, regs); - bbss.at(rl) = bbs; - obss.at(rl) = obs; - pss.at(rl) = ps; + regss.at(rl) = regs; } // for rl // make multigrid aware - MakeMultigridBoxes (cctkGH, bbss, obss, bbsss); + MakeMultigridBoxes (cctkGH, regss, regsss); return 1; } diff --git a/Carpet/CarpetRegrid/src/manualcoordinatelist.cc b/Carpet/CarpetRegrid/src/manualcoordinatelist.cc index faf49a25c..0712f965e 100644 --- a/Carpet/CarpetRegrid/src/manualcoordinatelist.cc +++ b/Carpet/CarpetRegrid/src/manualcoordinatelist.cc @@ -23,9 +23,7 @@ namespace CarpetRegrid { int ManualCoordinateList (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss) + gh::mregs & regsss) { DECLARE_CCTK_PARAMETERS; int ierr; @@ -35,8 +33,8 @@ namespace CarpetRegrid { // do nothing if the levels already exist if (reflevel == refinement_levels && !tracking) return 0; - assert (bbsss.size() >= 1); - vector<vector<ibbox> > bbss = bbsss.at(0); + assert (regsss.size() >= 1); + vector<vector<region_t> > regss = regsss.at(0); jjvect nboundaryzones, is_internal, is_staggered, shiftout; ierr = GetBoundarySpecification @@ -53,9 +51,7 @@ namespace CarpetRegrid { &exterior_min[0], &exterior_max[0], &base_spacing[0]); assert (!ierr); - bbss.resize (refinement_levels); - obss.resize (refinement_levels); - pss.resize (refinement_levels); + regss.resize (refinement_levels); vector<vector<rbbox> > newbbss; if (strcmp(coordinates, "") != 0) { @@ -78,7 +74,7 @@ namespace CarpetRegrid { // Remove superfluous boxes newbbss.resize (refinement_levels-1); - vector<vector<bbvect> > newobss; + vector<vector<b2vect> > newobss; if (smart_outer_boundaries) { // TODO: // assert (domain_from_coordbase); @@ -101,16 +97,16 @@ namespace CarpetRegrid { rvect lo = newbbss.at(rl).at(c).lower(); rvect up = newbbss.at(rl).at(c).upper(); rvect str = newbbss.at(rl).at(c).stride(); - bbvect ob = newobss.at(rl).at(c); + b2vect ob; for (int d=0; d<dim; ++d) { - ob[d][0] = (abs(newbbss.at(rl).at(c).lower()[d] - physical_min[d]) + ob[0][d] = (abs(newbbss.at(rl).at(c).lower()[d] - physical_min[d]) < 1.0e-6 * spacing[d]); - if (ob[d][0]) { + if (ob[0][d]) { lo[d] = exterior_min[d]; } - ob[d][1] = (abs(newbbss.at(rl).at(c).upper()[d] - physical_max[d]) + ob[1][d] = (abs(newbbss.at(rl).at(c).upper()[d] - physical_max[d]) < 1.0e-6 * base_spacing[d] / spacereffact[d]); - if (ob[d][1]) { + if (ob[1][d]) { up[d] = exterior_max[d]; } str[d] *= ipow((CCTK_REAL)mgfact, basemglevel); @@ -122,58 +118,79 @@ namespace CarpetRegrid { } else { // if ! smart_outer_boundaries + vector<vector<bbvect> > newobss1; if (strcmp(outerbounds, "") != 0) { istringstream ob_str (outerbounds); try { - ob_str >> newobss; + ob_str >> newobss1; } catch (input_error) { CCTK_WARN (0, "Could not parse parameter \"outerbounds\""); } - if (newobss.size() >= spacereffacts.size()) { + if (newobss1.size() >= spacereffacts.size()) { CCTK_WARN (0, "Parameter \"outerbounds\" defines too many refinement levels; at most Carpet::max_refinement_levels - 1 may be defined"); } - bool good = newobss.size() == newbbss.size(); + bool good = newobss1.size() == newbbss.size(); if (good) { - for (int rl=0; rl<(int)newobss.size(); ++rl) { - good = good and newobss.at(rl).size() == newbbss.at(rl).size(); + for (int rl=0; rl<(int)newobss1.size(); ++rl) { + good = good and newobss1.at(rl).size() == newbbss.at(rl).size(); } } if (! good) { cout << "coordinates: " << newbbss << endl; - cout << "outerbounds: " << newobss << endl; + cout << "outerbounds: " << newobss1 << endl; CCTK_WARN (0, "The parameters \"outerbounds\" and \"coordinates\" must have the same structure"); } + + newobss.resize(newobss1.size()); + for (int rl=0; rl<(int)newobss.size(); ++rl) { + newobss.at(rl).resize(newobss1.at(rl).size()); + for (int c=0; c<(int)newobss.at(rl).size(); ++c) { + newobss.at(rl).at(c) = xpose(newobss1.at(rl).at(c)); + } + } + } else { newobss.resize(newbbss.size()); for (int rl=0; rl<(int)newobss.size(); ++rl) { newobss.at(rl).resize(newbbss.at(rl).size()); for (int c=0; c<(int)newobss.at(rl).size(); ++c) { - newobss.at(rl).at(c) = bbvect(false); + newobss.at(rl).at(c) = b2vect(false); } } } } // if ! smart_outer_boundaries + vector<vector<b2vect> > newrbss (newobss.size()); + for (int rl=0; rl<(int)newobss.size(); ++rl) { + newrbss.at(rl).resize(newbbss.at(rl).size()); + for (int c=0; c<(int)newobss.at(rl).size(); ++c) { + b2vect const & ob = newobss.at(rl).at(c); + b2vect & rb = newrbss.at(rl).at(c); + for (int d=0; d<dim; ++d) { + for (int f=0; f<2; ++f) { + rb[f][d] = ! ob[f][d]; + } + } + } + } + for (int rl=1; rl<refinement_levels; ++rl) { - vector<ibbox> bbs; - gh::cbnds obs; - - bbs.reserve (newbbss.at(rl-1).size()); - obs.reserve (newbbss.at(rl-1).size()); + vector<region_t> regs; + regs.reserve (newbbss.at(rl-1).size()); for (int c=0; c<(int)newbbss.at(rl-1).size(); ++c) { rbbox const & ext = newbbss.at(rl-1).at(c); - bbvect const & ob = newobss.at(rl-1).at(c); + b2vect const & ob = newobss.at(rl-1).at(c); + b2vect const & rb = newrbss.at(rl-1).at(c); // TODO: // assert (domain_from_coordbase); ivect const spacereffact = spacereffacts.at(rl); rvect const spacing = - base_spacing * ipow((CCTK_REAL)mgfact, basemglevel) + base_spacing * ipow(CCTK_REAL(mgfact), basemglevel) / rvect(spacereffact); - if (! all(abs(ext.stride() - spacing) - < spacing * (CCTK_REAL) 1.0e-10)) { + if (! all(abs(ext.stride() - spacing) < spacing * CCTK_REAL(1.0e-10))) { assert (dim==3); CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, "The grid spacing on refinement level %d is incorrect. I expected [%g,%g,%g], but I found [%g,%g,%g].", @@ -182,7 +199,7 @@ namespace CarpetRegrid { double(ext.stride()[0]), double(ext.stride()[1]), double(ext.stride()[2])); } assert (all(abs(ext.stride() - spacing) - < spacing * (CCTK_REAL) 1.0e-10)); + < spacing * CCTK_REAL(1.0e-10))); rvect offset = rvect(0); if (c < num_offsets) { @@ -191,25 +208,34 @@ namespace CarpetRegrid { offset = rvect(offsetx[c], offsety[c], offsetz[c]); } } - + + region_t reg; + reg.map = Carpet::map; + reg.outer_boundaries = ob; + reg.refinement_boundaries = rb; + ManualCoordinates_OneLevel (cctkGH, hh, rl, refinement_levels, - ext.lower() + offset, ext.upper() + offset, ob, bbs, obs); + ext.lower() + offset, ext.upper() + offset, reg, regs); } - + if (merge_overlapping_components) { // Check if one or more of our components touch again: // Loop over all pairs of components - for (int c=0; c<(int)bbs.size(); ++c) { + for (int c=0; c<(int)regs.size(); ++c) { for (int cc=0; cc<c; ++cc) { - ibbox const overlap = bbs.at(c) & bbs.at(cc); + ibbox const overlap = regs.at(c).extent & regs.at(cc).extent; if (not overlap.empty()) { ibbox const combined = - bbs.at(c).expanded_containing (bbs.at(cc)); - bbs.at(c) = combined; - bbs.erase (bbs.begin() + cc); + regs.at(c).extent.expanded_containing (regs.at(cc).extent); + regs.at(c).extent = combined; + assert (all (all (regs.at(c).outer_boundaries == + regs.at(cc).outer_boundaries))); + assert (all (all (regs.at(c).refinement_boundaries == + regs.at(cc).refinement_boundaries))); + regs.erase (regs.begin() + cc); goto again; } } @@ -218,17 +244,14 @@ namespace CarpetRegrid { } // if merge_overlapping_components // make multiprocessor aware - gh::cprocs ps; - SplitRegions (cctkGH, bbs, obs, ps); + SplitRegions (cctkGH, regs); - bbss.at(rl) = bbs; - obss.at(rl) = obs; - pss.at(rl) = ps; + regss.at(rl) = regs; } // for rl // make multigrid aware - MakeMultigridBoxes (cctkGH, bbss, obss, bbsss); + MakeMultigridBoxes (cctkGH, regss, regsss); return 1; } diff --git a/Carpet/CarpetRegrid/src/manualcoordinates.cc b/Carpet/CarpetRegrid/src/manualcoordinates.cc index f11c8393b..d19ac1bab 100644 --- a/Carpet/CarpetRegrid/src/manualcoordinates.cc +++ b/Carpet/CarpetRegrid/src/manualcoordinates.cc @@ -20,9 +20,7 @@ namespace CarpetRegrid { int ManualCoordinates (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss) + gh::mregs & regsss) { DECLARE_CCTK_PARAMETERS; @@ -34,12 +32,10 @@ namespace CarpetRegrid { // do nothing if the levels already exist if (reflevel == refinement_levels) return 0; - assert (bbsss.size() >= 1); - vector<vector<ibbox> > bbss = bbsss.at(0); + assert (regsss.size() >= 1); + vector<vector<region_t> > regss = regsss.at(0); - bbss.resize (refinement_levels); - obss.resize (refinement_levels); - pss.resize (refinement_levels); + regss.resize (refinement_levels); vector<rvect> lower(3), upper(3); lower.at(0) = rvect (l1xmin, l1ymin, l1zmin); @@ -51,29 +47,29 @@ namespace CarpetRegrid { assert (! smart_outer_boundaries); - for (size_t rl=1; rl<bbss.size(); ++rl) { + for (size_t rl=1; rl<regss.size(); ++rl) { - bbvect const ob (false); - - vector<ibbox> bbs; - gh::cbnds obs; + b2vect const ob (false); + b2vect const rb (true); + region_t reg; + reg.map = Carpet::map; + reg.outer_boundaries = ob; + reg.refinement_boundaries = rb; + vector<region_t> regs; ManualCoordinates_OneLevel (cctkGH, hh, rl, refinement_levels, - lower.at(rl-1), upper.at(rl-1), ob, bbs, obs); + lower.at(rl-1), upper.at(rl-1), reg, regs); // make multiprocessor aware - gh::cprocs ps; - SplitRegions (cctkGH, bbs, obs, ps); + SplitRegions (cctkGH, regs); - bbss.at(rl) = bbs; - obss.at(rl) = obs; - pss.at(rl) = ps; + regss.at(rl) = regs; } // for rl // make multigrid aware - MakeMultigridBoxes (cctkGH, bbss, obss, bbsss); + MakeMultigridBoxes (cctkGH, regss, regsss); return 1; } @@ -86,9 +82,8 @@ namespace CarpetRegrid { const int numrl, const rvect lower, const rvect upper, - const bbvect obound, - vector<ibbox> & bbs, - vector<bbvect> & obs) + const region_t & reg, + vector<region_t> & regs) { if (rl >= numrl) return; @@ -96,7 +91,7 @@ namespace CarpetRegrid { jvect const iupper = pos2int (cctkGH, hh, upper, rl); ManualGridpoints_OneLevel - (cctkGH, hh, rl, numrl, ilower, iupper, obound, bbs, obs); + (cctkGH, hh, rl, numrl, ilower, iupper, reg, regs); } diff --git a/Carpet/CarpetRegrid/src/manualgridpointlist.cc b/Carpet/CarpetRegrid/src/manualgridpointlist.cc index 6425345f1..a94831e16 100644 --- a/Carpet/CarpetRegrid/src/manualgridpointlist.cc +++ b/Carpet/CarpetRegrid/src/manualgridpointlist.cc @@ -23,9 +23,7 @@ namespace CarpetRegrid { int ManualGridpointList (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss) + gh::mregs & regsss) { DECLARE_CCTK_PARAMETERS; @@ -34,12 +32,10 @@ namespace CarpetRegrid { // do nothing if the levels already exist if (reflevel == refinement_levels) return 0; - assert (bbsss.size() >= 1); - vector<vector<ibbox> > bbss = bbsss.at(0); + assert (regsss.size() >= 1); + vector<vector<region_t> > regss = regsss.at(0); - bbss.resize (refinement_levels); - obss.resize (refinement_levels); - pss.resize (refinement_levels); + regss.resize (refinement_levels); vector<vector<ibbox> > newbbss; if (strcmp(gridpoints, "") != 0) { @@ -74,45 +70,63 @@ namespace CarpetRegrid { newobss.resize(newbbss.size()); for (size_t rl=0; rl<newobss.size(); ++rl) { newobss.at(rl).resize(newbbss.at(rl).size()); + for (size_t c=0; c<newobss.at(rl).size(); ++c) { newobss.at(rl).at(c) = bbvect(false); } } } + vector<vector<bbvect> > newrbss; + newrbss.resize (newobss.size()); + for (int rl=0; rl<(int)newobss.size(); ++rl) { + newrbss.at(rl).resize(newbbss.at(rl).size()); + for (int c=0; c<(int)newobss.at(rl).size(); ++c) { + bbvect const & ob = newobss.at(rl).at(c); + bbvect & rb = newrbss.at(rl).at(c); + for (int d=0; d<dim; ++d) { + for (int f=0; f<2; ++f) { + rb[d][f] = ! ob[d][f]; + } + } + } + } + if (newbbss.size() < refinement_levels-1) { CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, "The parameter \"gridpoints\" must contain at least \"refinement_levels-1\" (here: %d) levels", (int)refinement_levels-1); } + vector<vector<region_t> > newregs (newbbss.size()); for (size_t rl=1; rl<refinement_levels; ++rl) { - vector<ibbox> bbs; - gh::cbnds obs; + vector<region_t> regs; - bbs.reserve (newbbss.at(rl-1).size()); - obs.reserve (newbbss.at(rl-1).size()); + regs.reserve (newbbss.at(rl-1).size()); for (size_t c=0; c<newbbss.at(rl-1).size(); ++c) { - ibbox const & ext = newbbss.at(rl-1).at(c); - bbvect const & ob = newobss.at(rl-1).at(c); + ibbox const ext = newbbss.at(rl-1).at(c); + b2vect const ob = xpose (newobss.at(rl-1).at(c)); + b2vect const rb = xpose (newobss.at(rl-1).at(c)); + region_t reg; + reg.extent = ext; + reg.map = Carpet::map; + reg.outer_boundaries = ob; + reg.refinement_boundaries = rb; ManualGridpoints_OneLevel (cctkGH, hh, rl, refinement_levels, - ext.lower(), ext.upper(), ob, bbs, obs); + ext.lower(), ext.upper(), reg, regs); } // make multiprocessor aware - gh::cprocs ps; - SplitRegions (cctkGH, bbs, obs, ps); + SplitRegions (cctkGH, regs); - bbss.at(rl) = bbs; - obss.at(rl) = obs; - pss.at(rl) = ps; + regss.at(rl) = regs; } // for rl // make multigrid aware - MakeMultigridBoxes (cctkGH, bbss, obss, bbsss); + MakeMultigridBoxes (cctkGH, regss, regsss); return 1; } diff --git a/Carpet/CarpetRegrid/src/manualgridpoints.cc b/Carpet/CarpetRegrid/src/manualgridpoints.cc index 6e783adc2..b4e27c94d 100644 --- a/Carpet/CarpetRegrid/src/manualgridpoints.cc +++ b/Carpet/CarpetRegrid/src/manualgridpoints.cc @@ -22,9 +22,7 @@ namespace CarpetRegrid { int ManualGridpoints (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss) + gh::mregs & regsss) { DECLARE_CCTK_PARAMETERS; @@ -36,12 +34,10 @@ namespace CarpetRegrid { // do nothing if the levels already exist if (reflevel == refinement_levels) return 0; - assert (bbsss.size() >= 1); - vector<vector<ibbox> > bbss = bbsss.at(0); + assert (regsss.size() >= 1); + vector<vector<region_t> > regss = regsss.at(0); - bbss.resize (refinement_levels); - obss.resize (refinement_levels); - pss.resize (refinement_levels); + regss.resize (refinement_levels); vector<ivect> ilower(3), iupper(3); ilower.at(0) = ivect (l1ixmin, l1iymin, l1izmin); @@ -53,29 +49,29 @@ namespace CarpetRegrid { assert (! smart_outer_boundaries); - for (size_t rl=1; rl<bbss.size(); ++rl) { + for (size_t rl=1; rl<regss.size(); ++rl) { - bbvect const ob (false); - - vector<ibbox> bbs; - gh::cbnds obs; + b2vect const ob (false); + b2vect const rb (true); + region_t reg; + reg.map = Carpet::map; + reg.outer_boundaries = ob; + reg.refinement_boundaries = rb; + vector<region_t> regs; ManualGridpoints_OneLevel (cctkGH, hh, rl,refinement_levels, - ilower.at(rl-1), iupper.at(rl-1), ob, bbs, obs); + ilower.at(rl-1), iupper.at(rl-1), reg, regs); // make multiprocessor aware - gh::cprocs ps; - SplitRegions (cctkGH, bbs, obs, ps); + SplitRegions (cctkGH, regs); - bbss.at(rl) = bbs; - obss.at(rl) = obs; - pss.at(rl) = ps; + regss.at(rl) = regs; } // for rl // make multigrid aware - MakeMultigridBoxes (cctkGH, bbss, obss, bbsss); + MakeMultigridBoxes (cctkGH, regss, regsss); return 1; } @@ -88,9 +84,8 @@ namespace CarpetRegrid { const int numrl, const ivect ilower, const ivect iupper, - const bbvect obound, - vector<ibbox> & bbs, - vector<bbvect> & obs) + const region_t & reg, + vector<region_t> & regs) { const ivect rstr = hh.baseextent.stride(); const ivect rlb = hh.baseextent.lower(); @@ -119,8 +114,9 @@ namespace CarpetRegrid { assert (all(lb<=ub)); assert (all(lb%str==0 and ub%str==0)); - bbs.push_back (ibbox(lb, ub, str)); - obs.push_back (obound); + region_t newreg (reg); + newreg.extent = ibbox(lb, ub, str); + regs.push_back (newreg); } } // namespace CarpetRegrid diff --git a/Carpet/CarpetRegrid/src/moving.cc b/Carpet/CarpetRegrid/src/moving.cc index 4580a0b93..61953bcb3 100644 --- a/Carpet/CarpetRegrid/src/moving.cc +++ b/Carpet/CarpetRegrid/src/moving.cc @@ -20,28 +20,25 @@ namespace CarpetRegrid { int Moving (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss) + gh::mregs & regsss) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; assert (refinement_levels >= 1); - assert (bbsss.size() >= 1); - vector<vector<ibbox> > bbss = bbsss.at(0); + assert (regsss.size() >= 1); + vector<vector<region_t> > regss = regsss.at(0); - bbss.resize (refinement_levels); - obss.resize (refinement_levels); - pss.resize (refinement_levels); + regss.resize (refinement_levels); bvect const symmetric (symmetry_x, symmetry_y, symmetry_z); - bbvect const ob (false); + b2vect const ob (false); + b2vect const rb (true); assert (! smart_outer_boundaries); - for (size_t rl=1; rl<bbss.size(); ++rl) { + for (size_t rl=1; rl<regss.size(); ++rl) { // calculate new extent CCTK_REAL const argument = 2*M_PI * moving_circle_frequency * cctk_time; @@ -55,24 +52,24 @@ namespace CarpetRegrid { rvect const rlb (symmetric.ifthen (rvect(0), pos - radius)); rvect const rub (symmetric.ifthen (radius , pos + radius)); - vector<ibbox> bbs; - gh::cbnds obs; + region_t reg; + reg.map = Carpet::map; + reg.outer_boundaries = b2vect (false); + reg.refinement_boundaries = b2vect (true); + vector<region_t> regs; ManualCoordinates_OneLevel - (cctkGH, hh, rl, refinement_levels, rlb, rub, ob, bbs, obs); + (cctkGH, hh, rl, refinement_levels, rlb, rub, reg, regs); // make multiprocessor aware - gh::cprocs ps; - SplitRegions (cctkGH, bbs, obs, ps); + SplitRegions (cctkGH, regs); - bbss.at(rl) = bbs; - obss.at(rl) = obs; - pss.at(rl) = ps; + regss.at(rl) = regs; } // for rl // make multigrid aware - MakeMultigridBoxes (cctkGH, bbss, obss, bbsss); + MakeMultigridBoxes (cctkGH, regss, regsss); return 1; } diff --git a/Carpet/CarpetRegrid/src/regrid.cc b/Carpet/CarpetRegrid/src/regrid.cc index 7ab7d85c7..2a12e68b3 100644 --- a/Carpet/CarpetRegrid/src/regrid.cc +++ b/Carpet/CarpetRegrid/src/regrid.cc @@ -19,25 +19,21 @@ namespace CarpetRegrid { using namespace Carpet; CCTK_INT CarpetRegrid_Regrid (CCTK_POINTER_TO_CONST const cctkGH_, - CCTK_POINTER const bbsss_, - CCTK_POINTER const obss_, - CCTK_POINTER const pss_, + CCTK_POINTER const regsss_, CCTK_INT force) { DECLARE_CCTK_PARAMETERS; const cGH * const cctkGH = (const cGH *) cctkGH_; - gh::mexts & bbsss = * (gh::mexts *) bbsss_; - gh::rbnds & obss = * (gh::rbnds *) obss_; - gh::rprocs & pss = * (gh::rprocs *) pss_; + gh::mregs & regsss = * (gh::mregs *) regsss_; gh const & hh = *vhh.at(Carpet::map); assert (is_singlemap_mode()); - // In force mode (force == true) we do not check the - // CarpetRegrid parameters + // In force mode (force == true) we do not check the CarpetRegrid + // parameters if (!force) { @@ -152,44 +148,46 @@ namespace CarpetRegrid { if (CCTK_EQUALS(refined_regions, "none")) { - do_recompose = BaseLevel (cctkGH, hh, bbsss, obss, pss); + do_recompose = BaseLevel (cctkGH, hh, regsss); } else if (CCTK_EQUALS(refined_regions, "centre")) { - do_recompose = Centre (cctkGH, hh, bbsss, obss, pss); + do_recompose = Centre (cctkGH, hh, regsss); } else if (CCTK_EQUALS(refined_regions, "manual-gridpoints")) { do_recompose - = ManualGridpoints (cctkGH, hh, bbsss, obss, pss); + = ManualGridpoints (cctkGH, hh, regsss); } else if (CCTK_EQUALS(refined_regions, "manual-coordinates")) { do_recompose - = ManualCoordinates (cctkGH, hh, bbsss, obss, pss); + = ManualCoordinates (cctkGH, hh, regsss); } else if (CCTK_EQUALS(refined_regions, "manual-gridpoint-list")) { do_recompose - = ManualGridpointList (cctkGH, hh, bbsss, obss, pss); + = ManualGridpointList (cctkGH, hh, regsss); } else if (CCTK_EQUALS(refined_regions, "manual-coordinate-list")) { do_recompose - = ManualCoordinateList (cctkGH, hh, bbsss, obss, pss); + = ManualCoordinateList (cctkGH, hh, regsss); } else if (CCTK_EQUALS(refined_regions, "moving")) { - do_recompose = Moving (cctkGH, hh, bbsss, obss, pss); + do_recompose = Moving (cctkGH, hh, regsss); } else if (CCTK_EQUALS(refined_regions, "automatic")) { - do_recompose = Automatic (cctkGH, hh, bbsss, obss, pss); + do_recompose = Automatic (cctkGH, hh, regsss); } else { assert (0); } + assert (regsss.size() > 0); + return do_recompose; } diff --git a/Carpet/CarpetRegrid/src/regrid.hh b/Carpet/CarpetRegrid/src/regrid.hh index 715d7047d..b7d727317 100644 --- a/Carpet/CarpetRegrid/src/regrid.hh +++ b/Carpet/CarpetRegrid/src/regrid.hh @@ -10,6 +10,7 @@ #include "bbox.hh" #include "gf.hh" #include "gh.hh" +#include "region.hh" #include "vect.hh" #include "carpet.hh" @@ -30,13 +31,9 @@ namespace CarpetRegrid { // Aliased functions // CCTK_INT CarpetRegrid_Regrid (const cGH * const cctkGH, -// gh<dim>::mexts * bbsss, -// gh<dim>::rbnds * obss, -// gh<dim>::rprocs * pss); +// gh<dim>::mregs * regsss); CCTK_INT CarpetRegrid_Regrid (CCTK_POINTER_TO_CONST const cctkGH_, - CCTK_POINTER const bbsss_, - CCTK_POINTER const obss_, - CCTK_POINTER const pss_, + CCTK_POINTER const regsss_, CCTK_INT force); } @@ -44,21 +41,15 @@ namespace CarpetRegrid { int BaseLevel (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss); + gh::mregs & regsss); int Centre (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss); + gh::mregs & regsss); int ManualGridpoints (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss); + gh::mregs & regsss); void ManualGridpoints_OneLevel (const cGH * const cctkGH, const gh & hh, @@ -66,15 +57,12 @@ namespace CarpetRegrid { const int numrl, const ivect ilower, const ivect iupper, - const bbvect obound, - vector<ibbox> & bbs, - vector<bbvect> & obs); + const region_t & reg, + vector<region_t> & regs); int ManualCoordinates (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss); + gh::mregs & regsss); void ManualCoordinates_OneLevel (const cGH * const cctkGH, const gh & hh, @@ -82,9 +70,8 @@ namespace CarpetRegrid { const int numrl, const rvect lower, const rvect upper, - const bbvect obound, - vector<ibbox> & bbs, - vector<bbvect> & obs); + const region_t & reg, + vector<region_t> & regs); ivect delta2int (const cGH * const cctkGH, const gh& hh, @@ -97,49 +84,40 @@ namespace CarpetRegrid { int ManualGridpointList (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss); + gh::mregs & regsss); int ManualCoordinateList (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss); + gh::mregs & regsss); int Moving (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss); + gh::mregs & regsss); int Automatic (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss); + gh::mregs & regsss); void Automatic_OneLevel (const cGH * const cctkGH, const gh & hh, const int rl, const int numrl, const gf<CCTK_REAL> & errorvar, - vector<ibbox> & bbs, - vector<bbvect> & obs); + vector<region_t> & regs); void Automatic_Recursive (const cGH * const cctkGH, const gh & hh, const data<CCTK_REAL> & errorvar, - list<ibbox> & bbl, - const ibbox & region, + list<region_t> & regl, + const region_t & region, const ivect & reffact); - void Automatic_Recombine (list<ibbox> & bbl1, - list<ibbox> & bbl2, - list<ibbox> & bbl, + void Automatic_Recombine (list<region_t> & regl1, + list<region_t> & regl2, + list<region_t> & regl, const ibbox & iface, const int dir); } // namespace CarpetRegrid -#endif // !defined(CARPETREGRID_HH) +#endif // #ifndef CARPETREGRID_HH |