aboutsummaryrefslogtreecommitdiff
path: root/src/CopyBoundary.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/CopyBoundary.c')
-rw-r--r--src/CopyBoundary.c164
1 files changed, 82 insertions, 82 deletions
diff --git a/src/CopyBoundary.c b/src/CopyBoundary.c
index e8a60b2..cc266de 100644
--- a/src/CopyBoundary.c
+++ b/src/CopyBoundary.c
@@ -31,7 +31,7 @@ CCTK_FILEVERSION(CactusBase_Boundary_CopyBoundary_c);
static int ApplyBndCopy (const cGH *GH,
int stencil_dir,
- const int *stencil_alldirs,
+ const CCTK_INT *stencil_alldirs,
int dir,
int first_var_to,
int first_var_from,
@@ -46,17 +46,17 @@ static int ApplyBndCopy (const cGH *GH,
@date 13 Feb 2003
@author David Rideout
@desc
- Top level function which is registered as handling
- the Copy boundary condition
+ Top level function which is registered as handling
+ the Copy boundary condition
@enddesc
@calls ApplyBndCopy
CCTK_GroupDimFromVarI
- Util_TableGetIntArray
- Util_TableQueryValueInfo
- CCTK_VWarn
- Util_TableGetString
- CCTK_VarIndex
- Util_TableGetInt
+ Util_TableGetIntArray
+ Util_TableQueryValueInfo
+ CCTK_VWarn
+ Util_TableGetString
+ CCTK_VarIndex
+ Util_TableGetInt
@var GH
@vdesc Pointer to CCTK grid hierarchy
@@ -65,51 +65,50 @@ static int ApplyBndCopy (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 ApplyBndCopy
- -11 invalid table handle
- -12 no "COPY FROM" key in table
+ -11 invalid table handle
+ -12 no "COPY FROM" key in table
-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 BndCopy(const cGH *GH, int num_vars, int *vars, int *faces, int *widths,
- int *tables)
+CCTK_INT BndCopy(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, value_type, value_size, retval;
+ int i, j, k, gi, gdim, max_gdim, err, retval;
+ CCTK_INT value_type, value_size;
char *copy_from_name;
/* variables to pass to ApplyBndCopy */
- int *width_alldirs; /* width of boundary on each face */
+ CCTK_INT *width_alldirs; /* width of boundary on each face */
int dir; /* direction in which to apply bc */
- int copy_from; /* variable (index) from which to copy the boundary
- data */
+ CCTK_INT copy_from; /* variable (index) from which to copy the boundary data */
retval = 0; width_alldirs = NULL; max_gdim = 0;
@@ -121,10 +120,10 @@ int BndCopy(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;
}
@@ -133,50 +132,49 @@ int BndCopy(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 Copy boundary conditions on "
- "%s is not implemented yet. "
- "Applying Copy bcs to all (external) faces.", faces[i],
- CCTK_VarName(vars[i]));
+ "Faces specification %d for Copy boundary conditions on "
+ "%s is not implemented yet. "
+ "Applying Copy bcs to all (external) faces.", faces[i],
+ CCTK_VarName(vars[i]));
}
dir = 0; /* apply bc to all faces */
/* Look on table for copy-from variable */
- err = Util_TableQueryValueInfo(tables[i], &value_type, &value_size,
- "COPY FROM");
+ err = Util_TableQueryValueInfo(tables[i], &value_type, &value_size,
+ "COPY FROM");
if (err == UTIL_ERROR_BAD_HANDLE)
{
CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Invalid table handle passed for Copy boundary "
- "conditions for %s. Name or index of variable to copy from "
- "must be provided via key \"COPY FROM\". Aborting.",
- CCTK_VarName(vars[i]));
+ "Invalid table handle passed for Copy boundary "
+ "conditions for %s. Name or index of variable to copy from "
+ "must be provided via key \"COPY FROM\". Aborting.",
+ CCTK_VarName(vars[i]));
return -11;
} else if (err==1)
{
if (value_type==CCTK_VARIABLE_STRING)
{
- copy_from_name = (char *) malloc(value_size*sizeof(char));
- Util_TableGetString(tables[i], value_size, copy_from_name,
- "COPY FROM");
- copy_from = CCTK_VarIndex(copy_from_name);
- free(copy_from_name);
+ copy_from_name = malloc(value_size*sizeof(char));
+ Util_TableGetString(tables[i], value_size, copy_from_name,
+ "COPY FROM");
+ copy_from = CCTK_VarIndex(copy_from_name);
+ free(copy_from_name);
} else if (value_type==CCTK_VARIABLE_INT)
{
- Util_TableGetInt(tables[i], &copy_from,
- "COPY FROM");
+ Util_TableGetInt(tables[i], &copy_from, "COPY FROM");
} else
{
- CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Invalid data type for key \"COPY FROM\" "
- "Please use CCTK_STRING for the variable name, "
- "or CCTK_INT for the variable index.");
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Invalid data type for key \"COPY FROM\" "
+ "Please use CCTK_STRING for the variable name, "
+ "or CCTK_INT for the variable index.");
}
} else
{
CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "No key \"COPY FROM\" provided in table. Please enter the "
- "name or index of variable to copy from into the table "
- "under this key. Aborting.");
+ "No key \"COPY FROM\" provided in table. Please enter the "
+ "name or index of variable to copy from into the table "
+ "under this key. Aborting.");
return -12;
}
@@ -185,43 +183,43 @@ int BndCopy(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 && (retval = ApplyBndCopy(GH, 0, width_alldirs, dir,
- vars[i], copy_from, j)) < 0)
+ if (!retval && (retval = ApplyBndCopy(GH, 0, width_alldirs, dir,
+ vars[i], copy_from, j)) < 0)
{
CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "ApplyBndCopy() returned %d", retval);
+ "ApplyBndCopy() returned %d", retval);
}
}
free(width_alldirs);
@@ -406,11 +404,11 @@ int BndCopyVI (const cGH *GH,
int vi_from)
{
int retval, num_vars, dim, i;
- int *boundary_widths; /* boundary widths as expected by ApplyBndCopy */
+ CCTK_INT *boundary_widths; /* boundary widths as expected by ApplyBndCopy */
/* Set up boundary_widths array */
dim = CCTK_GroupDimFromVarI (vi_to);
- boundary_widths = (int *) malloc(2*dim*sizeof(int));
+ boundary_widths = malloc(2*dim*sizeof(CCTK_INT));
for (i=0; i<2*dim; i+=2)
{
boundary_widths[i] = stencil[i/2];
@@ -569,11 +567,12 @@ int BndCopyGI (const cGH *GH,
int gi_from)
{
int first_vi_to, first_vi_from, retval;
- int i, dim, *boundary_widths;
+ int i, dim;
+ CCTK_INT *boundary_widths;
/* Set up boundary_widths array */
dim = CCTK_GroupDimI (gi_to);
- boundary_widths = (int *) malloc(2*dim*sizeof(int));
+ boundary_widths = malloc(2*dim*sizeof(CCTK_INT));
for (i=0; i<2*dim; i+=2)
{
boundary_widths[i] = stencil[i/2];
@@ -583,8 +582,8 @@ int BndCopyGI (const cGH *GH,
first_vi_from = CCTK_FirstVarIndexI (gi_from);
if (first_vi_to >= 0 && first_vi_from >= 0)
{
- retval = ApplyBndCopy (GH, -1, boundary_widths, 0, first_vi_to,
- first_vi_from, CCTK_NumVarsInGroupI (gi_to));
+ retval = ApplyBndCopy (GH, -1, boundary_widths, 0, first_vi_to,
+ first_vi_from, CCTK_NumVarsInGroupI (gi_to));
}
else
{
@@ -745,7 +744,7 @@ int BndCopyGN (const cGH *GH,
/* Set up boundary_widths array */
dim = CCTK_GroupDimI (gi_to);
- boundary_widths = (int *) malloc(2*dim*sizeof(int));
+ boundary_widths = malloc(2*dim*sizeof(int));
for (i=0; i<2*dim; i+=2)
{
boundary_widths[i] = stencil[i/2];
@@ -908,7 +907,8 @@ int BndCopyVN (const cGH *GH,
const char *vname_from)
{
int vi_to, vi_from, num_vars, retval;
- int i, dim, *boundary_widths;
+ int i, dim;
+ int *boundary_widths;
vi_to = CCTK_VarIndex (vname_to);
vi_from = CCTK_VarIndex (vname_from);
@@ -916,7 +916,7 @@ int BndCopyVN (const cGH *GH,
/* Set up boundary_widths array */
dim = CCTK_GroupDimFromVarI(vi_to);
- boundary_widths = (int *) malloc(2*dim*sizeof(int));
+ boundary_widths = malloc(2*dim*sizeof(int));
for (i=0; i<2*dim; i+=2)
{
boundary_widths[i] = stencil[i/2];
@@ -1039,7 +1039,7 @@ void CCTK_FCALL CCTK_FNAME (BndCopyVN)
@endvar
@var stencil_alldirs
@vdesc stencil widths for all directions
- @vtype int [ dimension of variable(s) ]
+ @vtype CCTK_INT [ dimension of variable(s) ]
@vio in
@endvar
@var dir
@@ -1085,7 +1085,7 @@ void CCTK_FCALL CCTK_FNAME (BndCopyVN)
@@*/
static int ApplyBndCopy (const cGH *GH,
int width_dir,
- const int *in_widths,
+ const CCTK_INT *in_widths,
int dir,
int first_var_to,
int first_var_from,
@@ -1136,7 +1136,7 @@ static int ApplyBndCopy (const cGH *GH,
else
{
CCTK_WARN (1, "ApplyBndCopy: NULL pointer passed for boundary width "
- "array");
+ "array");
return (-3);
}