aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetRegrid/src
diff options
context:
space:
mode:
Diffstat (limited to 'Carpet/CarpetRegrid/src')
-rw-r--r--Carpet/CarpetRegrid/src/automatic.cc40
-rw-r--r--Carpet/CarpetRegrid/src/baselevel.cc12
-rw-r--r--Carpet/CarpetRegrid/src/centre.cc17
-rw-r--r--Carpet/CarpetRegrid/src/manualcoordinatelist.cc110
-rw-r--r--Carpet/CarpetRegrid/src/manualcoordinates.cc37
-rw-r--r--Carpet/CarpetRegrid/src/manualgridpointlist.cc17
-rw-r--r--Carpet/CarpetRegrid/src/manualgridpoints.cc33
-rw-r--r--Carpet/CarpetRegrid/src/moving.cc17
-rw-r--r--Carpet/CarpetRegrid/src/paramcheck.cc20
-rw-r--r--Carpet/CarpetRegrid/src/regrid.cc66
-rw-r--r--Carpet/CarpetRegrid/src/regrid.hh92
11 files changed, 167 insertions, 294 deletions
diff --git a/Carpet/CarpetRegrid/src/automatic.cc b/Carpet/CarpetRegrid/src/automatic.cc
index 6add8c770..2f5651b2e 100644
--- a/Carpet/CarpetRegrid/src/automatic.cc
+++ b/Carpet/CarpetRegrid/src/automatic.cc
@@ -16,7 +16,7 @@
#include "regrid.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/automatic.cc,v 1.1 2004/01/25 14:57:30 schnetter Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/automatic.cc,v 1.2 2004/04/18 13:29:43 schnetter Exp $";
CCTK_FILEVERSION(Carpet_CarpetRegrid_automatic_cc);
}
@@ -31,22 +31,12 @@ namespace CarpetRegrid {
int Automatic (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss)
{
DECLARE_CCTK_PARAMETERS;
- assert (reflevel>=0 && reflevel<maxreflevels);
- assert (map>=0 && map<maps);
-
assert (refinement_levels >= 1);
assert (bbsss.size() >= 1);
@@ -64,15 +54,17 @@ namespace CarpetRegrid {
assert (CCTK_VarTypeI(vi) == CCTK_VARIABLE_REAL);
assert (CCTK_GroupDimI(gi) == dim);
- assert (arrdata.at(gi).at(map).data.at(vi-v1));
+ assert (arrdata.at(gi).at(Carpet::map).data.at(vi-v1));
const gf<CCTK_REAL,dim>& errorvar
= (*dynamic_cast<const gf<CCTK_REAL,dim>*>
- (arrdata.at(gi).at(map).data.at(vi-v1)));
-
+ (arrdata.at(gi).at(Carpet::map).data.at(vi-v1)));
+
vector<ibbox> bbs;
gh<dim>::cbnds obs;
Automatic_OneLevel
- (cctkGH, hh, reflevel, minwidth, minfraction, maxerror, errorvar,
+ (cctkGH, hh,
+ reflevel, min(reflevels+1, maxreflevels),
+ minwidth, minfraction, maxerror, errorvar,
bbs, obs);
// make multiprocessor aware
@@ -81,10 +73,7 @@ namespace CarpetRegrid {
// make multigrid aware
vector<vector<ibbox> > bbss;
- MakeMultigridBoxes
- (cctkGH,
- size, nboundaryzones, is_internal, is_staggered, shiftout,
- bbs, obs, bbss);
+ MakeMultigridBoxes (cctkGH, bbs, obs, bbss);
@@ -115,7 +104,8 @@ namespace CarpetRegrid {
void Automatic_OneLevel (const cGH * const cctkGH,
const gh<dim> & hh,
- const int reflevel,
+ const int rl,
+ const int numrl,
const int minwidth,
const CCTK_REAL minfraction,
const CCTK_REAL maxerror,
@@ -123,20 +113,20 @@ namespace CarpetRegrid {
vector<ibbox> & bbs,
vector<bbvect> & obs)
{
- if (reflevel+1 >= maxreflevels) return;
+ if (rl+1 >= numrl) return;
// Arbitrary
const int tl = 0;
const int ml = 0;
-// cout << endl << "MRA: Choosing regions to refine in " << hh.components(reflevel) << " components" << endl;
+// cout << endl << "MRA: Choosing regions to refine in " << hh.components(rl) << " components" << endl;
list<ibbox> bbl;
- for (int c=0; c<hh.components(reflevel); ++c) {
- const ibbox region = hh.extents.at(reflevel).at(c).at(ml);
+ for (int c=0; c<hh.components(rl); ++c) {
+ const ibbox region = hh.extents.at(rl).at(c).at(ml);
assert (! region.empty());
- const data<CCTK_REAL,dim>& errdata = *errorvar(tl,reflevel,c,ml);
+ const data<CCTK_REAL,dim>& errdata = *errorvar(tl,rl,c,ml);
Automatic_Recursive (cctkGH, hh, minwidth, minfraction, maxerror,
errdata, bbl, region);
diff --git a/Carpet/CarpetRegrid/src/baselevel.cc b/Carpet/CarpetRegrid/src/baselevel.cc
index 18cc8a95c..c380c6844 100644
--- a/Carpet/CarpetRegrid/src/baselevel.cc
+++ b/Carpet/CarpetRegrid/src/baselevel.cc
@@ -9,7 +9,7 @@
#include "regrid.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/baselevel.cc,v 1.1 2004/01/25 14:57:30 schnetter Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/baselevel.cc,v 1.2 2004/04/18 13:29:43 schnetter Exp $";
CCTK_FILEVERSION(Carpet_CarpetRegrid_baselevel_cc);
}
@@ -24,22 +24,12 @@ namespace CarpetRegrid {
int BaseLevel (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss)
{
DECLARE_CCTK_PARAMETERS;
- assert (reflevel>=0 && reflevel<maxreflevels);
- assert (map>=0 && map<maps);
-
assert (refinement_levels == 1);
assert (bbsss.size() == 1);
diff --git a/Carpet/CarpetRegrid/src/centre.cc b/Carpet/CarpetRegrid/src/centre.cc
index 46a23f794..ef347b099 100644
--- a/Carpet/CarpetRegrid/src/centre.cc
+++ b/Carpet/CarpetRegrid/src/centre.cc
@@ -9,7 +9,7 @@
#include "regrid.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/centre.cc,v 1.1 2004/01/25 14:57:30 schnetter Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/centre.cc,v 1.2 2004/04/18 13:29:43 schnetter Exp $";
CCTK_FILEVERSION(Carpet_CarpetRegrid_centre_cc);
}
@@ -24,22 +24,12 @@ namespace CarpetRegrid {
int Centre (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss)
{
DECLARE_CCTK_PARAMETERS;
- assert (reflevel>=0 && reflevel<maxreflevels);
- assert (map>=0 && map<maps);
-
assert (refinement_levels >= 1);
// do nothing if the levels already exist
@@ -89,10 +79,7 @@ namespace CarpetRegrid {
// make multigrid aware
vector<vector<ibbox> > bbss;
- MakeMultigridBoxes
- (cctkGH,
- size, nboundaryzones, is_internal, is_staggered, shiftout,
- bbs, obs, bbss);
+ MakeMultigridBoxes (cctkGH, bbs, obs, bbss);
bbsss.at(rl) = bbss;
obss.at(rl) = obs;
diff --git a/Carpet/CarpetRegrid/src/manualcoordinatelist.cc b/Carpet/CarpetRegrid/src/manualcoordinatelist.cc
index 92ab6900a..6cc8d719c 100644
--- a/Carpet/CarpetRegrid/src/manualcoordinatelist.cc
+++ b/Carpet/CarpetRegrid/src/manualcoordinatelist.cc
@@ -12,7 +12,7 @@
#include "regrid.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/manualcoordinatelist.cc,v 1.1 2004/01/25 14:57:30 schnetter Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/manualcoordinatelist.cc,v 1.2 2004/04/18 13:29:43 schnetter Exp $";
CCTK_FILEVERSION(Carpet_CarpetRegrid_manualcoordinatelist_cc);
}
@@ -27,21 +27,12 @@ namespace CarpetRegrid {
int ManualCoordinateList (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss)
{
DECLARE_CCTK_PARAMETERS;
-
- assert (reflevel>=0 && reflevel<maxreflevels);
- assert (map>=0 && map<maps);
+ int ierr;
assert (refinement_levels >= 1);
@@ -50,6 +41,21 @@ namespace CarpetRegrid {
assert (bbsss.size() >= 1);
+ jjvect nboundaryzones, is_internal, is_staggered, shiftout;
+ ierr = GetBoundarySpecification
+ (2*dim, &nboundaryzones[0][0], &is_internal[0][0],
+ &is_staggered[0][0], &shiftout[0][0]);
+ assert (!ierr);
+ rvect physical_min, physical_max;
+ rvect interior_min, interior_max;
+ rvect exterior_min, exterior_max;
+ rvect base_spacing;
+ ierr = GetDomainSpecification
+ (dim, &physical_min[0], &physical_max[0],
+ &interior_min[0], &interior_max[0],
+ &exterior_min[0], &exterior_max[0], &base_spacing[0]);
+ assert (!ierr);
+
bbsss.resize (refinement_levels);
obss.resize (refinement_levels);
pss.resize (refinement_levels);
@@ -63,35 +69,68 @@ namespace CarpetRegrid {
CCTK_WARN (0, "Could not parse parameter \"coordinates\"");
}
}
-
+
vector<vector<bbvect> > newobss;
- if (strcmp(outerbounds, "") !=0 ) {
- istringstream ob_str (outerbounds);
- try {
- ob_str >> newobss;
- } catch (input_error) {
- CCTK_WARN (0, "Could not parse parameter \"outerbounds\"");
- }
- bool good = newobss.size() == newbbss.size();
- if (good) {
- for (size_t rl=0; rl<newobss.size(); ++rl) {
- good = good && newobss.at(rl).size() == newbbss.at(rl).size();
- }
- }
- if (! good) {
- cout << "coordinates: " << newbbss << endl;
- cout << "outerbounds: " << newobss << endl;
- CCTK_WARN (0, "The parameters \"outerbounds\" and \"coordinates\" must have the same structure");
- }
- } else {
+ if (smart_outer_boundaries) {
+#warning "TODO"
+ // assert (domain_from_coordbase);
+
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);
+ for (int d=0; d<dim; ++d) {
+ newobss.at(rl).at(c)[d][0] = abs(newbbss.at(rl).at(c).lower()[d] - physical_min[d]) < 1.0e-6 * base_spacing[d] / ipow(reffact, rl);
+ if (newobss.at(rl).at(c)[d][0]) {
+ rvect lo = newbbss.at(rl).at(c).lower();
+ rvect up = newbbss.at(rl).at(c).upper();
+ rvect str = newbbss.at(rl).at(c).stride();
+ lo[d] = exterior_min[d];
+ 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] / ipow(reffact, rl);
+ if (newobss.at(rl).at(c)[d][1]) {
+ rvect lo = newbbss.at(rl).at(c).lower();
+ rvect up = newbbss.at(rl).at(c).upper();
+ rvect str = newbbss.at(rl).at(c).stride();
+ up[d] = exterior_max[d];
+ newbbss.at(rl).at(c) = rbbox(lo, up, str);
+ }
+ }
}
}
- }
+
+ } else { // if ! smart_outer_boundaries
+
+ if (strcmp(outerbounds, "") !=0 ) {
+ istringstream ob_str (outerbounds);
+ try {
+ ob_str >> newobss;
+ } catch (input_error) {
+ CCTK_WARN (0, "Could not parse parameter \"outerbounds\"");
+ }
+ bool good = newobss.size() == newbbss.size();
+ if (good) {
+ for (size_t rl=0; rl<newobss.size(); ++rl) {
+ good = good && newobss.at(rl).size() == newbbss.at(rl).size();
+ }
+ }
+ if (! good) {
+ cout << "coordinates: " << newbbss << endl;
+ cout << "outerbounds: " << newobss << endl;
+ CCTK_WARN (0, "The parameters \"outerbounds\" and \"coordinates\" must have the same structure");
+ }
+ } else {
+ 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);
+ }
+ }
+ }
+
+ } // if ! smart_outer_boundaries
if (newbbss.size() < refinement_levels-1) {
CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,
@@ -120,10 +159,7 @@ namespace CarpetRegrid {
// make multigrid aware
vector<vector<ibbox> > bbss;
- MakeMultigridBoxes
- (cctkGH,
- size, nboundaryzones, is_internal, is_staggered, shiftout,
- bbs, obs, bbss);
+ MakeMultigridBoxes (cctkGH, bbs, obs, bbss);
bbsss.at(rl) = bbss;
obss.at(rl) = obs;
diff --git a/Carpet/CarpetRegrid/src/manualcoordinates.cc b/Carpet/CarpetRegrid/src/manualcoordinates.cc
index 54474d863..cf6ce3f94 100644
--- a/Carpet/CarpetRegrid/src/manualcoordinates.cc
+++ b/Carpet/CarpetRegrid/src/manualcoordinates.cc
@@ -11,7 +11,7 @@
#include "regrid.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/manualcoordinates.cc,v 1.2 2004/02/27 16:24:06 schnetter Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/manualcoordinates.cc,v 1.3 2004/04/18 13:29:43 schnetter Exp $";
CCTK_FILEVERSION(Carpet_CarpetRegrid_manualcoordinates_cc);
}
@@ -26,22 +26,12 @@ namespace CarpetRegrid {
int ManualCoordinates (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss)
{
DECLARE_CCTK_PARAMETERS;
- assert (reflevel>=0 && reflevel<maxreflevels);
- assert (map>=0 && map<maps);
-
if (refinement_levels > 4) {
CCTK_WARN (0, "Cannot currently specify manual refinement regions for more than 4 refinement levels");
}
@@ -81,10 +71,7 @@ namespace CarpetRegrid {
// make multigrid aware
vector<vector<ibbox> > bbss;
- MakeMultigridBoxes
- (cctkGH,
- size, nboundaryzones, is_internal, is_staggered, shiftout,
- bbs, obs, bbss);
+ MakeMultigridBoxes (cctkGH, bbs, obs, bbss);
bbsss.at(rl) = bbss;
obss.at(rl) = obs;
@@ -99,27 +86,27 @@ namespace CarpetRegrid {
void ManualCoordinates_OneLevel (const cGH * const cctkGH,
const gh<dim> & hh,
- const int reflevel,
- const int reflevels,
+ const int rl,
+ const int numrl,
const rvect lower,
const rvect upper,
const bbvect obound,
vector<ibbox> & bbs,
vector<bbvect> & obs)
{
- if (reflevel >= reflevels) return;
+ if (rl >= numrl) return;
- jvect const ilower = pos2int (cctkGH, hh, lower, reflevel);
- jvect const iupper = pos2int (cctkGH, hh, upper, reflevel);
+ jvect const ilower = pos2int (cctkGH, hh, lower, rl);
+ jvect const iupper = pos2int (cctkGH, hh, upper, rl);
ManualGridpoints_OneLevel
- (cctkGH, hh, reflevel, reflevels, ilower, iupper, obound, bbs, obs);
+ (cctkGH, hh, rl, numrl, ilower, iupper, obound, bbs, obs);
}
ivect delta2int (const cGH * const cctkGH, const gh<dim>& hh,
- const rvect & rpos, const int reflevel)
+ const rvect & rpos, const int rl)
{
rvect global_lower, global_upper;
for (int d=0; d<dim; ++d) {
@@ -133,7 +120,7 @@ namespace CarpetRegrid {
const ivect global_extent (hh.baseextent.upper() - hh.baseextent.lower());
const rvect scale = rvect(global_extent) / (global_upper - global_lower);
- const int levfac = ipow(hh.reffact, reflevel);
+ const int levfac = ipow(hh.reffact, rl);
assert (all (hh.baseextent.stride() % levfac == 0));
const ivect istride = hh.baseextent.stride() / levfac;
@@ -149,7 +136,7 @@ namespace CarpetRegrid {
ivect pos2int (const cGH* const cctkGH, const gh<dim>& hh,
- const rvect & rpos, const int reflevel)
+ const rvect & rpos, const int rl)
{
rvect global_lower, global_upper;
for (int d=0; d<dim; ++d) {
@@ -163,7 +150,7 @@ namespace CarpetRegrid {
const ivect global_extent (hh.baseextent.upper() - hh.baseextent.lower());
const rvect scale = rvect(global_extent) / (global_upper - global_lower);
- const int levfac = ipow(hh.reffact, reflevel);
+ const int levfac = ipow(hh.reffact, rl);
assert (all (hh.baseextent.stride() % levfac == 0));
const ivect istride = hh.baseextent.stride() / levfac;
diff --git a/Carpet/CarpetRegrid/src/manualgridpointlist.cc b/Carpet/CarpetRegrid/src/manualgridpointlist.cc
index 6976b982b..6d5c4cd78 100644
--- a/Carpet/CarpetRegrid/src/manualgridpointlist.cc
+++ b/Carpet/CarpetRegrid/src/manualgridpointlist.cc
@@ -12,7 +12,7 @@
#include "regrid.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/manualgridpointlist.cc,v 1.1 2004/01/25 14:57:30 schnetter Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/manualgridpointlist.cc,v 1.2 2004/04/18 13:29:43 schnetter Exp $";
CCTK_FILEVERSION(Carpet_CarpetRegrid_manualgridpointlist_cc);
}
@@ -27,22 +27,12 @@ namespace CarpetRegrid {
int ManualGridpointList (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss)
{
DECLARE_CCTK_PARAMETERS;
- assert (reflevel>=0 && reflevel<maxreflevels);
- assert (map>=0 && map<maps);
-
assert (refinement_levels >= 1);
// do nothing if the levels already exist
@@ -120,10 +110,7 @@ namespace CarpetRegrid {
// make multigrid aware
vector<vector<ibbox> > bbss;
- MakeMultigridBoxes
- (cctkGH,
- size, nboundaryzones, is_internal, is_staggered, shiftout,
- bbs, obs, bbss);
+ MakeMultigridBoxes (cctkGH, bbs, obs, bbss);
bbsss.at(rl) = bbss;
obss.at(rl) = obs;
diff --git a/Carpet/CarpetRegrid/src/manualgridpoints.cc b/Carpet/CarpetRegrid/src/manualgridpoints.cc
index e8cd6c17a..f8be5eb57 100644
--- a/Carpet/CarpetRegrid/src/manualgridpoints.cc
+++ b/Carpet/CarpetRegrid/src/manualgridpoints.cc
@@ -11,7 +11,7 @@
#include "regrid.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/manualgridpoints.cc,v 1.1 2004/01/25 14:57:30 schnetter Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/manualgridpoints.cc,v 1.2 2004/04/18 13:29:43 schnetter Exp $";
CCTK_FILEVERSION(Carpet_CarpetRegrid_manualgridpoints_cc);
}
@@ -26,22 +26,12 @@ namespace CarpetRegrid {
int ManualGridpoints (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss)
{
DECLARE_CCTK_PARAMETERS;
- assert (reflevel>=0 && reflevel<maxreflevels);
- assert (map>=0 && map<maps);
-
if (refinement_levels > 4) {
CCTK_WARN (0, "Cannot currently specify manual refinement regions for more than 4 refinement levels");
}
@@ -72,7 +62,7 @@ namespace CarpetRegrid {
gh<dim>::cbnds obs;
ManualGridpoints_OneLevel
- (cctkGH, hh, rl, refinement_levels,
+ (cctkGH, hh, rl,refinement_levels,
ilower.at(rl-1), iupper.at(rl-1), ob, bbs, obs);
// make multiprocessor aware
@@ -81,10 +71,7 @@ namespace CarpetRegrid {
// make multigrid aware
vector<vector<ibbox> > bbss;
- MakeMultigridBoxes
- (cctkGH,
- size, nboundaryzones, is_internal, is_staggered, shiftout,
- bbs, obs, bbss);
+ MakeMultigridBoxes (cctkGH, bbs, obs, bbss);
bbsss.at(rl) = bbss;
obss.at(rl) = obs;
@@ -99,38 +86,36 @@ namespace CarpetRegrid {
void ManualGridpoints_OneLevel (const cGH * const cctkGH,
const gh<dim> & hh,
- const int reflevel,
- const int reflevels,
+ const int rl,
+ const int numrl,
const ivect ilower,
const ivect iupper,
const bbvect obound,
vector<ibbox> & bbs,
vector<bbvect> & obs)
{
- if (reflevel >= reflevels) return;
-
const ivect rstr = hh.baseextent.stride();
const ivect rlb = hh.baseextent.lower();
const ivect rub = hh.baseextent.upper();
- const int levfac = ipow(hh.reffact, reflevel);
+ const int levfac = ipow(hh.reffact, rl);
assert (all (rstr % levfac == 0));
const ivect str (rstr / levfac);
const ivect lb (ilower);
const ivect ub (iupper);
if (! all(lb>=rlb && ub<=rub)) {
ostringstream buf;
- buf << "The refinement region boundaries for refinement level #" << reflevel << " are not within the main grid. Allowed are the grid point boundaries " << rlb << " - " << rub << "; specified were " << lb << " - " << ub << ends;
+ buf << "The refinement region boundaries for refinement level #" << rl << " are not within the main grid. Allowed are the grid point boundaries " << rlb << " - " << rub << "; specified were " << lb << " - " << ub << ends;
CCTK_WARN (0, buf.str().c_str());
}
if (! all(lb<=ub)) {
ostringstream buf;
- buf << "The refinement region boundaries for refinement level #" << reflevel << " have the upper boundary (" << ub << ") less than the lower boundary (" << lb << ")" << ends;
+ buf << "The refinement region boundaries for refinement level #" << rl << " have the upper boundary (" << ub << ") less than the lower boundary (" << lb << ")" << ends;
CCTK_WARN (0, buf.str().c_str());
}
if (! all(lb%str==0 && ub%str==0)) {
CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,
- "The refinement region boundaries for refinement level #%d are not a multiple of the stride for that level", reflevel);
+ "The refinement region boundaries for refinement level #%d are not a multiple of the stride for that level", rl);
}
assert (all(lb>=rlb && ub<=rub));
assert (all(lb<=ub));
diff --git a/Carpet/CarpetRegrid/src/moving.cc b/Carpet/CarpetRegrid/src/moving.cc
index 411286940..cfcb6496c 100644
--- a/Carpet/CarpetRegrid/src/moving.cc
+++ b/Carpet/CarpetRegrid/src/moving.cc
@@ -9,7 +9,7 @@
#include "regrid.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/moving.cc,v 1.2 2004/04/16 18:41:33 schnetter Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/moving.cc,v 1.3 2004/04/18 13:29:43 schnetter Exp $";
CCTK_FILEVERSION(Carpet_CarpetRegrid_moving_cc);
}
@@ -24,13 +24,6 @@ namespace CarpetRegrid {
int Moving (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss)
@@ -38,9 +31,6 @@ namespace CarpetRegrid {
DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;
- assert (reflevel>=0 && reflevel<maxreflevels);
- assert (map>=0 && map<maps);
-
assert (refinement_levels >= 1);
// do nothing if the levels already exist
@@ -95,10 +85,7 @@ namespace CarpetRegrid {
// make multigrid aware
vector<vector<ibbox> > bbss;
- MakeMultigridBoxes
- (cctkGH,
- size, nboundaryzones, is_internal, is_staggered, shiftout,
- bbs, obs, bbss);
+ MakeMultigridBoxes (cctkGH, bbs, obs, bbss);
bbsss.at(rl) = bbss;
obss.at(rl) = obs;
diff --git a/Carpet/CarpetRegrid/src/paramcheck.cc b/Carpet/CarpetRegrid/src/paramcheck.cc
index ad2c4819e..d0a463647 100644
--- a/Carpet/CarpetRegrid/src/paramcheck.cc
+++ b/Carpet/CarpetRegrid/src/paramcheck.cc
@@ -1,3 +1,5 @@
+#include <assert.h>
+
#include "cctk.h"
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
@@ -5,7 +7,7 @@
#include "carpet.hh"
#include "regrid.hh"
-static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/paramcheck.cc,v 1.1 2002/05/16 23:25:54 schnetter Exp $";
+static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/paramcheck.cc,v 1.2 2004/04/18 13:29:43 schnetter Exp $";
CCTK_FILEVERSION(CarpetRegrid_paramcheck_cc)
@@ -22,6 +24,22 @@ namespace CarpetRegrid {
if (refinement_levels > maxreflevels) {
CCTK_PARAMWARN ("The parameter CarpetRegrid::refinement_levels is larger than Carpet::max_refinement_levels");
}
+
+ if (smart_outer_boundaries) {
+ int type;
+ const CCTK_INT * const domain_from_coordbase
+ = (const CCTK_INT *) CCTK_ParameterGet ("domain_from_coordbase", "Carpet", &type);
+ assert (domain_from_coordbase);
+ assert (type == PARAMETER_BOOLEAN);
+ if (! *domain_from_coordbase) {
+ CCTK_PARAMWARN ("The parameter CarpetRegrid::smart_outer_boundaries can only be used when Carpet::domain_from_coordbase=yes");
+ }
+ if (CCTK_Equals(refined_regions, "manual-coordinate-list")) {
+ // do nothing
+ } else {
+ CCTK_PARAMWARN ("The parameter CarpetRegrid::smart_outer_boundaries can currently only be used when CarpetRegrid::refined_regions=manual-coordinate-list");
+ }
+ }
return 0;
}
diff --git a/Carpet/CarpetRegrid/src/regrid.cc b/Carpet/CarpetRegrid/src/regrid.cc
index 279044927..317c84381 100644
--- a/Carpet/CarpetRegrid/src/regrid.cc
+++ b/Carpet/CarpetRegrid/src/regrid.cc
@@ -13,7 +13,7 @@
#include "regrid.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/regrid.cc,v 1.38 2004/04/14 22:19:44 schnetter Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/regrid.cc,v 1.39 2004/04/18 13:29:43 schnetter Exp $";
CCTK_FILEVERSION(Carpet_CarpetRegrid_regrid_cc);
}
@@ -25,13 +25,6 @@ namespace CarpetRegrid {
using namespace Carpet;
CCTK_INT CarpetRegrid_Regrid (CCTK_POINTER_TO_CONST const cctkGH_,
- CCTK_INT const reflevel,
- CCTK_INT const map,
- CCTK_INT const size,
- CCTK_INT const * const nboundaryzones_,
- CCTK_INT const * const is_internal_,
- CCTK_INT const * const is_staggered_,
- CCTK_INT const * const shiftout_,
CCTK_POINTER const bbsss_,
CCTK_POINTER const obss_,
CCTK_POINTER const pss_)
@@ -40,22 +33,13 @@ namespace CarpetRegrid {
const cGH * const cctkGH = (const cGH *) cctkGH_;
- assert (reflevel>=0 && reflevel<maxreflevels);
- assert (map>=0 && map<maps);
-
- assert (size == 2*dim);
- jjvect const nboundaryzones (* (jjvect const *) nboundaryzones_);
- jjvect const is_internal (* (jjvect const *) is_internal_);
- jjvect const is_staggered (* (jjvect const *) is_staggered_);
- jjvect const shiftout (* (jjvect const *) shiftout_);
-
gh<dim>::rexts & bbsss = * (gh<dim>::rexts *) bbsss_;
gh<dim>::rbnds & obss = * (gh<dim>::rbnds *) obss_;
gh<dim>::rprocs & pss = * (gh<dim>::rprocs *) pss_;
- gh<dim> const & hh = *vhh.at(map);
+ gh<dim> const & hh = *vhh.at(Carpet::map);
- assert (is_meta_mode());
+ assert (is_singlemap_mode());
@@ -135,59 +119,39 @@ namespace CarpetRegrid {
if (CCTK_EQUALS(refined_regions, "none")) {
- do_recompose = BaseLevel
- (cctkGH, hh, reflevel, map,
- size, nboundaryzones, is_internal, is_staggered, shiftout,
- bbsss, obss, pss);
+ do_recompose = BaseLevel (cctkGH, hh, bbsss, obss, pss);
} else if (CCTK_EQUALS(refined_regions, "centre")) {
- do_recompose = Centre
- (cctkGH, hh, reflevel, map,
- size, nboundaryzones, is_internal, is_staggered, shiftout,
- bbsss, obss, pss);
+ do_recompose = Centre (cctkGH, hh, bbsss, obss, pss);
} else if (CCTK_EQUALS(refined_regions, "manual-gridpoints")) {
- do_recompose = ManualGridpoints
- (cctkGH, hh, reflevel, map,
- size, nboundaryzones, is_internal, is_staggered, shiftout,
- bbsss, obss, pss);
+ do_recompose
+ = ManualGridpoints (cctkGH, hh, bbsss, obss, pss);
} else if (CCTK_EQUALS(refined_regions, "manual-coordinates")) {
- do_recompose = ManualCoordinates
- (cctkGH, hh, reflevel, map,
- size, nboundaryzones, is_internal, is_staggered, shiftout,
- bbsss, obss, pss);
+ do_recompose
+ = ManualCoordinates (cctkGH, hh, bbsss, obss, pss);
} else if (CCTK_EQUALS(refined_regions, "manual-gridpoint-list")) {
- do_recompose = ManualGridpointList
- (cctkGH, hh, reflevel, map,
- size, nboundaryzones, is_internal, is_staggered, shiftout,
- bbsss, obss, pss);
+ do_recompose
+ = ManualGridpointList (cctkGH, hh, bbsss, obss, pss);
} else if (CCTK_EQUALS(refined_regions, "manual-coordinate-list")) {
- do_recompose = ManualCoordinateList
- (cctkGH, hh, reflevel, map,
- size, nboundaryzones, is_internal, is_staggered, shiftout,
- bbsss, obss, pss);
+ do_recompose
+ = ManualCoordinateList (cctkGH, hh, bbsss, obss, pss);
} else if (CCTK_EQUALS(refined_regions, "moving")) {
- do_recompose = Moving
- (cctkGH, hh, reflevel, map,
- size, nboundaryzones, is_internal, is_staggered, shiftout,
- bbsss, obss, pss);
+ do_recompose = Moving (cctkGH, hh, bbsss, obss, pss);
} else if (CCTK_EQUALS(refined_regions, "automatic")) {
- do_recompose = Automatic
- (cctkGH, hh, reflevel, map,
- size, nboundaryzones, is_internal, is_staggered, shiftout,
- bbsss, obss, pss);
+ do_recompose = Automatic (cctkGH, hh, bbsss, obss, pss);
} else {
assert (0);
diff --git a/Carpet/CarpetRegrid/src/regrid.hh b/Carpet/CarpetRegrid/src/regrid.hh
index 2de83f094..9228e23c3 100644
--- a/Carpet/CarpetRegrid/src/regrid.hh
+++ b/Carpet/CarpetRegrid/src/regrid.hh
@@ -1,4 +1,4 @@
-// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/regrid.hh,v 1.12 2004/04/14 22:19:44 schnetter Exp $
+// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetRegrid/src/regrid.hh,v 1.13 2004/04/18 13:29:43 schnetter Exp $
#ifndef CARPETREGRID_HH
#define CARPETREGRID_HH
@@ -35,13 +35,6 @@ namespace CarpetRegrid {
// gh<dim>::rbnds * obss,
// gh<dim>::rprocs * pss);
CCTK_INT CarpetRegrid_Regrid (CCTK_POINTER_TO_CONST const cctkGH_,
- CCTK_INT const reflevel,
- CCTK_INT const map,
- CCTK_INT const size,
- CCTK_INT const * const nboundaryzones,
- CCTK_INT const * const is_internal,
- CCTK_INT const * const is_staggered,
- CCTK_INT const * const shiftout,
CCTK_POINTER const bbsss_,
CCTK_POINTER const obss_,
CCTK_POINTER const pss_);
@@ -51,47 +44,26 @@ namespace CarpetRegrid {
int BaseLevel (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss);
int Centre (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss);
int ManualGridpoints (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss);
void ManualGridpoints_OneLevel (const cGH * const cctkGH,
const gh<dim> & hh,
- const int reflevel,
- const int reflevels,
+ const int rl,
+ const int numrl,
const ivect ilower,
const ivect iupper,
const bbvect obound,
@@ -100,87 +72,57 @@ namespace CarpetRegrid {
int ManualCoordinates (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss);
void ManualCoordinates_OneLevel (const cGH * const cctkGH,
const gh<dim> & hh,
- const int reflevel,
- const int reflevels,
- const rvect ilower,
- const rvect iupper,
+ const int rl,
+ const int numrl,
+ const rvect lower,
+ const rvect upper,
const bbvect obound,
vector<ibbox> & bbs,
vector<bbvect> & obs);
- ivect delta2int (const cGH * const cctkGH, const gh<dim>& hh,
- const rvect & rpos, const int reflevel);
- ivect pos2int (const cGH* const cctkGH, const gh<dim>& hh,
- const rvect & rpos, const int reflevel);
+ ivect delta2int (const cGH * const cctkGH,
+ const gh<dim>& hh,
+ const rvect & rpos,
+ const int rl);
+ ivect pos2int (const cGH* const cctkGH,
+ const gh<dim>& hh,
+ const rvect & rpos,
+ const int rl);
int ManualGridpointList (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss);
int ManualCoordinateList (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss);
int Moving (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss);
int Automatic (cGH const * const cctkGH,
gh<dim> const & hh,
- int const reflevel,
- int const map,
- int const size,
- jjvect const & nboundaryzones,
- jjvect const & is_internal,
- jjvect const & is_staggered,
- jjvect const & shiftout,
gh<dim>::rexts & bbsss,
gh<dim>::rbnds & obss,
gh<dim>::rprocs & pss);
void Automatic_OneLevel (const cGH * const cctkGH,
const gh<dim> & hh,
- const int reflevel,
+ const int rl,
+ const int numrl,
const int minwidth,
const CCTK_REAL minfraction,
const CCTK_REAL maxerror,