programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cs_field_pointer.h
Go to the documentation of this file.
1 #ifndef __CS_FIELD_POINTER_H__
2 #define __CS_FIELD_POINTER_H__
3 
4 /*============================================================================
5  * Field pointers and ids for standard and model fields
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2014 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_defs.h"
35 
36 /*----------------------------------------------------------------------------*/
37 
39 
40 /*=============================================================================
41  * Macro definitions
42  *============================================================================*/
43 
44 /* Macro used for scoping of field pointer enums */
45 
46 #define CS_ENUMF_(e) CS_FIELD_POINTER_ ## e
47 
48 /* Macro used to return field a field pointer by its enumerated value */
49 
50 #define CS_F_(e) cs_glob_field_pointers[CS_FIELD_POINTER_ ## e].f
51 
52 #define CS_FI_(e, i) cs_glob_field_pointers[CS_FIELD_POINTER_ ## e].a->p[i]
53 
54 /*============================================================================
55  * Type definitions
56  *============================================================================*/
57 
60 typedef enum {
61 
62  /* Base variables and properties */
63 
64  CS_ENUMF_(dt),
66  CS_ENUMF_(p),
67  CS_ENUMF_(u),
69  CS_ENUMF_(k),
70  CS_ENUMF_(eps),
72  CS_ENUMF_(r11),
73  CS_ENUMF_(r22),
74  CS_ENUMF_(r33),
75  CS_ENUMF_(r12),
76  CS_ENUMF_(r23),
77  CS_ENUMF_(r13),
79  CS_ENUMF_(phi),
80  CS_ENUMF_(f_bar),
81  CS_ENUMF_(alpha),
84  CS_ENUMF_(omg),
85  CS_ENUMF_(nusa),
87  CS_ENUMF_(mesh_u),
89  CS_ENUMF_(h),
90  CS_ENUMF_(t),
91  CS_ENUMF_(energy),
93  CS_ENUMF_(rho),
94  CS_ENUMF_(rho_b),
96  CS_ENUMF_(cp),
98  CS_ENUMF_(mu),
99  CS_ENUMF_(mu_t),
101  CS_ENUMF_(poro),
102  CS_ENUMF_(t_poro),
104  /* Specific physics variables and properties */
105 
106  CS_ENUMF_(t_kelvin),
108  CS_ENUMF_(pot_t),
109  CS_ENUMF_(totwt),
110  CS_ENUMF_(ntdrp),
111  CS_ENUMF_(chemistry),
113  CS_ENUMF_(fm),
114  CS_ENUMF_(fp2m),
116  CS_ENUMF_(fsm),
117  CS_ENUMF_(npm),
118  CS_ENUMF_(ygfm),
120  CS_ENUMF_(yfm),
121  CS_ENUMF_(yfp2m),
122  CS_ENUMF_(coyfp),
124  CS_ENUMF_(np),
125  CS_ENUMF_(xch),
126  CS_ENUMF_(xck),
127  CS_ENUMF_(xwt),
128  CS_ENUMF_(h2),
129  CS_ENUMF_(f1m),
130  CS_ENUMF_(f2m),
131  CS_ENUMF_(f4m),
132  CS_ENUMF_(f5m),
133  CS_ENUMF_(f6m),
134  CS_ENUMF_(f7m),
135  CS_ENUMF_(f8m),
136  CS_ENUMF_(f9m),
137  CS_ENUMF_(fvp2m),
138  CS_ENUMF_(yco2),
139  CS_ENUMF_(yhcn),
140  CS_ENUMF_(yno),
141  CS_ENUMF_(ynh3),
142  CS_ENUMF_(hox),
144  CS_ENUMF_(potr),
145  CS_ENUMF_(poti),
146  CS_ENUMF_(potva),
147  CS_ENUMF_(ycoel),
149  CS_ENUMF_(rad_lumin),
150  CS_ENUMF_(rad_q),
152  CS_ENUMF_(rad_ets),
153  CS_ENUMF_(rad_its),
154  CS_ENUMF_(rad_abs),
155  CS_ENUMF_(rad_emi),
156  CS_ENUMF_(rad_cak),
158  CS_ENUMF_(tparo),
159  CS_ENUMF_(qinci),
160  CS_ENUMF_(xlam),
161  CS_ENUMF_(epa),
162  CS_ENUMF_(emissivity),
163  CS_ENUMF_(fnet),
164  CS_ENUMF_(fconv),
165  CS_ENUMF_(hconv),
167  /* End of attributes */
168 
169  CS_FIELD_N_POINTERS
170 
172 
176  int n;
178 };
179 
185 };
186 
187 /*============================================================================
188  * Global variables
189  *============================================================================*/
190 
191 /* Pointers */
192 
194 
195 /*=============================================================================
196  * Public function prototypes
197  *============================================================================*/
198 
199 /*----------------------------------------------------------------------------
200  * Free all field pointer data.
201  *----------------------------------------------------------------------------*/
202 
203 void
205 
206 /*----------------------------------------------------------------------------
207  * Map a simple field to an enumerated pointer.
208  *
209  * The associated field pointer may then be retreived using \ref CS_F_(e).
210  *
211  * parameters:
212  * e <-- field enumerator value
213  * f <-- pointer to field structure
214  *----------------------------------------------------------------------------*/
215 
216 void
218  cs_field_t *f);
219 
220 /*----------------------------------------------------------------------------
221  * Map a field to an (enumerated pointer, index) couple.
222  *
223  * This sort of mapping may be used for sets of fields whose size
224  * is not known in advance.
225  *
226  * The associated field pointer may then be retreived using \ref CS_F_(e, i).
227  *
228  * parameters:
229  * e <-- field enumerator value
230  * index <-- field enumerator index
231  * f <-- pointer to field structure
232  *----------------------------------------------------------------------------*/
233 
234 void
236  int index,
237  cs_field_t *f);
238 
239 /*----------------------------------------------------------------------------
240  * Map base fields to enumerated pointers.
241  *----------------------------------------------------------------------------*/
242 
243 void
245 
246 /*----------------------------------------------------------------------------
247  * Map base fields to enumerated pointers for atmospheric models
248  *
249  * parameters:
250  * n_chem_species <-- number of chemical species
251  * species_f_if <-- field id for each chemical species
252  *----------------------------------------------------------------------------*/
253 
254 void
255 cs_field_pointer_map_atmospheric(int n_chem_species,
256  const int species_f_id[]);
257 
258 /*----------------------------------------------------------------------------
259  * Map base fields to enumerated pointers for atmospheric models
260  *
261  * parameters:
262  * n_coals <-- number of coals
263  * n_classes <-- number of coal classes
264  *----------------------------------------------------------------------------*/
265 
266 void
268  int n_classes);
269 
270 /*----------------------------------------------------------------------------*
271  * Map base fields to enumerated pointers for compressible model
272  *----------------------------------------------------------------------------*/
273 
274 void
276 
277 /*----------------------------------------------------------------------------
278  * Map base fields to enumerated pointers for electric arcs
279  *
280  * parameters:
281  * n_gasses <-- number of gasses
282  *----------------------------------------------------------------------------*/
283 
284 void
286 
287 /*----------------------------------------------------------------------------
288  * Map base fields to enumerated pointers for gas combustion.
289  *----------------------------------------------------------------------------*/
290 
291 void
293 
294 /*----------------------------------------------------------------------------
295  * Map base fields to enumerated pointers for radiation module
296  *
297  * parameters:
298  * n_r_phases <-- number of radiating phases: 1 + possibly
299  * number of combustible classes (coal, fuel)
300  *----------------------------------------------------------------------------*/
301 
302 void
303 cs_field_pointer_map_radiation(int n_r_phases);
304 
305 /*----------------------------------------------------------------------------*/
306 
308 
309 #endif /* __CS_FIELD_POINTER_H__ */
#define CS_ENUMF_(e)
Definition: cs_field_pointer.h:46
Definition: cs_field_pointer.h:182
void cs_field_pointer_map_base(void)
Field descriptor.
Definition: cs_field.h:98
void cs_field_pointer_destroy_all(void)
#define BEGIN_C_DECLS
Definition: cs_defs.h:405
cs_field_t * f
Definition: cs_field_pointer.h:183
void cs_field_pointer_map_compressible(void)
int n
Definition: cs_field_pointer.h:176
void cs_field_pointer_map_coal_combustion(int n_coals, int n_classes)
void cs_field_pointer_map_electric_arcs(int n_gasses)
void cs_field_pointer_map_indexed(cs_field_pointer_id_t e, int index, cs_field_t *f)
void cs_field_pointer_map(cs_field_pointer_id_t e, cs_field_t *f)
void cs_field_pointer_map_radiation(int n_r_phases)
struct cs_field_pointer_array_t * a
Definition: cs_field_pointer.h:184
Definition: cs_field_pointer.h:175
#define END_C_DECLS
Definition: cs_defs.h:406
cs_field_pointer_id_t
Definition: cs_field_pointer.h:60
void cs_field_pointer_map_atmospheric(int n_chem_species, const int species_f_id[])
cs_field_t * p[]
Definition: cs_field_pointer.h:177
void cs_field_pointer_map_gas_combustion(void)
union cs_field_pointer_val_t * cs_glob_field_pointers