aboutsummaryrefslogtreecommitdiff
path: root/CarpetDev
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2007-01-12 19:29:00 +0000
committerErik Schnetter <schnetter@cct.lsu.edu>2007-01-12 19:29:00 +0000
commitf65b896e853a5f2f0b43cb9e44cf373a71de0000 (patch)
tree3cdb7a5d3e880ab01e139dc7f69dd0f3e9f26f1c /CarpetDev
parent767df0e51be71df7c5437a88fa6741b6752c793d (diff)
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
Diffstat (limited to 'CarpetDev')
-rw-r--r--CarpetDev/CarpetAdaptiveRegrid/interface.ccl11
-rw-r--r--CarpetDev/CarpetAdaptiveRegrid/src/CAR.cc41
-rw-r--r--CarpetDev/CarpetAdaptiveRegrid/src/CAR.hh23
-rw-r--r--CarpetDev/CarpetAdaptiveRegrid/src/manualcoordinatelist.cc31
4 files changed, 64 insertions, 42 deletions
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<dim>::rexts * bbsss,
-# gh<dim>::rbnds * obss,
-# gh<dim>::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<dim>::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<ibbox> tmp_bbs;
tmp_bbs.push_back (baseext);
vector<bbvect> tmp_obs;
tmp_obs.push_back (bbvect(true));
+ vector<bbvect> tmp_rbs;
+ tmp_rbs.push_back (bbvect(false));
vector<vector<ibbox> > tmp_bbss(1);
vector<vector<bbvect> > tmp_obss(1);
+ vector<vector<bbvect> > 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<cGH *> (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<ibbox> newbbs;
vector<bbvect> obs;
+ vector<bbvect> 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<dim; ++d) {
assert (mglevel==0);
@@ -872,6 +874,8 @@ namespace CarpetAdaptiveRegrid {
abs(lo[d] - exterior_min[d]) < 1.0e-6 * spacing[d];
ob[d][1] =
abs(up[d] - exterior_max[d]) < 1.0e-6 * spacing[d];
+ rb[d][0] = ! ob[d][0];
+ rb[d][1] = ! ob[d][1];
if (veryverbose) {
ostringstream buf;
@@ -965,6 +969,7 @@ namespace CarpetAdaptiveRegrid {
newbbs.push_back (newbb);
obs.push_back(ob);
+ rbs.push_back(rb);
}
@@ -991,18 +996,22 @@ namespace CarpetAdaptiveRegrid {
bbss.resize(reflevel+2);
local_obss.resize(reflevel+2);
obss.resize(reflevel+2);
+ local_rbss.resize(reflevel+2);
+ rbss.resize(reflevel+2);
pss.resize(reflevel+2);
}
local_bbss.at(reflevel+1) = bbs;
local_obss.at(reflevel+1) = obs;
+ local_rbss.at(reflevel+1) = rbs;
MakeMultigridBoxes (cctkGH, local_bbss, local_obss, local_bbsss);
// make multiprocessor aware
gh::cprocs ps;
- SplitRegions (cctkGH, bbs, obs, ps);
+ SplitRegions (cctkGH, bbs, obs, rbs, ps);
bbss.at(reflevel+1) = bbs;
obss.at(reflevel+1) = obs;
+ rbss.at(reflevel+1) = rbs;
pss.at(reflevel+1) = ps;
} // did_regrid?
@@ -1017,6 +1026,8 @@ namespace CarpetAdaptiveRegrid {
bbss.resize(reflevel+1);
local_obss.resize(reflevel+1);
obss.resize(reflevel+1);
+ local_rbss.resize(reflevel+1);
+ rbss.resize(reflevel+1);
// Set local bbsss
MakeMultigridBoxes (cctkGH, local_bbss, local_obss, local_bbsss);
diff --git a/CarpetDev/CarpetAdaptiveRegrid/src/CAR.hh b/CarpetDev/CarpetAdaptiveRegrid/src/CAR.hh
index dd63b7f02..80946cd97 100644
--- a/CarpetDev/CarpetAdaptiveRegrid/src/CAR.hh
+++ b/CarpetDev/CarpetAdaptiveRegrid/src/CAR.hh
@@ -30,23 +30,16 @@ namespace CarpetAdaptiveRegrid {
/* Aliased functions */
// CCTK_INT CarpetAdaptiveRegrid_Regrid (const cGH * const cctkGH,
-// gh<dim>::rexts * bbsss,
-// gh<dim>::rbnds * obss,
-// gh<dim>::rprocs * pss);
+// gh<dim>::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<ibbox> & bbs,
- vector<bbvect> & obs);
+ vector<bbvect> & obs,
+ vector<bbvect> & 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<ibbox> & bbs,
- vector<bbvect> & obs);
+ vector<bbvect> & obs,
+ vector<bbvect> & 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<vector<rbbox> > newbbss;
@@ -73,10 +77,13 @@ namespace CarpetAdaptiveRegrid {
}
vector<vector<bbvect> > newobss;
+ vector<vector<bbvect> > newrbss;
newobss.resize(newbbss.size());
+ newrbss.resize(newbbss.size());
for (size_t rl=0; rl<newobss.size(); ++rl) {
newobss.at(rl).resize(newbbss.at(rl).size());
+ newrbss.at(rl).resize(newbbss.at(rl).size());
for (size_t c=0; c<newobss.at(rl).size(); ++c) {
for (int d=0; d<dim; ++d) {
assert (mglevel==0);
@@ -87,6 +94,7 @@ namespace CarpetAdaptiveRegrid {
&exterior_min[0], &exterior_max[0], &spacing[0]);
assert (!ierr);
newobss.at(rl).at(c)[d][0] = abs(newbbss.at(rl).at(c).lower()[d] - physical_min[d]) < 1.0e-6 * spacing[d];
+ newrbss.at(rl).at(c)[d][0] = ! newobss.at(rl).at(c)[d][0];
if (newobss.at(rl).at(c)[d][0]) {
rvect lo = newbbss.at(rl).at(c).lower();
rvect up = newbbss.at(rl).at(c).upper();
@@ -95,6 +103,7 @@ namespace CarpetAdaptiveRegrid {
newbbss.at(rl).at(c) = rbbox(lo, up, str);
}
newobss.at(rl).at(c)[d][1] = abs(newbbss.at(rl).at(c).upper()[d] - physical_max[d]) < 1.0e-6 * base_spacing[d] / spacereffacts.at(rl)[d];
+ newrbss.at(rl).at(c)[d][1] = ! newobss.at(rl).at(c)[d][1];
if (newobss.at(rl).at(c)[d][1]) {
rvect lo = newbbss.at(rl).at(c).lower();
rvect up = newbbss.at(rl).at(c).upper();
@@ -115,13 +124,16 @@ namespace CarpetAdaptiveRegrid {
vector<ibbox> 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<newbbss.at(rl-1).size(); ++c) {
rbbox const & ext = newbbss.at(rl-1).at(c);
bbvect const & ob = newobss.at(rl-1).at(c);
+ bbvect const & rb = newrbss.at(rl-1).at(c);
// TODO: why can basemglevel not be used here?
// rvect const spacing = base_spacing * ipow(CCTK_REAL(mgfact), basemglevel) / ipow(reffact, rl);
rvect const spacing = base_spacing / rvect (spacereffacts.at(rl));
@@ -139,11 +151,12 @@ namespace CarpetAdaptiveRegrid {
ManualCoordinates_OneLevel
(cctkGH, hh, rl, refinement_levels,
- ext.lower(), ext.upper(), ob, bbs, obs);
+ ext.lower(), ext.upper(), ob, rb, bbs, obs, rbs);
}
local_bbss.at(rl) = bbs;
local_obss.at(rl) = obs;
+ local_rbss.at(rl) = rbs;
if (verbose) {
ostringstream buf;
@@ -167,10 +180,11 @@ namespace CarpetAdaptiveRegrid {
// make multiprocessor aware
gh::cprocs ps;
- SplitRegions (cctkGH, bbs, obs, ps);
+ SplitRegions (cctkGH, bbs, obs, rbs, ps);
bbss.at(rl) = bbs;
obss.at(rl) = obs;
+ rbss.at(rl) = rbs;
pss.at(rl) = ps;
if (verbose) {
@@ -206,8 +220,10 @@ namespace CarpetAdaptiveRegrid {
const rvect lower,
const rvect upper,
const bbvect obound,
+ const bbvect rbound,
vector<ibbox> & bbs,
- vector<bbvect> & obs)
+ vector<bbvect> & obs,
+ vector<bbvect> & 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<ibbox> & bbs,
- vector<bbvect> & obs)
+ vector<bbvect> & obs,
+ vector<bbvect> & 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