aboutsummaryrefslogtreecommitdiff
path: root/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c
diff options
context:
space:
mode:
authorianhin <ianhin>2006-02-09 02:17:14 +0000
committerianhin <ianhin>2006-02-09 02:17:14 +0000
commitd12ce147c3d68fd0502ff054555dc6548ebfe51c (patch)
treec8fffd9664928e33a2b538e61abd9d164ef1aace /Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c
parenta696215bf8d12450837a076aff0066c9d4092ed4 (diff)
Added comment describing the indexing. Changed indexing to match
semantics of BoundaryExample. Simplified logical expressions.
Diffstat (limited to 'Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c')
-rw-r--r--Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c50
1 files changed, 16 insertions, 34 deletions
diff --git a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c
index 3c9dc6d..3e6d91d 100644
--- a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c
+++ b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c
@@ -54,8 +54,17 @@ CCTK_INT sgn(CCTK_REAL x)
return 0;
}
-/* Return the array indices in imin and imax of each boundary. The
- indexing is C-style. Also return whether the boundary is a symmetry */
+/* Return the array indices in imin and imax for looping over the
+ interior of the grid. imin is the index of the first grid point.
+ imax is the index of the last grid point plus 1. So a loop over
+ the interior of the grid would be
+
+ for (i = imin; i < imax; i++)
+
+ The indexing is C-style. Also return whether the boundary is a
+ symmetry, physical or interprocessor boundary. Carpet refinement
+ boundaries are treated as interprocessor boundaries.
+*/
void GenericFD_GetBoundaryInfo(cGH *cctkGH, CCTK_INT *cctk_lsh, CCTK_INT *cctk_bbox,
CCTK_INT *cctk_nghostzones, CCTK_INT *imin,
CCTK_INT *imax, CCTK_INT *is_symbnd,
@@ -90,36 +99,9 @@ void GenericFD_GetBoundaryInfo(cGH *cctkGH, CCTK_INT *cctk_lsh, CCTK_INT *cctk_b
for (dir = 0; dir < 6; dir++)
{
- is_symbnd[dir] = 0;
- is_physbnd[dir] = 0;
- is_ipbnd[dir] = 0;
-
- if (symbnd[dir] >= 0)
- {
- is_symbnd[dir] = 1;
- }
- else
- {
- is_symbnd[dir] = 0;
- }
-
- if (cctk_bbox[dir] == 0)
- {
- is_ipbnd[dir] = 1;
- }
- else
- {
- is_ipbnd[dir] = 0;
- }
-
- if (!is_ipbnd[dir] && !is_symbnd[dir])
- {
- is_physbnd[dir] = 1;
- }
- else
- {
- is_physbnd[dir] = 0;
- }
+ is_symbnd[dir] = (symbnd[dir] >= 0);
+ is_ipbnd[dir] = (cctk_bbox[dir] == 0);
+ is_physbnd[dir] = (!is_ipbnd[dir] && !is_symbnd[dir])
}
for (dir = 0; dir < 3; dir++)
@@ -151,10 +133,10 @@ void GenericFD_GetBoundaryInfo(cGH *cctkGH, CCTK_INT *cctk_lsh, CCTK_INT *cctk_b
switch(face)
{
case 0: /* Lower boundary */
- imin[dir] = npoints - 1;
+ imin[dir] = npoints;
break;
case 1: /* Upper boundary */
- imax[dir] = cctk_lsh[dir] - npoints;
+ imax[dir] = cctk_lsh[dir] - npoints;
break;
default:
CCTK_WARN(0, "internal error");