aboutsummaryrefslogtreecommitdiff
path: root/src/ReductionMin.c
diff options
context:
space:
mode:
authortradke <tradke@d60812e6-3970-4df4-986e-c251b06effeb>2003-03-10 13:10:47 +0000
committertradke <tradke@d60812e6-3970-4df4-986e-c251b06effeb>2003-03-10 13:10:47 +0000
commitf69684d7aba78edce0e0465e8ba338ae19a1e4b7 (patch)
treea1dcfc5e5c9db511b4129a7b637a5c8d2f2a419d /src/ReductionMin.c
parent5a55318a46ef9e35ff93d0b36bd4053a1734c61a (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/ReductionMin.c')
-rw-r--r--src/ReductionMin.c140
1 files changed, 70 insertions, 70 deletions
diff --git a/src/ReductionMin.c b/src/ReductionMin.c
index b1b9492..2d7d494 100644
--- a/src/ReductionMin.c
+++ b/src/ReductionMin.c
@@ -2,11 +2,11 @@
@file ReductionMin.c
@date Thu Apr 3 11:54:53 1997
@author Thomas Radke, Paul Walker
- @desc
+ @desc
Defines the PUGH reduction operator to get the minimum
for a set of arbitrary arrays.
- @enddesc
- @version $Header$
+ @enddesc
+ @version $Id$
@@*/
#include <stdlib.h>
@@ -19,19 +19,19 @@ static const char *rcsid = "$Id$";
CCTK_FILEVERSION(CactusPUGH_PUGHReduce_ReductionMin_c)
/* local function prototypes */
-static int PUGH_ReductionMinVal (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 ReductionMinVal (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_ReductionMinVal (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_inarrays
@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_ReductionMinValArrays (cGH *GH,
- int proc,
- int num_dims,
- int dims[/* num_dims */],
- int num_inarrays,
- void *inarrays[/* num_inarrays */],
+int PUGH_ReductionMinValArrays (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,
+ 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_ReductionMinVal));
+ ReductionMinVal));
}
@@ -133,55 +133,55 @@ int PUGH_ReductionMinValArrays (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_ReductionMinValGVs (cGH *GH,
- int proc,
+int PUGH_ReductionMinValGVs (const cGH *GH,
+ int proc,
int num_outvals,
- int outtype,
+ int outtype,
void *outvals /* [num_outvals] */,
- int num_invars,
- int invars[/* num_invars */])
+ 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_ReductionMinVal));
+ ReductionMinVal));
}
@@ -189,7 +189,7 @@ int PUGH_ReductionMinValGVs (cGH *GH,
/* local functions */
/*****************************************************************************/
/*@@
- @routine PUGH_ReductionMinVal
+ @routine ReductionMinVal
@date Aug 19 1999
@author Thomas Radke
@desc Returns the minimum for a set of distributed array with
@@ -198,19 +198,19 @@ int PUGH_ReductionMinValGVs (cGH *GH,
or on the results of the local reductions.
@enddesc
@@*/
-static int PUGH_ReductionMinVal (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 ReductionMinVal (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
@@ -315,7 +315,7 @@ static int PUGH_ReductionMinVal (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 minimum */
memcpy (local_outvals, outvals, total_outvals * sizeof (CCTK_REAL));