aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2007-06-14 00:49:00 +0000
committerErik Schnetter <schnetter@cct.lsu.edu>2007-06-14 00:49:00 +0000
commit0dad8e22a7201792c13c5b3283d6f9fc773dc619 (patch)
tree9b4c1c28b71cab3db28c291bff944e756ddd0fa7
parentc27130bf9b0bf868e571b409735f4d7eefa4e6b5 (diff)
Carpet: Add aliased function GetCoordRange
GetCoordRange returns the lower and upper coordinates, the grid spacing, and the number of grid points for a given refinement level on a given patch. darcs-hash:20070614004919-dae7b-29bbe29bfb33715fefe7ac192f0d920de8159b49.gz
-rw-r--r--Carpet/Carpet/interface.ccl14
-rw-r--r--Carpet/Carpet/src/functions.hh9
-rw-r--r--Carpet/Carpet/src/helpers.cc37
3 files changed, 60 insertions, 0 deletions
diff --git a/Carpet/Carpet/interface.ccl b/Carpet/Carpet/interface.ccl
index 6a8decbc8..55192195a 100644
--- a/Carpet/Carpet/interface.ccl
+++ b/Carpet/Carpet/interface.ccl
@@ -138,6 +138,20 @@ USES FUNCTION MultiPatch_GetDomainSpecification
+# Access coordinate information (on the coarse level)
+CCTK_INT FUNCTION GetCoordRange \
+ (CCTK_POINTER_TO_CONST IN cctkGH, \
+ CCTK_INT IN m, \
+ CCTK_INT IN ml, \
+ CCTK_INT IN size, \
+ CCTK_INT ARRAY OUT gsh, \
+ CCTK_REAL ARRAY OUT lower, \
+ CCTK_REAL ARRAY OUT upper, \
+ CCTK_REAL ARRAY OUT delta)
+PROVIDES FUNCTION GetCoordRange WITH Carpet_GetCoordRange LANGUAGE C
+
+
+
# The true prototype of the routine below:
# int Carpet_Regrid (const cGH * cctkGH,
# gh::mregs * regsss,
diff --git a/Carpet/Carpet/src/functions.hh b/Carpet/Carpet/src/functions.hh
index 0f43ff281..662e35e24 100644
--- a/Carpet/Carpet/src/functions.hh
+++ b/Carpet/Carpet/src/functions.hh
@@ -78,6 +78,15 @@ namespace Carpet {
Carpet_GetMPICommUniverse (CCTK_POINTER_TO_CONST cctkGH);
CCTK_POINTER_TO_CONST
Carpet_GetMPICommWorld (CCTK_POINTER_TO_CONST cctkGH);
+ CCTK_INT
+ Carpet_GetCoordRange (CCTK_POINTER_TO_CONST const cctkGH_,
+ CCTK_INT const m,
+ CCTK_INT const ml,
+ CCTK_INT const size,
+ CCTK_INT * const gsh,
+ CCTK_REAL * const lower,
+ CCTK_REAL * const upper,
+ CCTK_REAL * const delta);
}
diff --git a/Carpet/Carpet/src/helpers.cc b/Carpet/Carpet/src/helpers.cc
index ddccec64c..f6cc08d42 100644
--- a/Carpet/Carpet/src/helpers.cc
+++ b/Carpet/Carpet/src/helpers.cc
@@ -70,6 +70,43 @@ namespace Carpet {
+ CCTK_INT
+ Carpet_GetCoordRange (CCTK_POINTER_TO_CONST const cctkGH_,
+ CCTK_INT const m,
+ CCTK_INT const ml,
+ CCTK_INT const size,
+ CCTK_INT * const gsh,
+ CCTK_REAL * const lower,
+ CCTK_REAL * const upper,
+ CCTK_REAL * const delta)
+ {
+ cGH const * const cctkGH = static_cast <cGH const *> (cctkGH_);
+ assert (cctkGH);
+ assert (m >= 0 and m < maps);
+ assert (ml >= 0 and ml < mglevels);
+ assert (size >= 0);
+ assert (not size or gsh);
+ assert (not size or lower);
+ assert (not size or upper);
+ assert (not size or delta);
+
+ assert (size == dim);
+
+ ibbox const & baseext = vhh.at(m)->baseextents.at(ml).at(0);
+ ivect const igsh = baseext.shape() / baseext.stride();
+
+ for (int d = 0; d < dim; ++ d) {
+ gsh[d] = igsh[d];
+ lower[d] = origin_space.at(m).at(ml)[d];
+ delta[d] = delta_space.at(m)[d] * mglevelfact;
+ upper[d] = lower[d] + delta[d] * (gsh[d] - 1);
+ }
+
+ return 0;
+ }
+
+
+
// Communication
int Barrier (const cGH* cgh)