summaryrefslogtreecommitdiff
path: root/src/include/cctk_Reduction.h
blob: 78a395b97661192ae4362eddbbc88e5439ddbebc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
 /*@@
   @header    cctk_Reduction.h
   @date      
   @author    Gabrielle Allen
   @desc 
   Header file for using reduction operators
   @enddesc 
   @version $Header$
 @@*/

#ifndef _CCTK_REDUCTION_H_
#define _CCTK_REDUCTION_H_

#define REDUCTION_OPERATOR_REGISTER_ARGLIST  \
          cGH *arg_GH, \
          int arg_proc, \
          int arg_num_outvals, \
          int arg_outtype, \
          void *arg_outvals, \
          int arg_num_invars, \
          int arg_varlist []


#define REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST \
  cGH *arg_GH, \
  int arg_proc, \
  int arg_nDims, \
  int arg_dims [], \
  int arg_nArrays, \
  void *arg_inArrays [], \
  int arg_inType, \
  int arg_nOutVals, \
  void *arg_outVals, \
  int arg_outType

#ifdef __cplusplus
extern "C" 
{
#endif

/* prototype for reduction operator routine */
typedef int (*cReduceOperator) (cGH *GH,
				int arg_proc, 
				int arg_num_outvals, 
				int arg_outtype, 
				void *arg_outvals, 
				int arg_num_invars, 
				int arg_varlist[]);

int CCTK_Reduce(cGH *GH,
                int proc,
                int operation_handle,
                int num_out_vals,
                int type_out_vals,
                void *out_vals,
                int num_in_fields, ...);

int CCTK_ReductionHandle(const char *reduction);

#define CCTK_RegisterReductionOperator(a,b) \
        CCTKi_RegisterReductionOperator(CCTK_THORNSTRING,a,b) 

int CCTKi_RegisterReductionOperator(const char *thorn,
				    cReduceOperator operatorGV,
				    const char *name);

int CCTK_ReductionArrayHandle(const char *reduction);

int CCTK_RegisterReductionArrayOperator(
         int (*function)(REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST),
         const char *name);

const char *CCTK_ReduceOperatorImplementation(int handle);

const char *CCTK_ReduceOperator (int handle);

int CCTK_NumReduceOperators(void);

/* FIXME: old interface - should go */
int CCTK_ReduceLocalScalar (cGH *GH, int proc, int operation_handle,
                            void *inScalar, void *outScalar, int dataType);


/* FIXME: old interface - should go */
int CCTK_ReduceLocalArray1D (cGH *GH, int proc, int operation_handle,
                            void *in_array1d, void *out_array1d, 
                            int num_in_array1d, int data_type);

int CCTK_ReduceLocScalar(cGH *GH, int proc, int operation_handle,
                         void *in_scalar, void *out_scalar, int data_type);

int CCTK_ReduceLocArrayToArray1D(cGH *GH, int proc, int operation_handle,
                                 void *in_array1d, void *out_array1d, 
                                 int num_in_array1d,
                                 int data_type);

int CCTK_ReduceLocArrayToArray2D(cGH *GH, int proc, int operation_handle,
                                 void *in_array2d, void *out_array2d, 
                                 int xsize, int ysize,
                                 int data_type);

int CCTK_ReduceLocArrayToArray3D(cGH *GH, int proc, int operation_handle,
                                 void *in_array3d, void *out_array3d, 
                                 int xsize, int  ysize, int zsize,
                                 int data_type);


int CCTK_ReduceArray(cGH *GH,
                     int proc,
                     int operation_handle,
                     int num_out_vals,
                     int type_out_vals,
                     void *out_vals,
                     int num_dims,
                     int num_in_arrays,
                     int type_in_arrays,
                     ... );

#ifdef __cplusplus
}
#endif

#endif /* _CCTK_REDUCTION_H_ */