summaryrefslogtreecommitdiff
path: root/src/comm
diff options
context:
space:
mode:
authortradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2003-03-10 11:01:09 +0000
committertradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2003-03-10 11:01:09 +0000
commitcdded1ac0545171b89da9e741ba6131f947d0217 (patch)
treee515e2d59d20d8947276bc50c418b665ac7e265c /src/comm
parent7bad369931eeb20a3da267d9f7a8024ff433d1b4 (diff)
Added const qualifiers to all the pointer function arguments in the flesh's
reduction API which refer to input-only arrays and structures. This fixes former problems with passing a 'const cGH *' pointer to this API. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3164 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/comm')
-rw-r--r--src/comm/Reduction.c553
1 files changed, 261 insertions, 292 deletions
diff --git a/src/comm/Reduction.c b/src/comm/Reduction.c
index 0c04262c..bef214b5 100644
--- a/src/comm/Reduction.c
+++ b/src/comm/Reduction.c
@@ -3,9 +3,9 @@
@date 1999/05/13
@author Gabrielle Allen
@desc
- This file contains routines to deal with registering and
+ This file contains routines to deal with registering and
using functions providing reduction operations.
- @enddesc
+ @enddesc
@version $Id$
@@*/
@@ -43,82 +43,82 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReductionArrayHandle)
void CCTK_FCALL CCTK_FNAME(CCTK_Reduce)
(int *fortranreturn,
- cGH *GH,
- int *proc,
- int *operation_handle,
- int *num_out_vals,
- int *type_out_vals,
+ const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const int *num_out_vals,
+ const int *type_out_vals,
void *out_vals,
- int *num_in_fields,
+ const int *num_in_fields,
... );
void CCTK_FCALL CCTK_FNAME(CCTK_ReduceArray)
(int *fortran_return,
- cGH *GH,
- int *proc,
- int *operation_handle,
- int *num_out_vals,
- int *type_out_vals,
+ const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const int *num_out_vals,
+ const int *type_out_vals,
void *out_vals,
- int *num_dims,
- int *num_in_arrays,
- int *type_in_arrays,
+ const int *num_dims,
+ const int *num_in_arrays,
+ const int *type_in_arrays,
... );
/* FIXME: OLD INTERFACE */
void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalScalar)
(int *fortran_return,
- cGH *GH,
- int *proc,
- int *operation_handle,
- void *in_scalar,
+ const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const void *in_scalar,
void *out_scalar,
- int *data_type);
+ const int *data_type);
void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocScalar)
(int *fortran_return,
- cGH *GH,
- int *proc,
- int *operation_handle,
- void *in_scalar,
+ const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const void *in_scalar,
void *out_scalar,
- int *data_type);
+ const int *data_type);
void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalArray1D)
(int *fortran_return,
- cGH *GH,
- int *proc,
- int *operation_handle,
- void *in_array1d,
+ const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const void *in_array1d,
void *out_array1d,
- int *num_in_array1d,
- int *data_type);
+ const int *num_in_array1d,
+ const int *data_type);
void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray1D)
(int *fortran_return,
- cGH *GH,
- int *proc,
- int *operation_handle,
- void *in_array1d,
+ const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const void *in_array1d,
void *out_array1d,
- int *num_in_array1d,
- int *data_type);
+ const int *num_in_array1d,
+ const int *data_type);
void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray2D)
- (int *fortran_return, cGH *GH,
- int *proc,
- int *operation_handle,
- void *in_array2d,
+ (int *fortran_return, const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const void *in_array2d,
void *out_array2d,
- int *xsize, int *ysize,
- int *data_type);
+ const int *xsize, const int *ysize,
+ const int *data_type);
void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray3D)
- (int *fortran_return, cGH *GH,
- int *proc,
- int *operation_handle,
- void *in_array3d,
+ (int *fortran_return, const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const void *in_array3d,
void *out_array3d,
- int *xsize, int *ysize, int *zsize,
- int *data_type);
+ const int *xsize, const int *ysize, const int *zsize,
+ const int *data_type);
/********************************************************************
******************** Internal Typedefs ************************
********************************************************************/
@@ -145,27 +145,25 @@ static int num_reductions_array = 0;
@routine CCTKi_RegisterReductionOperator
@date April 28 1999
@author Gabrielle Allen
- @desc
+ @desc
Registers "function" as a reduction operator called "name"
- @enddesc
+ @enddesc
@var function
@vdesc Routine containing reduction operator
@vtype (void (*))
- @vio
- @vcomment
- @endvar
+ @vio
+ @endvar
@var name
@vdesc String containing name of reduction operator
@vtype const char *
@vio in
- @vcomment
- @endvar
+ @endvar
@@*/
-
+
int CCTKi_RegisterReductionOperator(const char *thorn,
- cReduceOperator operator,
- const char *name)
+ cReduceOperator operator,
+ const char *name)
{
int handle;
t_reduce_operator *reduce_operator;
@@ -173,23 +171,22 @@ int CCTKi_RegisterReductionOperator(const char *thorn,
/* Check arguments */
/* Check that the method hasn't already been registered */
- handle = Util_GetHandle(ReductionOperators, name,
- (void **) &reduce_operator);
+ handle = Util_GetHandle(ReductionOperators, name,
+ (void **) &reduce_operator);
if(handle < 0)
{
- reduce_operator = (t_reduce_operator *)
- malloc (sizeof (t_reduce_operator));
-
+ reduce_operator = malloc (sizeof (t_reduce_operator));
+
if (reduce_operator)
{
- reduce_operator->implementation =
- CCTK_ThornImplementation(thorn);
+ reduce_operator->implementation =
+ CCTK_ThornImplementation(thorn);
reduce_operator->name = name;
reduce_operator->reduce_operator = operator;
handle = Util_NewHandle(&ReductionOperators, name, reduce_operator);
-
+
/* Remember how many reduction operators there are */
num_reductions++;
}
@@ -199,7 +196,7 @@ int CCTKi_RegisterReductionOperator(const char *thorn,
/* Reduction operator with this name already exists. */
CCTK_Warn(1,__LINE__,__FILE__,"Cactus",
"CCTK_RegisterReductionOperator: Reduction operator "
- "with this name already exists");
+ "with this name already exists");
handle = -1;
}
@@ -210,7 +207,7 @@ int CCTKi_RegisterReductionOperator(const char *thorn,
printf(" Registering %s with handle %d\n",name,handle);
CCTK_PRINTSEPARATOR
#endif
-
+
return handle;
}
@@ -220,15 +217,14 @@ int CCTKi_RegisterReductionOperator(const char *thorn,
@routine CCTK_ReductionHandle
@date April 28 1999
@author Gabrielle Allen
- @desc
+ @desc
Returns the handle of a given reduction operator
- @enddesc
+ @enddesc
@var reduction
@vdesc String containing name of reduction operator
@vtype const char *
@vio in
- @vcomment
- @endvar
+ @endvar
@@*/
int CCTK_ReductionHandle(const char *reduction)
@@ -254,7 +250,7 @@ int CCTK_ReductionHandle(const char *reduction)
return handle;
-}
+}
void CCTK_FCALL CCTK_FNAME(CCTK_ReductionHandle)(int *handle, ONE_FORTSTRING_ARG)
{
@@ -268,54 +264,54 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReductionHandle)(int *handle, ONE_FORTSTRING_ARG
@routine CCTK_Reduce
@date April 28 1999
@author Gabrielle Allen
- @desc
+ @desc
Generic routine for doing a reduction operation on a set of
Cactus variables.
- @enddesc
+ @enddesc
@var GH
@vdesc pointer to the grid hierarchy
@vtype cGH *
@vio in
- @endvar
+ @endvar
@var proc
@vdesc processor that receives the result of the reduction operation
(a negative value means that all processors get the result)
@vtype int
@vio in
- @endvar
+ @endvar
@var operation_handle
@vdesc the handle specifying the reduction operator
@vtype int
@vio in
- @endvar
+ @endvar
@var num_out_vals
@vdesc number of elements in the reduction output
@vtype int
@vio in
- @endvar
+ @endvar
@var type_out_vals
@vdesc datatype of the output values
@vtype int
@vio in
- @endvar
+ @endvar
@var out_vals
@vdesc pointer to buffer holding the output values
@vtype void *
@vio in
- @endvar
+ @endvar
@var num_in_fields
@vdesc number of input fields passed in the variable argument list
@vtype int
@vio in
- @endvar
+ @endvar
@var <...>
@vdesc list of variables indices of input fields
@vtype int
@vio in
- @endvar
+ @endvar
@@*/
-int CCTK_Reduce(cGH *GH,
+int CCTK_Reduce(const cGH *GH,
int proc,
int operation_handle,
int num_out_vals,
@@ -339,32 +335,31 @@ int CCTK_Reduce(cGH *GH,
}
else
{
- operator = (t_reduce_operator *)
- Util_GetHandledData(ReductionOperators,operation_handle);
-
+ operator = Util_GetHandledData(ReductionOperators,operation_handle);
+
if (!operator)
{
CCTK_Warn(3,__LINE__,__FILE__,"Cactus",
- "CCTK_Reduce: Reduction operation is not registered"
- "and cannot be called");
+ "CCTK_Reduce: Reduction operation is not registered"
+ "and cannot be called");
retval = -1;
}
else
{
- /* Fill in the array of variable indices from the variable
- argument list */
+ /* Fill in the array of variable indices from the variable
+ argument list */
in_fields = malloc(num_in_fields*sizeof(int));
va_start(indices, num_in_fields);
for (i=0; i<num_in_fields; i++)
{
- in_fields[i] = va_arg(indices,int);
+ in_fields[i] = va_arg(indices,int);
}
va_end(indices);
- retval = operator->reduce_operator (GH, proc, num_out_vals,
- type_out_vals, out_vals,
- num_in_fields, in_fields);
-
+ retval = operator->reduce_operator (GH, proc, num_out_vals,
+ type_out_vals, out_vals,
+ num_in_fields, in_fields);
+
free(in_fields);
}
}
@@ -373,15 +368,15 @@ int CCTK_Reduce(cGH *GH,
void CCTK_FCALL CCTK_FNAME(CCTK_Reduce)
(int *fortranreturn,
- cGH *GH,
- int *proc,
- int *operation_handle,
- int *num_out_vals,
- int *type_out_vals,
+ const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const int *num_out_vals,
+ const int *type_out_vals,
void *out_vals,
- int *num_in_fields,
+ const int *num_in_fields,
... )
-{
+{
va_list indices;
int retval;
int i;
@@ -400,33 +395,32 @@ void CCTK_FCALL CCTK_FNAME(CCTK_Reduce)
else
{
/* Get the pointer to the reduction operator */
- operator = (t_reduce_operator *)
- Util_GetHandledData(ReductionOperators,*operation_handle);
-
+ operator = Util_GetHandledData(ReductionOperators,*operation_handle);
+
if (!operator)
{
CCTK_Warn(3,__LINE__,__FILE__,"Cactus",
- "CCTK_Reduce: Reduction operation is not registered"
- " and cannot be called");
+ "CCTK_Reduce: Reduction operation is not registered"
+ " and cannot be called");
retval = -1;
}
else
{
-
- /* Fill in the array of variable indices from the variable
- argument list */
+
+ /* Fill in the array of variable indices from the variable
+ argument list */
in_fields = malloc (*num_in_fields * sizeof (int));
va_start(indices, num_in_fields);
for (i=0; i<*num_in_fields; i++)
{
- in_fields[i] = *va_arg(indices,int *);
+ in_fields[i] = *va_arg(indices,int *);
}
va_end(indices);
-
- retval = operator->reduce_operator (GH, *proc, *num_out_vals,
- *type_out_vals, out_vals,
- *num_in_fields,in_fields);
-
+
+ retval = operator->reduce_operator (GH, *proc, *num_out_vals,
+ *type_out_vals, out_vals,
+ *num_in_fields,in_fields);
+
free(in_fields);
}
}
@@ -438,23 +432,21 @@ void CCTK_FCALL CCTK_FNAME(CCTK_Reduce)
@routine CCTK_RegisterReductionArrayOperator
@date Aug 19 1999
@author Thomas Radke
- @desc
+ @desc
Registers "function" as a array reduction operator called "name"
- @enddesc
+ @enddesc
@var function
@vdesc Routine containing reduction operator
@vtype (int (*))
- @vio
- @vcomment
- @endvar
+ @vio
+ @endvar
@var name
@vdesc String containing name of reduction operator
@vtype const char *
@vio in
- @vcomment
- @endvar
+ @endvar
@@*/
-
+
int CCTK_RegisterReductionArrayOperator
(int (*function)(REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST),
const char *name)
@@ -468,7 +460,7 @@ int CCTK_RegisterReductionArrayOperator
{
/* Get a handle for it. */
handle = Util_NewHandle(&ReductionArrayOperators, name, (int *)function);
-
+
/* Remember how many reduction operators there are */
num_reductions_array++;
}
@@ -477,7 +469,7 @@ int CCTK_RegisterReductionArrayOperator
/* Reduction operator with this name already exists. */
CCTK_Warn(1,__LINE__,__FILE__,"Cactus",
"CCTK_RegisterReductionArrayOperator: "
- "Array reduction operator with this name already exists");
+ "Array reduction operator with this name already exists");
handle = -1;
}
@@ -488,7 +480,7 @@ int CCTK_RegisterReductionArrayOperator
printf(" Registering %s with handle %d\n",name,handle);
CCTK_PRINTSEPARATOR
#endif
-
+
return handle;
}
@@ -498,15 +490,14 @@ int CCTK_RegisterReductionArrayOperator
@routine CCTK_ReductionArrayHandle
@date Aug 19 1999
@author Thomas Radke
- @desc
+ @desc
Returns the handle of a given array reduction operator
- @enddesc
+ @enddesc
@var reduction
@vdesc String containing name of array reduction operator
@vtype const char *
@vio in
- @vcomment
- @endvar
+ @endvar
@@*/
int CCTK_ReductionArrayHandle(const char *reduction)
@@ -529,12 +520,12 @@ int CCTK_ReductionArrayHandle(const char *reduction)
{
CCTK_VWarn (1, __LINE__, __FILE__, "Cactus",
"CCTK_ReductionArrayHandle: "
- "No handle found for array reduction operator '%s'",
- reduction);
+ "No handle found for array reduction operator '%s'",
+ reduction);
}
return handle;
-}
+}
void CCTK_FCALL CCTK_FNAME(CCTK_ReductionArrayHandle)
(int *operation_handle, ONE_FORTSTRING_ARG)
@@ -549,69 +540,69 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReductionArrayHandle)
@routine CCTK_ReduceArray
@date Aug 19 1999
@author Thomas Radke
- @desc
+ @desc
Generic routine for doing a reduction operation on a set of
arrays.
- @enddesc
+ @enddesc
@var GH
@vdesc pointer to the grid hierarchy
- @vtype cGH *
+ @vtype const cGH *
@vio in
- @endvar
+ @endvar
@var proc
@vdesc processor that receives the result of the reduction operation
(a negative value means that all processors get the result)
@vtype int
@vio in
- @endvar
+ @endvar
@var operation_handle
@vdesc the handle specifying the reduction operator
@vtype int
@vio in
- @endvar
+ @endvar
@var num_out_vals
@vdesc number of elements in the reduction output
@vtype int
@vio in
- @endvar
+ @endvar
@var type_out_vals
@vdesc datatype of the reduction output
@vtype int
@vio in
- @endvar
+ @endvar
@var out_vals
@vdesc pointer to buffer holding the output values
@vtype void *
@vio in
- @endvar
+ @endvar
@var num_dims
@vdesc number of dimensions of input arrays
@vtype int
@vio in
- @endvar
+ @endvar
@var num_in_fields
@vdesc number of input fields passed in the variable argument list
@vtype int
@vio in
- @endvar
+ @endvar
@var type_in_arrays
@vdesc datatype of the input arrays
@vtype int
@vio in
- @endvar
+ @endvar
@var <...>
@vdesc list of dimensions of input arrays
@vtype int
@vio in
- @endvar
+ @endvar
@var <...>
@vdesc list of pointers to input arrays
@vtype void *
@vio in
- @endvar
+ @endvar
@@*/
-int CCTK_ReduceArray(cGH *GH,
+int CCTK_ReduceArray(const cGH *GH,
int proc,
int operation_handle,
int num_out_vals,
@@ -622,12 +613,12 @@ int CCTK_ReduceArray(cGH *GH,
int type_in_arrays,
... )
{
-
+
va_list indices;
int i;
int *dims;
- void **in_arrays;
- int (*function)(REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST)=NULL;
+ const void **in_arrays;
+ int (*function)(REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST)=NULL;
/* Get the pointer to the reduction operator */
@@ -638,9 +629,8 @@ int CCTK_ReduceArray(cGH *GH,
return (-1);
}
- function = (int (*)(REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST))
- Util_GetHandledData(ReductionArrayOperators,operation_handle);
-
+ function = Util_GetHandledData(ReductionArrayOperators,operation_handle);
+
if (! function)
{
CCTK_Warn(3,__LINE__,__FILE__,"Cactus",
@@ -650,50 +640,54 @@ int CCTK_ReduceArray(cGH *GH,
}
/* allocate memory for dims and input array pointers */
- dims = (int *) malloc (num_dims * sizeof (int));
- in_arrays = (void **) malloc (num_in_arrays * sizeof (void *));
+ dims = malloc (num_dims * sizeof (int));
+ in_arrays = malloc (num_in_arrays * sizeof (void *));
/* Fill in the arrays of dims and input array pointers
from the variable argument list */
va_start(indices, type_in_arrays);
- for (i = 0; i < num_dims; i++)
- dims [i] = va_arg (indices, int);
+ for (i = 0; i < num_dims; i++)
+ {
+ dims[i] = va_arg (indices, int);
+ }
for (i = 0; i < num_in_arrays; i++)
- in_arrays [i] = va_arg (indices, void *);
+ {
+ in_arrays[i] = va_arg (indices, void *);
+ }
va_end(indices);
-
+
function (GH, proc, num_dims, dims,
num_in_arrays, in_arrays, type_in_arrays,
num_out_vals, out_vals, type_out_vals);
-
+
free (in_arrays);
free (dims);
-
+
return (0);
}
void CCTK_FCALL CCTK_FNAME(CCTK_ReduceArray)
(int *fortran_return,
- cGH *GH,
- int *proc,
- int *operation_handle,
- int *num_out_vals,
- int *type_out_vals,
+ const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const int *num_out_vals,
+ const int *type_out_vals,
void *out_vals,
- int *num_dims,
- int *num_in_arrays,
- int *type_in_arrays,
+ const int *num_dims,
+ const int *num_in_arrays,
+ const int *type_in_arrays,
... )
{
-
+
va_list varargs;
int i;
int *dims;
- void **in_arrays;
- int (*function)(REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST);
+ const void **in_arrays;
+ int (*function)(REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST);
/* initialize return code to indicate an error */
@@ -707,20 +701,19 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceArray)
return;
}
- function = (int (*) (REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST))
- Util_GetHandledData (ReductionArrayOperators, *operation_handle);
-
+ function = Util_GetHandledData (ReductionArrayOperators, *operation_handle);
+
if (! function)
{
- CCTK_Warn (3,__LINE__,__FILE__,"Cactus",
+ CCTK_Warn (3,__LINE__,__FILE__,"Cactus",
"CCTK_ReduceArray: Array reduction operation is not registered "
- "and cannot be called");
+ "and cannot be called");
return;
}
/* allocate memory for dims and input array pointers */
- dims = (int *) malloc (*num_dims * sizeof (int));
- in_arrays = (void **) malloc (*num_in_arrays * sizeof (void *));
+ dims = malloc (*num_dims * sizeof (int));
+ in_arrays = malloc (*num_in_arrays * sizeof (void *));
/* Fill in the arrays of dims and input array pointers
from the variable argument list */
@@ -728,16 +721,20 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceArray)
va_start (varargs, type_in_arrays);
for (i = 0; i < *num_dims; i++)
- dims [i] = *va_arg (varargs, int *);
+ {
+ dims[i] = *va_arg (varargs, int *);
+ }
for (i = 0; i < *num_in_arrays; i++)
- in_arrays [i] = va_arg (varargs, void *);
+ {
+ in_arrays[i] = va_arg (varargs, void *);
+ }
va_end (varargs);
-
+
function (GH, *proc, *num_dims, dims,
*num_in_arrays, in_arrays, *type_in_arrays,
*num_out_vals, out_vals, *type_out_vals);
-
+
free (in_arrays);
free (dims);
@@ -750,43 +747,43 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceArray)
@date Aug 19 1999
@author Thomas Radke
@desc Wrapper function for reduction of a single scalar
- @enddesc
+ @enddesc
@var GH
@vdesc pointer to the grid hierarchy
- @vtype cGH *
+ @vtype const cGH *
@vio in
- @endvar
+ @endvar
@var proc
@vdesc processor that receives the result of the reduction operation
(a negative value means that all processors get the result)
@vtype int
@vio in
- @endvar
+ @endvar
@var operation_handle
@vdesc the handle specifying the reduction operator
@vtype int
@vio in
- @endvar
+ @endvar
@var in_scalar
@vdesc pointer to input scalar
@vtype void *
@vio in
- @endvar
+ @endvar
@var out_scalar
@vdesc pointer to output scalar
@vtype void *
@vio in
- @endvar
+ @endvar
@var data_type
@vdesc datatype for both input and output scalar
@vtype int
@vio in
- @endvar
+ @endvar
@@*/
/*** FIXME: OLD INTERFACE gerd ***/
-int CCTK_ReduceLocalScalar (cGH *GH, int proc, int operation_handle,
- void *in_scalar, void *out_scalar, int data_type)
+int CCTK_ReduceLocalScalar (const cGH *GH, int proc, int operation_handle,
+ const void *in_scalar, void *out_scalar, int data_type)
{
return (CCTK_ReduceArray (GH, proc, operation_handle,
1, data_type, out_scalar,
@@ -796,12 +793,12 @@ int CCTK_ReduceLocalScalar (cGH *GH, int proc, int operation_handle,
/*** FIXME: OLD INTERFACE gerd ***/
void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalScalar)
(int *fortran_return,
- cGH *GH,
- int *proc,
- int *operation_handle,
- void *in_scalar,
+ const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const void *in_scalar,
void *out_scalar,
- int *data_type)
+ const int *data_type)
{
*fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle,
1, *data_type, out_scalar,
@@ -809,8 +806,8 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalScalar)
}
-int CCTK_ReduceLocScalar (cGH *GH, int proc, int operation_handle,
- void *in_scalar, void *out_scalar, int data_type)
+int CCTK_ReduceLocScalar (const cGH *GH, int proc, int operation_handle,
+ const void *in_scalar, void *out_scalar, int data_type)
{
return (CCTK_ReduceArray (GH, proc, operation_handle,
1, data_type, out_scalar,
@@ -819,12 +816,12 @@ int CCTK_ReduceLocScalar (cGH *GH, int proc, int operation_handle,
void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocScalar)
(int *fortran_return,
- cGH *GH,
- int *proc,
- int *operation_handle,
- void *in_scalar,
+ const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const void *in_scalar,
void *out_scalar,
- int *data_type)
+ const int *data_type)
{
*fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle,
1, *data_type, out_scalar,
@@ -836,23 +833,17 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocScalar)
@routine CCTK_ReduceLocArrayToArray1D
@date Thu Oct 14 12:10:01 1999
@author Gerd Lanfermann
- @desc
+ @desc
Interface to the migthy CCTK_Reduce for
- reduction of local 1D arrays to local arrays
+ reduction of local 1D arrays to local arrays
(element by element).
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
-
+ @enddesc
@@*/
/*** FIXME: OLD INTERFACE gerd ***/
-int CCTK_ReduceLocalArray1D (cGH *GH, int proc, int operation_handle,
- void *in_array1d, void *out_array1d,
- int num_in_array1d,
+int CCTK_ReduceLocalArray1D (const cGH *GH, int proc, int operation_handle,
+ const void *in_array1d, void *out_array1d,
+ int num_in_array1d,
int data_type)
{
return (CCTK_ReduceArray (GH, proc, operation_handle,
@@ -860,8 +851,8 @@ int CCTK_ReduceLocalArray1D (cGH *GH, int proc, int operation_handle,
1, 1, data_type, num_in_array1d, in_array1d));
}
-int CCTK_ReduceLocArrayToArray1D(cGH *GH, int proc, int operation_handle,
- void *in_array1d, void *out_array1d,
+int CCTK_ReduceLocArrayToArray1D(const cGH *GH, int proc, int operation_handle,
+ const void *in_array1d, void *out_array1d,
int num_in_array1d,
int data_type)
{
@@ -873,13 +864,13 @@ int CCTK_ReduceLocArrayToArray1D(cGH *GH, int proc, int operation_handle,
/*** FIXME: OLD INTERFACE gerd ***/
void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalArray1D)
(int *fortran_return,
- cGH *GH,
- int *proc,
- int *operation_handle,
- void *in_array1d,
+ const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const void *in_array1d,
void *out_array1d,
- int *num_in_array1d,
- int *data_type)
+ const int *num_in_array1d,
+ const int *data_type)
{
*fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle,
*num_in_array1d, *data_type, out_array1d,
@@ -892,28 +883,22 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalArray1D)
@routine CCTK_ReduceLocArrayToArray1D
@date Sat Nov 27 22:52:10 1999
@author Gerd Lanfermann
- @desc
+ @desc
Interface for the reduction of local 1d arrays
- to the mighty CCCTK_reduce interface.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
-
+ to the mighty CCCTK_reduce interface.
+ @enddesc
@@*/
void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray1D)
(int *fortran_return,
- cGH *GH,
- int *proc,
- int *operation_handle,
- void *in_array1d,
+ const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const void *in_array1d,
void *out_array1d,
- int *num_in_array1d,
- int *data_type)
+ const int *num_in_array1d,
+ const int *data_type)
{
*fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle,
*num_in_array1d, *data_type, out_array1d,
@@ -925,22 +910,16 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray1D)
@routine CCTK_ReduceLocArrayToArray2D
@date Sat Nov 27 22:52:10 1999
@author Gerd Lanfermann
- @desc
+ @desc
Interface for the reduction of local 2d arrays
- to the mighty CCCTK_reduce interface.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
-
+ to the mighty CCCTK_reduce interface.
+ @enddesc
@@*/
-int CCTK_ReduceLocArrayToArray2D(cGH *GH, int proc, int operation_handle,
- void *in_array2d, void *out_array2d,
+int CCTK_ReduceLocArrayToArray2D(const cGH *GH, int proc, int operation_handle,
+ const void *in_array2d, void *out_array2d,
int xsize, int ysize,
int data_type)
{
@@ -948,24 +927,24 @@ int CCTK_ReduceLocArrayToArray2D(cGH *GH, int proc, int operation_handle,
return (CCTK_ReduceArray (GH, proc, operation_handle,
lin_size,
data_type, out_array2d,
- 2, 1, data_type,
+ 2, 1, data_type,
xsize,ysize, in_array2d));
}
void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray2D)
- (int *fortran_return, cGH *GH,
- int *proc,
- int *operation_handle,
- void *in_array2d,
+ (int *fortran_return, const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const void *in_array2d,
void *out_array2d,
- int *xsize, int *ysize,
- int *data_type)
+ const int *xsize, const int *ysize,
+ const int *data_type)
{
int lin_size = (*xsize)*(*ysize);
*fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle,
lin_size,
*data_type, out_array2d,
- 2, 1, *data_type,
+ 2, 1, *data_type,
*xsize, *ysize,
in_array2d);
}
@@ -974,20 +953,14 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray2D)
@routine CCTK_ReduceLocArrayToArray1D
@date Sat Nov 27 22:52:10 1999
@author Gerd Lanfermann
- @desc
+ @desc
Interface for the reduction of local 3d arrays
to 3d arrays.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
-
+ @enddesc
@@*/
-int CCTK_ReduceLocArrayToArray3D(cGH *GH, int proc, int operation_handle,
- void *in_array3d, void *out_array3d,
+int CCTK_ReduceLocArrayToArray3D(const cGH *GH, int proc, int operation_handle,
+ const void *in_array3d, void *out_array3d,
int xsize, int ysize, int zsize,
int data_type)
{
@@ -996,26 +969,26 @@ int CCTK_ReduceLocArrayToArray3D(cGH *GH, int proc, int operation_handle,
return (CCTK_ReduceArray (GH, proc, operation_handle,
lin_size,
data_type, out_array3d,
- 3, 1, data_type,
+ 3, 1, data_type,
xsize,ysize,zsize,
in_array3d));
}
void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray3D)
- (int *fortran_return, cGH *GH,
- int *proc,
- int *operation_handle,
- void *in_array3d,
+ (int *fortran_return, const cGH *GH,
+ const int *proc,
+ const int *operation_handle,
+ const void *in_array3d,
void *out_array3d,
- int *xsize, int *ysize, int *zsize,
- int *data_type)
+ const int *xsize, const int *ysize, const int *zsize,
+ const int *data_type)
{
int lin_size = (*xsize)*(*ysize)*(*zsize);
*fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle,
lin_size,
*data_type, out_array3d,
- 3, 1, *data_type,
- *xsize,*ysize,*zsize,
+ 3, 1, *data_type,
+ *xsize,*ysize,*zsize,
in_array3d);
}
@@ -1055,9 +1028,8 @@ const char *CCTK_ReduceOperatorImplementation(int handle)
t_reduce_operator *operator;
const char *imp=NULL;
- operator = (t_reduce_operator *)
- Util_GetHandledData (ReductionOperators, handle);
-
+ operator = Util_GetHandledData (ReductionOperators, handle);
+
if (operator)
{
imp = operator->implementation;
@@ -1079,12 +1051,11 @@ const char *CCTK_ReduceOperatorImplementation(int handle)
@vdesc Handle for reduction operator
@vtype int
@vio in
- @vcomment
@endvar
@returntype const char *
@returndesc
- The name of the reduction operator, or NULL if the handle
+ The name of the reduction operator, or NULL if the handle
is invalid
@endreturndesc
@@*/
@@ -1100,8 +1071,7 @@ const char *CCTK_ReduceOperator (int handle)
}
else
{
- operator = (t_reduce_operator *) Util_GetHandledData (ReductionOperators,
- handle);
+ operator = Util_GetHandledData (ReductionOperators, handle);
if (operator)
{
name = operator->name;
@@ -1109,10 +1079,9 @@ const char *CCTK_ReduceOperator (int handle)
else
{
CCTK_VWarn (6, __LINE__, __FILE__, "Cactus",
- "CCTK_ReduceOperator: Handle %d invalid", handle);
+ "CCTK_ReduceOperator: Handle %d invalid", handle);
}
}
return name;
}
-