Skip to content

Commit

Permalink
GenericFD.c: Add GenericFD_GetBoundaryWidths
Browse files Browse the repository at this point in the history
Based on the existing GetBoundaryWidth but returning all the widths. GetBoundaryWidth now calls the new function.
  • Loading branch information
ianhinder committed May 27, 2011
1 parent 431c5d7 commit 4ced907
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c
Expand Up @@ -59,11 +59,10 @@ int sgn(CCTK_REAL x)
return 0;
}

int GenericFD_GetBoundaryWidth(cGH const * restrict const cctkGH)
void GenericFD_GetBoundaryWidths(cGH const * restrict const cctkGH, int nboundaryzones[6])
{
int is_internal[6];
int is_staggered[6];
int nboundaryzones[6];
int shiftout[6];
int ierr = -1;

Expand All @@ -72,8 +71,15 @@ int GenericFD_GetBoundaryWidth(cGH const * restrict const cctkGH)
/* This doesn't make sense in level mode */
if (map < 0)
{
// CCTK_WARN(1, "Could not determine current map");
return 0;
static int have_warned = 0;
if (!have_warned)
{
CCTK_WARN(1, "GenericFD_GetBoundaryWidths: Could not determine current map (can be caused by calling in LEVEL mode)");
have_warned = 1;
}
for (int i = 0; i < 6; i++)
nboundaryzones[i] = 0;
return;
}
ierr = MultiPatch_GetBoundarySpecification
(map, 6, nboundaryzones, is_internal, is_staggered, shiftout);
Expand All @@ -87,6 +93,12 @@ int GenericFD_GetBoundaryWidth(cGH const * restrict const cctkGH)
} else {
CCTK_WARN(0, "Could not obtain boundary specification");
}
}

int GenericFD_GetBoundaryWidth(cGH const * restrict const cctkGH)
{
int nboundaryzones[6];
GenericFD_GetBoundaryWidths(cctkGH, nboundaryzones);

int bw = nboundaryzones[0];

Expand Down

0 comments on commit 4ced907

Please sign in to comment.