aboutsummaryrefslogtreecommitdiff
path: root/src/StaticBoundary.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/StaticBoundary.c')
-rw-r--r--src/StaticBoundary.c134
1 files changed, 67 insertions, 67 deletions
diff --git a/src/StaticBoundary.c b/src/StaticBoundary.c
index e4615b3..ecc72d5 100644
--- a/src/StaticBoundary.c
+++ b/src/StaticBoundary.c
@@ -25,17 +25,17 @@ static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusBase_Boundary_StaticBoundary_c);
static int ApplyBndStatic (const cGH *GH,
- int stencil_dir,
- const int *stencil_alldirs,
- int dir,
- int first_var,
- int num_vars);
+ int stencil_dir,
+ const CCTK_INT *stencil_alldirs,
+ int dir,
+ int first_var,
+ int num_vars);
static int OldApplyBndStatic (const cGH *GH,
- int stencil_dir,
- const int *stencil_alldirs,
- int dir,
- int first_var,
- int num_vars);
+ int stencil_dir,
+ const int *stencil_alldirs,
+ int dir,
+ int first_var,
+ int num_vars);
/********************************************************************
******************** External Routines ************************
@@ -45,8 +45,8 @@ static int OldApplyBndStatic (const cGH *GH,
@date 14 Feb 2003
@author David Rideout
@desc
- Top level function which is registered as handling
- this boundary condition
+ Top level function which is registered as handling
+ this boundary condition
@enddesc
@calls ApplyBndStatic
@var GH
@@ -56,45 +56,44 @@ static int OldApplyBndStatic (const cGH *GH,
@endvar
@var num_vars
@vdesc number of variables passed in through var_indices[]
- @vtype int
+ @vtype CCTK_INT
@vio in
@endvar
@var var_indices
- @vdesc array of variable indicies to which to apply this boundary
+ @vdesc array of variable indicies to which to apply this boundary
condition
- @vtype int *
+ @vtype CCTK_INT *
@vio in
@endvar
@var faces
@vdesc array of set of faces to which to apply the bc
- @vtype int
+ @vtype CCTK_INT
@vio in
@endvar
@var widths
@vdesc array of boundary widths for each variable
- @vtype int
+ @vtype CCTK_INT
@vio in
@endvar
@var table_handles
@vdesc array of table handles which hold extra arguments
- @vtype int
+ @vtype CCTK_INT
@vio in
@endvar
- @returntype int
+ @returntype CCTK_INT
@returndesc
return code of @seeroutine ApplyBndStatic
-21 error reading boundary width array from table
- -22 wrong size boundary width array in table
+ -22 wrong size boundary width array in table
@endreturndesc
@@*/
-
-int BndStatic(const cGH *GH, int num_vars, int *vars, int *faces, int *widths,
- int *tables)
+CCTK_INT BndStatic(const cGH *GH, CCTK_INT num_vars, CCTK_INT *vars,
+ CCTK_INT *faces, CCTK_INT *widths, CCTK_INT *tables)
{
int i, j, k, gi, err, gdim, max_gdim, retval;
/* variables to pass to ApplyBndStatic */
- int *width_alldirs; /* width of boundary in all directions */
+ CCTK_INT *width_alldirs; /* width of boundary in all directions */
int dir; /* direction in which to apply bc */
#ifdef DEBUG
@@ -111,10 +110,10 @@ int BndStatic(const cGH *GH, int num_vars, int *vars, int *faces, int *widths,
can do is find variables of the same group which are selected
for identical bcs. If all GFs had the same staggering then we
could groups many GFs together. */
- gi = CCTK_GroupIndexFromVarI (vars[i]);
- while (i+j<num_vars && vars[i+j]==vars[i]+j &&
- CCTK_GroupIndexFromVarI(vars[i+j])==gi && tables[i+j]==tables[i]
- && faces[i+j]==faces[i] && widths[i+j]==widths[i])
+ gi = CCTK_GroupIndexFromVarI (vars[i]);
+ while (i+j<num_vars && vars[i+j]==vars[i]+j &&
+ CCTK_GroupIndexFromVarI(vars[i+j])==gi && tables[i+j]==tables[i]
+ && faces[i+j]==faces[i] && widths[i+j]==widths[i])
{
++j;
}
@@ -123,10 +122,10 @@ int BndStatic(const cGH *GH, int num_vars, int *vars, int *faces, int *widths,
if (faces[i] != CCTK_ALL_FACES)
{
CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Faces specification %d for Static boundary conditions on "
- "%s is not implemented yet. "
- "Applying Static bcs to all (external) faces.", faces[i],
- CCTK_VarName(vars[i]));
+ "Faces specification %d for Static boundary conditions on "
+ "%s is not implemented yet. "
+ "Applying Static bcs to all (external) faces.", faces[i],
+ CCTK_VarName(vars[i]));
}
dir = 0;
@@ -135,35 +134,35 @@ int BndStatic(const cGH *GH, int num_vars, int *vars, int *faces, int *widths,
gdim = CCTK_GroupDimI(gi);
if (gdim > max_gdim)
{
- width_alldirs = realloc(width_alldirs, 2*gdim*sizeof(int));
+ width_alldirs = realloc(width_alldirs, 2*gdim*sizeof(CCTK_INT));
max_gdim = gdim;
}
- /* fill it with values, either from table or the boundary_width
+ /* fill it with values, either from table or the boundary_width
parameter */
if (widths[i]<0)
{
- err = Util_TableGetIntArray(tables[i], gdim, width_alldirs,
- "BOUNDARY WIDTH");
+ err = Util_TableGetIntArray(tables[i], gdim, width_alldirs,
+ "BOUNDARY WIDTH");
if (err<0)
{
- CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Error %d when reading boundary width array from table "
- "for %s",
- err, CCTK_VarName(vars[i]));
- return -21;
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Error %d when reading boundary width array from table "
+ "for %s",
+ err, CCTK_VarName(vars[i]));
+ return -21;
} else if (err!=2*gdim)
{
- CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Boundary width array for %s has %d elements, but %d "
- "expected", CCTK_VarName(vars[i]), err, 2*gdim);
- return -22;
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Boundary width array for %s has %d elements, but %d "
+ "expected", CCTK_VarName(vars[i]), err, 2*gdim);
+ return -22;
}
} else
{
for (k=0; k<2*gdim; ++k)
{
- width_alldirs[k] = widths[i];
+ width_alldirs[k] = widths[i];
}
}
@@ -171,7 +170,7 @@ int BndStatic(const cGH *GH, int num_vars, int *vars, int *faces, int *widths,
if ((retval = ApplyBndStatic(GH, 0, width_alldirs, dir, vars[i], j)) < 0)
{
CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "ApplyBndStatic() returned %d", retval);
+ "ApplyBndStatic() returned %d", retval);
}
}
#ifdef DEBUG
@@ -885,7 +884,7 @@ void CCTK_FCALL CCTK_FNAME (BndStaticVN)
@endvar
@var in_widths
@vdesc boundary widths for all directions
- @vtype int [ dimension of variable(s) ]
+ @vtype CCTK_INT [ dimension of variable(s) ]
@vio in
@endvar
@var dir
@@ -927,7 +926,7 @@ void CCTK_FCALL CCTK_FNAME (BndStaticVN)
@@*/
static int ApplyBndStatic (const cGH *GH,
int width_dir,
- const int *in_widths,
+ const CCTK_INT *in_widths,
int dir,
int first_var,
int num_vars)
@@ -936,7 +935,7 @@ static int ApplyBndStatic (const cGH *GH,
int timelvl_to, timelvl_from;
int gindex, gdim;
int var, vtypesize;
- int doBC[2*MAXDIM], dstag[MAXDIM], lsh[MAXDIM], lssh[MAXDIM],
+ int doBC[2*MAXDIM], dstag[MAXDIM], lsh[MAXDIM], lssh[MAXDIM],
widths[2*MAXDIM];
SymmetryGHex *sGHex;
@@ -983,7 +982,7 @@ static int ApplyBndStatic (const cGH *GH,
else
{
CCTK_WARN (1, "ApplyBndStatic: NULL pointer passed for boundary width "
- "array");
+ "array");
return (-3);
}
@@ -1003,7 +1002,7 @@ static int ApplyBndStatic (const cGH *GH,
timelvl_from = 1;
/* see if we have a symmetry array */
- sGHex = (SymmetryGHex *) CCTK_GHExtension (GH, "Symmetry");
+ sGHex = CCTK_GHExtension (GH, "Symmetry");
/* now loop over all variables */
for (var = first_var;
@@ -1043,24 +1042,24 @@ static int ApplyBndStatic (const cGH *GH,
/* lower x */
STATIC_BOUNDARY (doBC[0], widths[0], lssh[1], lssh[2], i, j, k);
/* upper x */
- STATIC_BOUNDARY (doBC[1], widths[1], lssh[1], lssh[2], lssh[0]-i-1, j,
- k);
+ STATIC_BOUNDARY (doBC[1], widths[1], lssh[1], lssh[2], lssh[0]-i-1, j,
+ k);
}
if (gdim > 1)
{
/* lower y */
STATIC_BOUNDARY (doBC[2], lssh[0], widths[2], lssh[2], i, j, k);
/* upper y */
- STATIC_BOUNDARY (doBC[3], lssh[0], widths[3], lssh[2], i, lssh[1]-j-1,
- k);
+ STATIC_BOUNDARY (doBC[3], lssh[0], widths[3], lssh[2], i, lssh[1]-j-1,
+ k);
}
if (gdim > 2)
{
/* lower z */
STATIC_BOUNDARY (doBC[4], lssh[0], lssh[1], widths[4], i, j, k);
/* upper z */
- STATIC_BOUNDARY (doBC[5], lssh[0], lssh[1], widths[5], i, j,
- lssh[2]-k-1);
+ STATIC_BOUNDARY (doBC[5], lssh[0], lssh[1], widths[5], i, j,
+ lssh[2]-k-1);
}
}
@@ -1119,18 +1118,19 @@ static int ApplyBndStatic (const cGH *GH,
@@*/
static int OldApplyBndStatic (const cGH *GH,
- int stencil_dir,
- const int *stencil_alldirs,
- int dir,
- int first_var,
- int num_vars)
+ int stencil_dir,
+ const int *stencil_alldirs,
+ int dir,
+ int first_var,
+ int num_vars)
{
- int retval, *boundary_widths, dim, i;
+ int retval, dim, i;
+ CCTK_INT *boundary_widths;
static int warned;
/* Convert stencil_alldirs to new format */
dim = CCTK_GroupDimFromVarI (first_var);
- boundary_widths = (int *) malloc(2*dim*sizeof(int));
+ boundary_widths = malloc(2*dim*sizeof(CCTK_INT));
for (i=0; i<2*dim; ++i)
{
boundary_widths[i] = stencil_alldirs[i/2];
@@ -1141,8 +1141,8 @@ static int OldApplyBndStatic (const cGH *GH,
{
CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
"Copied older d-element array of boundary widths into the "
- "newer 2d-element format. Please use the new boundary "
- "interface to avoid this.");
+ "newer 2d-element format. Please use the new boundary "
+ "interface to avoid this.");
warned = 1;
}