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/ReductionNorm1.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/ReductionNorm1.c')
-rw-r--r-- | src/ReductionNorm1.c | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/src/ReductionNorm1.c b/src/ReductionNorm1.c index 83e24b9..f621602 100644 --- a/src/ReductionNorm1.c +++ b/src/ReductionNorm1.c @@ -2,12 +2,12 @@ @file ReductionNorm1.c @date Thu Apr 3 11:54:53 1997 @author Thomas Radke, Paul Walker - @desc + @desc Defines the PUGH reduction operator to get the norm of an arbitrary array which is defined as: norm1 = $\Sigma |a_i| / np$ - @enddesc - @version $Header$ + @enddesc + @version $Id$ @@*/ #include <stdlib.h> @@ -20,19 +20,19 @@ static const char *rcsid = "$Id$"; CCTK_FILEVERSION(CactusPUGH_PUGHReduce_ReductionNorm1_c) /* local function prototypes */ -static int PUGH_ReductionNorm1 (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 ReductionNorm1 (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*/]); /*@@ @@ -52,65 +52,65 @@ static int PUGH_ReductionNorm1 (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 num_dims @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 num_arrays @vdesc number of input arrays @vtype int @vio in - @endvar + @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_ReductionNorm1Arrays (cGH *GH, +int PUGH_ReductionNorm1Arrays (const cGH *GH, int proc, int num_dims, - int dims[/* num_dims */], + const int dims[/* num_dims */], int num_inarrays, - void *inarrays[/* num_inarrays */], + const void *const inarrays[/* num_inarrays */], int intype, int num_outvals, void *outvals /* [num_outvals] */, @@ -119,7 +119,7 @@ int PUGH_ReductionNorm1Arrays (cGH *GH, return (PUGH_ReductionArrays (GH, proc, num_dims, dims, intype, num_inarrays, inarrays, outtype, num_outvals, outvals, - PUGH_ReductionNorm1)); + ReductionNorm1)); } @@ -135,55 +135,55 @@ int PUGH_ReductionNorm1Arrays (cGH *GH, reductions, so num_outvals must be 1. @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 nOutVars @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_ReductionNorm1GVs (cGH *GH, - int proc, +int PUGH_ReductionNorm1GVs (const cGH *GH, + int proc, int num_outvals, - int outtype, + int outtype, void *outvals /* [num_outvals] */, int num_invars, - int invars[/* num_invars */]) + const int invars[/* num_invars */]) { return (PUGH_ReductionGVs (GH, proc, num_invars, invars, outtype, num_outvals, outvals, - PUGH_ReductionNorm1)); + ReductionNorm1)); } @@ -199,21 +199,21 @@ int PUGH_ReductionNorm1GVs (cGH *GH, (num_outvals == 1) or on the results of the local reductions. "norm1" is defined as $\Sigma |a_i| / np$. - @enddesc + @enddesc @@*/ -static int PUGH_ReductionNorm1 (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 ReductionNorm1 (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; pGH *pughGH; @@ -321,9 +321,9 @@ static int PUGH_ReductionNorm1 (cGH *GH, #ifdef CCTK_MPI /* do the global reduction from the processors' local reduction results */ - if (pughGH->nprocs > 1) + 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)); |