diff options
Diffstat (limited to 'src/ScalarBoundary.c')
-rw-r--r-- | src/ScalarBoundary.c | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/src/ScalarBoundary.c b/src/ScalarBoundary.c index 0dba2af..59f1e8a 100644 --- a/src/ScalarBoundary.c +++ b/src/ScalarBoundary.c @@ -32,18 +32,18 @@ CCTK_FILEVERSION(CactusBase_Boundary_ScalarBoundary_c); static int ApplyBndScalar (const cGH *GH, int stencil_dir, - const int *stencil_alldirs, + const CCTK_INT *stencil_alldirs, int dir, CCTK_REAL scalar, int first_var, int num_vars); static int OldApplyBndScalar (const cGH *GH, - int stencil_dir, - const int *stencil_alldirs, - int dir, - CCTK_REAL scalar, - int first_var, - int num_vars); + int stencil_dir, + const int *stencil_alldirs, + int dir, + CCTK_REAL scalar, + int first_var, + int num_vars); /******************************************************************** ******************** External Routines ************************ @@ -54,8 +54,8 @@ static int OldApplyBndScalar (const cGH *GH, @date 13 Feb 2003 @author David Rideout @desc - Top level function which is registered as handling - the Scalar boundary condition + Top level function which is registered as handling + the Scalar boundary condition @enddesc @calls ApplyBndScalar @@ -70,7 +70,7 @@ static int OldApplyBndScalar (const cGH *GH, @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 * @vio in @@ -94,17 +94,16 @@ static int OldApplyBndScalar (const cGH *GH, @returndesc return code of @seeroutine ApplyBndScalar -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 BndScalar(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, - int *tables) +CCTK_INT BndScalar(const cGH *GH, CCTK_INT num_vars, CCTK_INT *vars, CCTK_INT *faces, + CCTK_INT *widths, CCTK_INT *tables) { int i, j, k, gi, gdim, max_gdim, err, retval; /* variables to pass to ApplyBndScalar */ - int *width_alldirs; /* width of stencil in all directions */ + CCTK_INT *width_alldirs; /* width of stencil in all directions */ int dir; /* direction in which to apply bc */ CCTK_REAL scalar; @@ -118,10 +117,10 @@ int BndScalar(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; } @@ -130,10 +129,10 @@ int BndScalar(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 Scalar boundary conditions on " - "%s is not implemented yet. " - "Applying Scalar bcs to all (external) faces.", faces[i], - CCTK_VarName(vars[i])); + "Faces specification %d for Scalar boundary conditions on " + "%s is not implemented yet. " + "Applying Scalar bcs to all (external) faces.", faces[i], + CCTK_VarName(vars[i])); } dir = 0; /* apply bc to all faces */ @@ -141,7 +140,7 @@ int BndScalar(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, scalar = 0.; /* Look on table for possible non-default arguments - * (If any of these table look-ups fail, the value will be unchanged + * (If any of these table look-ups fail, the value will be unchanged * from its default value) */ /* Scalar value */ @@ -149,9 +148,9 @@ int BndScalar(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, if (err == UTIL_ERROR_BAD_HANDLE) { CCTK_VWarn(5, __LINE__, __FILE__, CCTK_THORNSTRING, - "Invalid table handle passed for Scalar boundary " - "conditions for %s. Using all default values.", - CCTK_VarName(vars[i])); + "Invalid table handle passed for Scalar boundary " + "conditions for %s. Using all default values.", + CCTK_VarName(vars[i])); } /* Determine boundary width on all faces */ @@ -159,44 +158,44 @@ int BndScalar(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]; } } /* Apply the boundary condition */ if ((retval = ApplyBndScalar(GH, 0, width_alldirs, dir, scalar, vars[i], - j)) < 0) + j)) < 0) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "ApplyBndScalar() returned %d", retval); + "ApplyBndScalar() returned %d", retval); } } free(width_alldirs); @@ -1012,7 +1011,7 @@ void CCTK_FCALL CCTK_FNAME (BndScalarVN) @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 @@ -1054,7 +1053,7 @@ void CCTK_FCALL CCTK_FNAME (BndScalarVN) @@*/ static int ApplyBndScalar (const cGH *GH, int width_dir, - const int *in_widths, + const CCTK_INT *in_widths, int dir, CCTK_REAL scalar, int first_var, @@ -1063,7 +1062,7 @@ static int ApplyBndScalar (const cGH *GH, int i, j, k; int gindex, gdim; int var, timelvl; - 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; @@ -1274,19 +1273,20 @@ static int ApplyBndScalar (const cGH *GH, @@*/ static int OldApplyBndScalar(const cGH *GH, - int stencil_dir, - const int *stencil_alldirs, - int dir, - CCTK_REAL scalar, - int first_var, - int num_vars) + int stencil_dir, + const int *stencil_alldirs, + int dir, + CCTK_REAL scalar, + 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]; @@ -1297,14 +1297,14 @@ static int OldApplyBndScalar(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; } /* Call ApplyBnd... with new boundary width array */ - retval = ApplyBndScalar(GH, stencil_dir, boundary_widths, dir, scalar, - first_var, num_vars); + retval = ApplyBndScalar(GH, stencil_dir, boundary_widths, dir, scalar, + first_var, num_vars); free(boundary_widths); return retval; |