Streamer fluid modeling - An overview of ARCoS  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mapper.h
Go to the documentation of this file.
1 
15 #ifndef _MAPPER_H_
16 
17 typedef struct mapper_t mapper_t;
18 
19 #ifndef _INTERPOL2_H_
20 # include "interpol2.h"
21 #endif
22 
23 #define _coarsen_params_ (mapper_t *mapper, grid_t *source, grid_t *target, \
24  int ir, int iz, int itheta)
25 #define _copy_params_ (mapper_t *mapper, grid_t *source, grid_t *target, \
26  int ir, int iz, int itheta)
27 #define _interpol_set_params_ (mapper_t *mapper, grid_t *source, \
28  interpol_t *interpol, int ir, \
29  int iz, int itheta)
30 #define _interpol_params_ (mapper_t *mapper, grid_t *source, grid_t *target, \
31  interpol_t *interpol, int ir, int iz, int itheta)
32 
33 
34 struct mapper_t {
36 
37  void (*coarsen) _coarsen_params_;
38  void (*copy) _copy_params_;
39  /* may return false if we are outside the source grid. */
40  int (*interpol_set) _interpol_set_params_;
41 
42  void (*interpol) _interpol_params_;
43 
44  /* This is used for the interpolation of electric fields and indicates
45  * the staggering of the cells. When we call the interpolator to set
46  * the stencil at coordinates pr, pz, the fine-grid cells whose value will
47  * later be calculated ir, iz with
48  * pr << level_diff + shift_r << (level_diff - 1) <= ir
49  * < pr << level_diff + shift_r << (level_diff - 1)
50  *
51  * (and the equivalent for iz).
52  * Hence note that for interpolation in not-staggered grids,
53  * (i.e. charge, densities, ...)
54  * shift_r = shift_z = 0.
55  */
57 
58  /* We provide this extra member to allow the easy creation of different
59  * mappers that share the same functions but have a slightly different
60  * behaviour. In particular this is used in cdr.c to define
61  * different interpolators for each species. In that case, extra is the
62  * species index.
63  */
64  int extra;
65 };
66 
67 
71 #define decl_mapper_funcs(_VAR) \
72  void _VAR ## _coarsen _coarsen_params_; \
73  void _VAR ## _copy _copy_params_; \
74  int _VAR ## _interpol_set _interpol_set_params_; \
75  void _VAR ## _interpol _interpol_params_
76 
78 #define mk_mapper_staggered(_C, _INTERPOL_METHOD, _SHIFT_R, _SHIFT_Z) \
79  {_INTERPOL_METHOD, _C ## _coarsen, _C ## _copy, \
80  _C ## _interpol_set, _C ##_interpol, _SHIFT_R, _SHIFT_Z, 0}
81 
83 #define mk_mapper(_C, _INTERPOL_METHOD) \
84  mk_mapper_staggered (_C, _INTERPOL_METHOD, 0, 0)
85 
87 #define mk_mapper_down(_C, _INTERPOL_METHOD) \
88  {_INTERPOL_METHOD, NULL, _C ## _copy, \
89  _C ## _interpol_set, _C ##_interpol, 0, 0, 0}
90 
91 #define _MAPPER_H_
92 #endif