diff options
Diffstat (limited to 'src/ReductionNorm2.c')
-rw-r--r-- | src/ReductionNorm2.c | 149 |
1 files changed, 67 insertions, 82 deletions
diff --git a/src/ReductionNorm2.c b/src/ReductionNorm2.c index d2c2093..2df1480 100644 --- a/src/ReductionNorm2.c +++ b/src/ReductionNorm2.c @@ -21,107 +21,94 @@ static const char *rcsid = "$Id$"; CCTK_FILEVERSION(CCTDevelopment_LocalReduce_ReductionNorm2_c) /* local function prototypes */ -static int ReductionNorm2 (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 have_local_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*/]); +static int ReductionNorm2 (int num_dims, + const int from[/* dim */], + const int to[/* dim */], + int iterator[/* dim */], + const int points_per_dim[/* dim */], + int num_points, + int have_local_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*/]); /*@@ - @routine PUGH_ReductionNorm2Arrays + @routine LocalReductionNorm2Arrays @author Thomas Radke @date 19 Aug 1999 @desc - Registered PUGH reduction routine for computing the "norm2" - of a set of arrays. - The arrays are described by their dimensions and variable type. - If the number of requested output values equals the number of - elements in an input array, global reduction is done element-wise. - Otherwise num_outvals must be 1, and global reduction is done on the - results of the local reductions. - Type casting of the result is provided by specifying the - requested output datatype. The intermediate reduction value - is always computed as a CCTK_REAL value internally. @enddesc @history @endhistory - @var GH - @vdesc Pointer to CCTK grid hierarchy - @vtype const cGH * + @var N_dims + @vdesc number of dimensions in the *reduction* + @vtype int @vio in @endvar - @var proc - @vdesc processor that should receive the result of operation - (negative value means all processors receive the result) + @var operator_handle + @vdesc operator handle specificies the type of reduction we will perform @vtype int @vio in @endvar - @var num_dims - @vdesc number of dimensions of input arrays + @var param_table_handle + @vdesc handle to "parameter table", a key-value table @vtype int @vio in @endvar - @var dims - @vdesc dimensions of input arrays - @vtype const int * + @var N_input_arrays + @vdesc number of input arrays + @vtype int @vio in @endvar - @var num_arrays - @vdesc number of input arrays - @vtype int + @var input_array_dims + @vdesc array of input array dimensions (common to all input arrays) + @vtype const CCTK_INT @vio in @endvar - @var inarrays - @vdesc field of input arrays - @vtype const void *const + @var input_array_type_codes + @vdesc array of CCTK_VARIABLE_* codes giving data types of input arrays + @vtype const CCTK_INT @vio in @endvar - @var intype - @vdesc (common) variable type of input arrays - @vtype int + @var input_arrays + @vdesc array of pointers to input arrays + @vtype const void *const @vio in @endvar - @var num_outvals - @vdesc number of values per output array + @var M_output_numbers + @vdesc @vtype int @vio in @endvar - @var outvals - @vdesc pointer to buffer holding the output values - @vtype void * + @var output_number_type_codes + @vdesc array of CCTK_VARIABLE_* codes giving data types of output numbers + @vtype const CCTK_INT @vio in @endvar - @var outtype - @vdesc (common) variable type of output arrays - @vtype int + @var output_numbers + @vdesc array[M_output_numbers] of pointers to output numbers[M_reduce_numbers] + @vtype void *const @vio in @endvar @@*/ -int ReductionNorm2Arrays (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) +int ReductionNorm2Arrays (int N_dims, int operator_handle, + int param_table_handle, int N_input_arrays, + const CCTK_INT input_array_dims[], + const CCTK_INT input_array_type_codes[], + const void *const input_arrays[], + int M_output_numbers, + const CCTK_INT output_number_type_codes[], + void *const output_numbers[]) { - return (ReductionArrays (GH, proc, num_dims, dims, - intype, num_inarrays, inarrays, - outtype, num_outvals, outvals, - ReductionNorm2)); + return (ReductionArrays (N_dims, operator_handle, + param_table_handle, N_input_arrays, + input_array_dims, input_array_type_codes, + input_arrays, M_output_numbers, + output_number_type_codes, output_numbers, + ReductionNorm2)); } @@ -140,20 +127,18 @@ int ReductionNorm2Arrays (const cGH *GH, "norm2" is defined as $\sqrt{\Sigma (a_i * a_i) / np}$. @enddesc @@*/ -static int ReductionNorm2 (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 have_local_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*/]) +static int ReductionNorm2 (int num_dims, + const int from[/* dim */], + const int to[/* dim */], + int iterator[/* dim */], + const int points_per_dim[/* dim */], + int num_points, + int have_local_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; @@ -275,7 +260,7 @@ static int ReductionNorm2 (const cGH *GH, #endif default: - CCTK_WARN (1, "PUGH_ReductionNorm2: Unknown variable type"); + CCTK_WARN (1, "LocalReductionNorm2: Unknown variable type"); return (-1); } } |