aboutsummaryrefslogtreecommitdiff
path: root/src/ReductionNormInf.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/ReductionNormInf.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/ReductionNormInf.c')
-rw-r--r--src/ReductionNormInf.c130
1 files changed, 65 insertions, 65 deletions
diff --git a/src/ReductionNormInf.c b/src/ReductionNormInf.c
index 0feb79a..c304477 100644
--- a/src/ReductionNormInf.c
+++ b/src/ReductionNormInf.c
@@ -2,11 +2,11 @@
@file ReductionNormInf.c
@date Sat Aug 25, 2001
@author Thomas Radke, Paul Walker, Erik Schnetter
- @desc
+ @desc
Defines the PUGH reduction operator to get the norm
of an arbitrary array which is defined as:
norm_inf = $\max |a_i| $
- @enddesc
+ @enddesc
@version $Id$
@@*/
@@ -20,19 +20,19 @@ static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusPUGH_PUGHReduce_ReductionNormInf_c)
/* local function prototypes */
-static int PUGH_ReductionNormInf (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 ReductionNormInf (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_ReductionNormInf (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_ReductionNormInfArrays (cGH *GH,
+int PUGH_ReductionNormInfArrays (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_ReductionNormInfArrays (cGH *GH,
return (PUGH_ReductionArrays (GH, proc, num_dims, dims,
intype, num_inarrays, inarrays,
outtype, num_outvals, outvals,
- PUGH_ReductionNormInf));
+ ReductionNormInf));
}
@@ -135,55 +135,55 @@ int PUGH_ReductionNormInfArrays (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_ReductionNormInfGVs (cGH *GH,
- int proc,
+int PUGH_ReductionNormInfGVs (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_ReductionNormInf));
+ ReductionNormInf));
}
@@ -191,7 +191,7 @@ int PUGH_ReductionNormInfGVs (cGH *GH,
/* local functions */
/*****************************************************************************/
/*@@
- @routine PUGH_ReductionNormInf
+ @routine ReductionNormInf
@date Aug 19 1999
@author Thomas Radke
@desc Returns the "norm_inf" of a distributed array with
@@ -199,21 +199,21 @@ int PUGH_ReductionNormInfGVs (cGH *GH,
(num_outvals == 1) or on the results of the local reductions.
"norm_inf" is defined as $\max |a_i|$.
- @enddesc
+ @enddesc
@@*/
-static int PUGH_ReductionNormInf (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 ReductionNormInf (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
@@ -330,9 +330,9 @@ static int PUGH_ReductionNormInf (cGH *GH,
#ifdef CCTK_MPI
/* do the global reduction from the processors' local reduction results */
- if (CCTK_nProcs (GH) > 1)
+ if (CCTK_nProcs (GH) > 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));