From f65b896e853a5f2f0b43cb9e44cf373a71de0000 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Fri, 12 Jan 2007 19:29:00 +0000 Subject: CarpetAdaptiveRegrid: Add refinement descriptor to regridding API Adapt to recent change in Carpet's regridding API: In addition to the bounding boxes, outer boundary descriptors, and processor numbers, also a refinement boundary descriptor needs to be filled in. darcs-hash:20070112192953-dae7b-24a0a3252ef78755e2e2714f54482f116be86f98.gz --- CarpetDev/CarpetAdaptiveRegrid/interface.ccl | 11 ++---- CarpetDev/CarpetAdaptiveRegrid/src/CAR.cc | 41 ++++++++++++++-------- CarpetDev/CarpetAdaptiveRegrid/src/CAR.hh | 23 ++++++------ .../src/manualcoordinatelist.cc | 31 ++++++++++++---- 4 files changed, 64 insertions(+), 42 deletions(-) (limited to 'CarpetDev') diff --git a/CarpetDev/CarpetAdaptiveRegrid/interface.ccl b/CarpetDev/CarpetAdaptiveRegrid/interface.ccl index 086e17d02..7f88cd04d 100644 --- a/CarpetDev/CarpetAdaptiveRegrid/interface.ccl +++ b/CarpetDev/CarpetAdaptiveRegrid/interface.ccl @@ -51,13 +51,8 @@ USES FUNCTION ConvertFromPhysicalBoundary # The true prototype of the routine below: # int Carpet_Regrid (const cGH * cctkGH, -# gh::rexts * bbsss, -# gh::rbnds * obss, -# gh::rprocs * pss); -CCTK_INT FUNCTION Carpet_Regrid (CCTK_POINTER_TO_CONST IN cctkGH, \ - CCTK_POINTER IN bbsss, \ - CCTK_POINTER IN obss, \ - CCTK_POINTER IN pss, \ +# gh::regs * regsss); +CCTK_INT FUNCTION Carpet_Regrid (CCTK_POINTER_TO_CONST IN cctkGH, \ + CCTK_POINTER IN regsss, \ CCTK_INT IN force) PROVIDES FUNCTION Carpet_Regrid WITH CarpetAdaptiveRegrid_Regrid LANGUAGE C - diff --git a/CarpetDev/CarpetAdaptiveRegrid/src/CAR.cc b/CarpetDev/CarpetAdaptiveRegrid/src/CAR.cc index 2e4388921..c90d83b80 100644 --- a/CarpetDev/CarpetAdaptiveRegrid/src/CAR.cc +++ b/CarpetDev/CarpetAdaptiveRegrid/src/CAR.cc @@ -39,8 +39,7 @@ namespace CarpetAdaptiveRegrid { // the "standard" variables before being passed back to Carpet. // - static gh::mexts local_bbsss; - static gh::rbnds local_obss; + static gh::mregs local_regsss; // // Keep track of the last iteration on which we were called. This @@ -99,9 +98,7 @@ namespace CarpetAdaptiveRegrid { // CCTK_INT CarpetAdaptiveRegrid_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; @@ -120,11 +117,9 @@ namespace CarpetAdaptiveRegrid { // refinement levels, maps. // - 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); + gh const & hh = *vhh.at(map); assert (is_singlemap_mode()); @@ -139,17 +134,22 @@ namespace CarpetAdaptiveRegrid { // refinement with multiple maps. // const ibbox& baseext = - vdd.at(Carpet::map)->bases.at(mglevel).at(reflevel).exterior; + vdd.at(map)->bases.at(mglevel).at(reflevel).exterior; vector tmp_bbs; tmp_bbs.push_back (baseext); vector tmp_obs; tmp_obs.push_back (bbvect(true)); + vector tmp_rbs; + tmp_rbs.push_back (bbvect(false)); vector > tmp_bbss(1); vector > tmp_obss(1); + vector > tmp_rbss(1); tmp_bbss.at(0) = tmp_bbs; tmp_obss.at(0) = tmp_obs; + tmp_rbss.at(0) = tmp_rbs; MakeMultigridBoxes(cctkGH, tmp_bbss, tmp_obss, local_bbsss); local_obss = tmp_obss; + local_rbss = tmp_rbss; last_iteration = cctkGH->cctk_iteration; // // Having set up the base grid we then set any finer grids @@ -157,8 +157,8 @@ namespace CarpetAdaptiveRegrid { // standard CarpetRegrid. // int do_recompose = - ManualCoordinateList (cctkGH, hh, bbsss, obss, pss, - local_bbsss, local_obss); + ManualCoordinateList (cctkGH, hh, bbsss, obss, rbss, pss, + local_bbsss, local_obss, local_rbss); if (verbose) { ostringstream buf; @@ -320,7 +320,7 @@ namespace CarpetAdaptiveRegrid { // const ibbox& baseext = - vdd.at(Carpet::map)->bases.at(mglevel).at(reflevel).exterior; + vdd.at(map)->bases.at(mglevel).at(reflevel).exterior; ivect imin = (bb.lower() - baseext.lower())/bb.stride(), imax = (bb.upper() - baseext.lower())/bb.stride(); @@ -411,7 +411,7 @@ namespace CarpetAdaptiveRegrid { enter_singlemap_mode(const_cast (cctkGH), currentmap, CCTK_GF); const ibbox& child_baseext = - vdd.at(Carpet::map)->bases.at(mglevel).at(reflevel).exterior; + vdd.at(map)->bases.at(mglevel).at(reflevel).exterior; ivect child_levoff = child_baseext.lower()/(bb.stride()/reffact); if (verbose) { @@ -811,6 +811,7 @@ namespace CarpetAdaptiveRegrid { // Fixup the stride vector newbbs; vector obs; + vector rbs; while (! final.empty()) { ibbox bb = final.top(); final.pop(); @@ -840,6 +841,7 @@ namespace CarpetAdaptiveRegrid { // Set the correct ob here. bbvect ob(false); + bbvect rb(true); for (int d=0; d::rexts * bbsss, -// gh::rbnds * obss, -// gh::rprocs * pss); +// gh::rregs * regsss); CCTK_INT CarpetAdaptiveRegrid_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); } int ManualCoordinateList (cGH const * const cctkGH, gh const & hh, - gh::mexts & bbsss, - gh::rbnds & obss, - gh::rprocs & pss, - gh::mexts & local_bbsss, - gh::rbnds & local_obss); + gh::mregs & regsss, + gh::mregs & local_regsss); void ManualCoordinates_OneLevel (const cGH * const cctkGH, @@ -56,8 +49,10 @@ namespace CarpetAdaptiveRegrid { const rvect lower, const rvect upper, const bbvect obound, + const bbvect rbound, vector & bbs, - vector & obs); + vector & obs, + vector & rbs); void ManualGridpoints_OneLevel (const cGH * const cctkGH, const gh & hh, @@ -66,8 +61,10 @@ namespace CarpetAdaptiveRegrid { const ivect ilower, const ivect iupper, const bbvect obound, + const bbvect rbound, vector & bbs, - vector & obs); + vector & obs, + vector & rbs); rvect int2pos (const cGH* const cctkGH, const gh& hh, const ivect & ipos, const int rl); diff --git a/CarpetDev/CarpetAdaptiveRegrid/src/manualcoordinatelist.cc b/CarpetDev/CarpetAdaptiveRegrid/src/manualcoordinatelist.cc index 2ce38c7c8..5079907b0 100644 --- a/CarpetDev/CarpetAdaptiveRegrid/src/manualcoordinatelist.cc +++ b/CarpetDev/CarpetAdaptiveRegrid/src/manualcoordinatelist.cc @@ -25,9 +25,11 @@ namespace CarpetAdaptiveRegrid { gh const & hh, gh::mexts & bbsss, gh::rbnds & obss, + gh::rbnds & rbss, gh::rprocs & pss, gh::mexts & local_bbsss, - gh::rbnds & local_obss) + gh::rbnds & local_obss, + gh::rbnds & local_rbss) { DECLARE_CCTK_PARAMETERS; int ierr; @@ -60,6 +62,8 @@ namespace CarpetAdaptiveRegrid { local_bbss.resize (refinement_levels); obss.resize (refinement_levels); local_obss.resize (refinement_levels); + rbss.resize (refinement_levels); + local_rbss.resize (refinement_levels); pss.resize (refinement_levels); vector > newbbss; @@ -73,10 +77,13 @@ namespace CarpetAdaptiveRegrid { } vector > newobss; + vector > newrbss; newobss.resize(newbbss.size()); + newrbss.resize(newbbss.size()); for (size_t rl=0; rl bbs; gh::cbnds obs; + gh::cbnds rbs; bbs.reserve (newbbss.at(rl-1).size()); obs.reserve (newbbss.at(rl-1).size()); + rbs.reserve (newbbss.at(rl-1).size()); for (size_t c=0; c & bbs, - vector & obs) + vector & obs, + vector & rbs) { if (rl >= numrl) return; @@ -215,7 +231,7 @@ namespace CarpetAdaptiveRegrid { 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, obound, rbound, bbs, obs, rbs); } void ManualGridpoints_OneLevel (const cGH * const cctkGH, @@ -225,8 +241,10 @@ namespace CarpetAdaptiveRegrid { const ivect ilower, const ivect iupper, const bbvect obound, + const bbvect rbound, vector & bbs, - vector & obs) + vector & obs, + vector & rbs) { const ivect rstr = hh.baseextent.stride(); const ivect rlb = hh.baseextent.lower(); @@ -257,6 +275,7 @@ namespace CarpetAdaptiveRegrid { bbs.push_back (ibbox(lb, ub, str)); obs.push_back (obound); + rbs.push_back (rbound); } } // namespace CarpetRegrid -- cgit v1.2.3