diff options
author | yye00 <yye00@7daa882c-dc44-4453-834e-278d26b18e6a> | 2004-08-18 17:47:07 +0000 |
---|---|---|
committer | yye00 <yye00@7daa882c-dc44-4453-834e-278d26b18e6a> | 2004-08-18 17:47:07 +0000 |
commit | 3fe89e0c397b8289e7c5ef10ae14aaeafd288001 (patch) | |
tree | a2cef63fea62910ddfcdd4de0ac6b5d916e5ef6b | |
parent | 9f598c5a8ad78b24851f7ec46431404b7b5bd9b5 (diff) |
pugh_reduction.h not used any more (local_reduction.h)
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/LocalReduce/trunk@12 7daa882c-dc44-4453-834e-278d26b18e6a
-rw-r--r-- | src/pugh_reductions.h | 185 |
1 files changed, 0 insertions, 185 deletions
diff --git a/src/pugh_reductions.h b/src/pugh_reductions.h deleted file mode 100644 index 7350d72..0000000 --- a/src/pugh_reductions.h +++ /dev/null @@ -1,185 +0,0 @@ - /*@@ - @header pugh_reductions.h - @date April 29 1999 - @author Gabrielle Allen - @desc - Prototypes for pugh reduction operators - @enddesc - @version $Header$ - @@*/ - -#ifndef _PUGH_REDUCTIONS_H_ -#define _PUGH_REDUCTIONS_H_ - - -#include "cctk.h" -#include "cctk_Reduction.h" -#include "CactusPUGH/PUGH/src/include/pugh.h" - -/*** - Macro to iterate over every element of an arbitrary sized array - - The array is given by - - its CCTK type, cctk_type, - - the number of dimensions, vdim, - - an (untyped) pointer to its data, vdata, - - one-dimensional vectors, from[] and to[], of length vdim, - specifying the start- and endpoint to iterate over for each dimension - - The result of the reduction is specified by - - the array where to store the results, outvals[] - - the type of the intermediate result scalar, outvals_type - - the number of scalars to reduce from this input array, num_outvals - - the total number of scalars for all input arrays, total_outvals - (incremented after each iteration) - - An iteration vector, iterator[], is passed in to hold the current indices - for each dimension of the array. - Another vector of size vdim, points_per_dim[], is used to compute the - linear index out of the iterator[] elements. - - Before the iteration loop, a local reduction variable, typed_outval, - is defined and initialized by the macro INITIAL_REDUCTION_VALUE(typed_vdata). - - For each iteration the macro REDUCTION_OPERATION(typed_outval, typed_inval) - is called, with the local reduction variable and the pointer to the - current data element. - - Finally, the local reduction variable, typed_outval, is type-casted - to CCTK_REAL and assigned to the current output array value outvals[]. - The total output scalar counter, total_outvals, is incremented. - - - NOTE: The macro assumes from[i] > to[i] for all 1 <= i < vdim such that - at least one iteration will be performed. - Make sure this is true when you set up the from[] and to[] vectors. - - For efficiency reasons, the innermost loop (the one for dimension 0) - is coded as a for() loop. Thus the overhead to iterate over a - one-dimensional array should be kept to a minimum. -***/ -#define ITERATE_ARRAY(cctk_type, vdim, vdata, from, to, iterator, \ - points_per_dim, \ - outvals_type, outvals, num_outvals, total_outvals) \ - { \ - int _i, _j, _dim, _vindex; \ - const cctk_type *typed_vdata = (vdata); \ - outvals_type typed_outval; \ - \ - \ - if (have_local_points) \ - { \ - for (_j = 0; _j < num_outvals; _j++, typed_vdata++) \ - { \ - /* get the linear index of the element to start with */ \ - _vindex = from[0]; \ - for (_i = 1; _i < vdim; _i++) \ - _vindex += from [_i] * points_per_dim [_i]; \ - typed_outval = INITIAL_REDUCTION_VALUE(typed_vdata + _vindex); \ - \ - /* set iterator to local startpoint */ \ - memcpy (iterator, from, vdim * sizeof (int)); \ - \ - /* do the nested loops starting with the second-innermost */ \ - _dim = 1; \ - while (1) \ - { \ - /* get the linear index */ \ - _vindex = 0; \ - for (_i = 1; _i < vdim; _i++) \ - _vindex += iterator [_i] * points_per_dim [_i]; \ - \ - /* do the reduction for the innermost loop (lowest dimension) */ \ - for (_i = from [0]; _i < to [0]; _i++) \ - { \ - REDUCTION_OPERATION (typed_outval, typed_vdata [_i + _vindex]); \ - } \ - \ - if (vdim > 1) \ - { \ - /* increment current looper and check for end */ \ - if (++iterator [_dim] >= to [_dim]) \ - { \ - /* increment outermost loopers */ \ - for (_dim++; _dim < vdim; _dim++) \ - { \ - if (++iterator [_dim] < to [_dim]) \ - break; \ - } \ - \ - /* done if beyond outermost loop */ \ - if (_dim >= vdim) \ - break; \ - \ - /* reset innermost loopers */ \ - for (_dim--; _dim >= 0; _dim--) \ - iterator [_dim] = from [_dim]; \ - _dim = 1; \ - } \ - } \ - else \ - { \ - /* exit loop if array is one-dimensional */ \ - break; \ - } \ - \ - } /* end of nested loops over all dimensions */ \ - \ - outvals [total_outvals++] = (CCTK_REAL) typed_outval; \ - \ - } /* end of loop over num_outvals */ \ - } \ - else \ - { \ - total_outvals += num_outvals; \ - } \ - } - - -#ifdef __cplusplus -extern "C" { -#endif - -int PUGH_ReductionAvgArrays (REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST); -int PUGH_ReductionCountArrays (REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST); -int PUGH_ReductionMaxValArrays (REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST); -int PUGH_ReductionMinValArrays (REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST); -int PUGH_ReductionNorm1Arrays (REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST); -int PUGH_ReductionNorm2Arrays (REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST); -int PUGH_ReductionNorm3Arrays (REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST); -int PUGH_ReductionNorm4Arrays (REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST); -int PUGH_ReductionNormInfArrays (REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST); -int PUGH_ReductionSumArrays (REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST); - -typedef int (*reduction_fn_t) (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*/]); - -int PUGH_ReductionArrays (const cGH *GH, - int proc, - int num_dims, - const int dims[/* num_dims */], - int intype, - int num_inarrays, - const void *const inarrays[/* num_inarrays */], - int outtype, - int num_outvals, - void *outvals /* [num_outvals] */, - reduction_fn_t reduction_fn); - -#ifdef __cplusplus -} -#endif - -#endif |