summaryrefslogtreecommitdiff
path: root/src/include/cctk_Interp.h
blob: bc989998f88630e1a37a1c6ded040d18a214729a (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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
 /*@@
   @header    cctk_Interp.h
   @date      July 07 1999
   @author    Thomas Radke
   @desc
              Header file for using interpolation operators
   @enddesc

   @history
   @date      July 07 1999
   @author    Thomas Radke
   @hdesc     Just copied from cctk_Reduction.h

   @date      Thu Feb 21 14:36:02 CET 2002
   @author    Jonathan Thornburg <jthorn@aei.mpg.de>
   @hdesc     add more comments, add new stuff for new interpolator API
   @endhistory

 @@*/


#ifndef _CCTK_INTERP_H_
#define _CCTK_INTERP_H_

#ifdef __cplusplus
extern "C"
{
#endif

/*
 * typedefs for interpolation operator routines
 */
typedef int (*cInterpOperatorGV)(cGH *GH,
                                 const char *coord_system,
                                 int num_points,
                                 int num_in_array_indices,
                                 int num_out_arrays,
                                 const void *const interp_coord_arrays[],
                                 const int interp_coord_array_types[],
                                 const int in_array_indices[],
                                 void *const out_arrays[],
                                 const int out_array_types[]);
typedef int (*cInterpOperatorLocal)(cGH *GH,
                                    int num_points,
                                    int num_dims,
                                    int num_in_arrays,
                                    int num_out_arrays,
                                    const int coord_dims[],
                                    const void *const coord_arrays[],
                                    const int coord_array_types[],
                                    const void *const interp_coord_arrays[],
                                    const int interp_coord_array_types[],
                                    const void *const in_arrays[],
                                    const int in_array_types[],
                                    void *const out_arrays[],
                                    const int out_array_types[]);
typedef int (*cInterpOpLocalUniform)(int N_dims,
                                     int param_table_handle,
                                     /***** coordinate system *****/
                                     const CCTK_REAL coord_origin[],
                                     const CCTK_REAL coord_delta[],
                                     /***** interpolation points *****/
                                     int N_interp_points,
                                     int interp_coords_type_code,
                                     const void *const interp_coords[],
                                     /***** input arrays *****/
                                     int N_input_arrays,
                                     const CCTK_INT input_array_dims[],
                                     const CCTK_INT input_array_type_codes[],
                                     const void *const input_arrays[],
                                     /***** output arrays *****/
                                     int N_output_arrays,
                                     const CCTK_INT output_array_type_codes[],
                                     void *const output_arrays[]);

/*
 * prototypes for user-visible interpolation-registration API
 */
int CCTK_InterpHandle (const char *name);

#define CCTK_InterpRegisterOperatorGV(operator_ptr, operator_name)      \
        CCTKi_InterpRegisterOperatorGV(operator_ptr,                    \
                                       operator_name,                   \
                                       CCTK_THORNSTRING)        /* end macro */
int CCTKi_InterpRegisterOperatorGV(cInterpOperatorGV operator_ptr,
                                   const char *operator_name,
                                   const char *thorn_name);

#define CCTK_InterpRegisterOperatorLocal(operator_ptr, operator_name)   \
        CCTKi_InterpRegisterOperatorLocal(operator_ptr,                 \
                                          operator_name,                \
                                          CCTK_THORNSTRING)     /* end macro */
int CCTKi_InterpRegisterOperatorLocal(cInterpOperatorLocal operator_ptr,
                                      const char *operator_name,
                                      const char *thorn_name);

int CCTK_InterpRegisterOpLocalUniform(cInterpOpLocalUniform operator_ptr,
                                      const char *operator_name,
                                      const char *thorn_name);

const char *CCTK_InterpOperatorImplementation(int handle);
const char *CCTK_InterpOperator(int handle);
int CCTK_NumInterpOperators(void);


/*
 * prototypes for user-visible interpolation API
 */
int CCTK_InterpGV (cGH *GH,
                   int operator_handle,
                   int coord_system_handle,
                   int num_points,
                   int num_in_array_indices,
                   int num_out_arrays,
                   ...);
int CCTK_InterpLocal (cGH *GH,
                      int operator_handle,
                      int num_points,
                      int num_dims,
                      int num_in_arrays,
                      int num_out_arrays,
                      ...);
int CCTK_InterpLocalUniform(int N_dims,
                            int operator_handle,
                            int param_table_handle,
                            /***** coordinate system *****/
                            const CCTK_REAL coord_origin[],
                            const CCTK_REAL coord_delta[],
                            /***** interpolation points *****/
                            int N_interp_points,
                            int interp_coords_type_code,
                            const void *const interp_coords[],
                            /***** input arrays *****/
                            int N_input_arrays,
                            const CCTK_INT input_array_dims[],
                            const CCTK_INT input_array_type_codes[],
                            const void *const input_arrays[],
                            /***** output arrays *****/
                            int N_output_arrays,
                            const CCTK_INT output_array_type_codes[],
                            void *const output_arrays[]);

/*
 * error codes for CCTK_InterpLocalUniform()
 */

/* the grid is too small for the selected interpolation molecule */
#define CCTK_ERROR_INTERP_GRID_TOO_SMALL (-1000)
/* ... old code for backwards compatability */
#define CCTK_ERROR_INTERP_GRID_TOO_TINY  CCTK_ERROR_INTERP_GRID_TOO_SMALL

/*
 * the (multiprocessor) grid's ghostzone size is too small for the selected
 * interpolation molecule (or this processor's chunk of the grid is too small)
 */
#define CCTK_ERROR_INTERP_GHOST_SIZE_TOO_SMALL (-1001)

/*
 * an interpolation point is outside (or too close to an edge of)
 * the input grid
 */
#define CCTK_ERROR_INTERP_POINT_OUTSIDE (-1002)
/* ... old code for backwards compatability */
#define CCTK_ERROR_INTERP_POINT_X_RANGE CCTK_ERROR_INTERP_POINT_OUTSIDE

/* an interpolation point is in (or too close to) an excised region */
#define CCTK_ERROR_INTERP_POINT_EXCISED (-1003)

#ifdef __cplusplus
}
#endif

#endif  /* _INTERP_H_ */