diff options
author | tradke <tradke@d60812e6-3970-4df4-986e-c251b06effeb> | 2003-03-10 13:10:47 +0000 |
---|---|---|
committer | tradke <tradke@d60812e6-3970-4df4-986e-c251b06effeb> | 2003-03-10 13:10:47 +0000 |
commit | f69684d7aba78edce0e0465e8ba338ae19a1e4b7 (patch) | |
tree | a1dcfc5e5c9db511b4129a7b637a5c8d2f2a419d /src/ReductionSum.c | |
parent | 5a55318a46ef9e35ff93d0b36bd4053a1734c61a (diff) |
Almost forgot to commit this: added 'const' qualifiers to all the read-only
input arguments for the reduction API.
You also need an up-to-date flesh now in order to compile.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHReduce/trunk@35 d60812e6-3970-4df4-986e-c251b06effeb
Diffstat (limited to 'src/ReductionSum.c')
-rw-r--r-- | src/ReductionSum.c | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/src/ReductionSum.c b/src/ReductionSum.c index 64ef497..ffeb39e 100644 --- a/src/ReductionSum.c +++ b/src/ReductionSum.c @@ -2,11 +2,11 @@ @file ReductionSum.c @date Thu Apr 3 11:54:53 1997 @author Thomas Radke, Paul Walker - @desc + @desc Defines the PUGH reduction operator to get the sum of an arbitrary array. - @enddesc - @version $Header$ + @enddesc + @version $Id$ @@*/ #include <stdlib.h> @@ -19,19 +19,19 @@ static const char *rcsid = "$Id$"; CCTK_FILEVERSION(CactusPUGH_PUGHReduce_ReductionSum_c) /* local function prototypes */ -static int PUGH_ReductionSum (cGH *GH, - int proc, - int num_dims, - int from[/* dim */], - int to[/* dim */], - int iterator[/* dim */], - int points_per_dim[/* dim */], - int num_points, - int num_inarrays, - int intypes[/* num_inarrays */], - void *inarrays[/* num_inarrays */], - int num_outvals, - CCTK_REAL outvals[/*num_inarrays*num_outvals*/]); +static int ReductionSum (const cGH *GH, + int proc, + int num_dims, + const int from[/* dim */], + const int to[/* dim */], + int iterator[/* dim */], + const int points_per_dim[/* dim */], + int num_points, + int num_inarrays, + const int intypes[/* num_inarrays */], + const void *const inarrays[/* num_inarrays */], + int num_outvals, + CCTK_REAL outvals[/*num_inarrays*num_outvals*/]); /*@@ @@ -48,74 +48,74 @@ static int PUGH_ReductionSum (cGH *GH, is always computed as a CCTK_REAL value internally. @enddesc @history - @endhistory + @endhistory @var GH @vdesc Pointer to CCTK grid hierarchy - @vtype cGH + @vtype const cGH * @vio in - @endvar + @endvar @var proc @vdesc processor that should receive the result of operation (negative value means all processors receive the result) @vtype int @vio in - @endvar + @endvar @var nDims @vdesc number of dimensions of input arrays @vtype int @vio in - @endvar + @endvar @var dims @vdesc dimensions of input arrays - @vtype int * + @vtype const int * @vio in - @endvar + @endvar @var nArrays @vdesc number of input arrays @vtype int @vio in - @endvar - @var inArrays + @endvar + @var inarrays @vdesc field of input arrays - @vtype void ** + @vtype const void *const @vio in - @endvar + @endvar @var inType @vdesc (common) variable type of input arrays @vtype int @vio in - @endvar + @endvar @var num_outvals @vdesc number of values per output array @vtype int @vio in - @endvar + @endvar @var outvals @vdesc pointer to buffer holding the output values @vtype void * @vio in - @endvar + @endvar @var outtype @vdesc (common) variable type of output arrays @vtype int @vio in - @endvar + @endvar @@*/ -int PUGH_ReductionSumArrays (cGH *GH, - int proc, - int num_dims, - int dims[/* num_dims */], - int num_inarrays, - void *inarrays[/* num_inarrays */], - int intype, - int num_outvals, - void *outvals /* [num_outvals] */, - int outtype) +int PUGH_ReductionSumArrays (const cGH *GH, + int proc, + int num_dims, + const int dims[/* num_dims */], + int num_inarrays, + const void *const inarrays[/* num_inarrays */], + int intype, + int num_outvals, + void *outvals /* [num_outvals] */, + int outtype) { return (PUGH_ReductionArrays (GH, proc, num_dims, dims, intype, num_inarrays, inarrays, outtype, num_outvals, outvals, - PUGH_ReductionSum)); + ReductionSum)); } @@ -133,55 +133,55 @@ int PUGH_ReductionSumArrays (cGH *GH, results of the local reductions. @enddesc @history - @endhistory + @endhistory @var GH @vdesc Pointer to CCTK grid hierarchy - @vtype cGH + @vtype const cGH * @vio in - @endvar + @endvar @var proc @vdesc processor that should receive the result of operation (negative value means all processors receive the result) @vtype int @vio in - @endvar + @endvar @var num_outvals @vdesc number of requested output elements @vtype int @vio in - @endvar + @endvar @var outtype @vdesc type of return value @vtype int @vio in - @endvar + @endvar @var outvals @vdesc array for the result values to be stored @vtype void * @vio in - @endvar + @endvar @var num_invars @vdesc number of variables in the list @vtype int @vio in - @endvar + @endvar @var invars @vdesc list of variables (given as their global indices) - @vtype int * + @vtype const int * @vio in - @endvar + @endvar @@*/ -int PUGH_ReductionSumGVs (cGH *GH, - int proc, - int num_outvals, - int outtype, - void *outvals /* [num_outvals] */, - int num_invars, - int invars[/* num_invars */]) +int PUGH_ReductionSumGVs (const cGH *GH, + int proc, + int num_outvals, + int outtype, + void *outvals /* [num_outvals] */, + int num_invars, + const int invars[/* num_invars */]) { - return (PUGH_ReductionGVs (GH, proc, num_invars, invars, + return (PUGH_ReductionGVs (GH, proc, num_invars, invars, outtype, num_outvals, outvals, - PUGH_ReductionSum)); + ReductionSum)); } @@ -189,7 +189,7 @@ int PUGH_ReductionSumGVs (cGH *GH, /* local functions */ /*****************************************************************************/ /*@@ - @routine PUGH_ReductionSum + @routine ReductionSum @date Aug 19 1999 @author Thomas Radke @desc Returns the sum of a distributed array with @@ -197,19 +197,19 @@ int PUGH_ReductionSumGVs (cGH *GH, (num_outvals == 1) or on the results of the local reductions. @enddesc @@*/ -static int PUGH_ReductionSum (cGH *GH, - int proc, - int num_dims, - int from[/* dim */], - int to[/* dim */], - int iterator[/* dim */], - int points_per_dim[/* dim */], - int num_points, - int num_inarrays, - int intypes[/* num_inarrays */], - void *inarrays[/* num_inarrays */], - int num_outvals, - CCTK_REAL outvals[/*num_inarrays*num_outvals*/]) +static int ReductionSum (const cGH *GH, + int proc, + int num_dims, + const int from[/* dim */], + const int to[/* dim */], + int iterator[/* dim */], + const int points_per_dim[/* dim */], + int num_points, + int num_inarrays, + const int intypes[/* num_inarrays */], + const void *const inarrays[/* num_inarrays */], + int num_outvals, + CCTK_REAL outvals[/*num_inarrays*num_outvals*/]) { int i, total_outvals; #ifdef CCTK_MPI @@ -314,7 +314,7 @@ static int PUGH_ReductionSum (cGH *GH, /* do the global reduction from the processors' local reduction results */ if (pughGH->nprocs > 1) { - local_outvals = (CCTK_REAL *) malloc (total_outvals * sizeof (CCTK_REAL)); + local_outvals = malloc (total_outvals * sizeof (CCTK_REAL)); /* outvals[] contains now the local sum */ memcpy (local_outvals, outvals, total_outvals * sizeof (CCTK_REAL)); |