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-2013 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  CS_ENUMF_(p),
63  CS_ENUMF_(u),
65  CS_ENUMF_(rho),
66  CS_ENUMF_(rho_b),
68  /* End of attributes */
69 
71 
73 
77  int n;
79 };
80 
86 };
87 
88 /*============================================================================
89  * Global variables
90  *============================================================================*/
91 
92 /* Pointers */
93 
95 
96 /*=============================================================================
97  * Public function prototypes
98  *============================================================================*/
99 
100 /*----------------------------------------------------------------------------
101  * Free all field pointer data.
102  *----------------------------------------------------------------------------*/
103 
104 void
106 
107 /*----------------------------------------------------------------------------
108  * Map a simple field to an enumerated pointer.
109  *
110  * The associated field pointer may then be retreived using \ref CS_F_(e).
111  *
112  * parameters:
113  * e <-- field enumerator value
114  * f <-- pointer to field structure
115  *----------------------------------------------------------------------------*/
116 
117 void
119  cs_field_t *f);
120 
121 /*----------------------------------------------------------------------------
122  * Map a field to an (enumerated pointer, index) couple.
123  *
124  * This sort of mapping may be used for sets of fields whose size
125  * is not known in advance.
126  *
127  * The associated field pointer may then be retreived using \ref CS_F_(e, i).
128  *
129  * parameters:
130  * e <-- field enumerator value
131  * index <-- field enumerator index
132  * f <-- pointer to field structure
133  *----------------------------------------------------------------------------*/
134 
135 void
137  int index,
138  cs_field_t *f);
139 
140 /*----------------------------------------------------------------------------*/
144 /*----------------------------------------------------------------------------*/
145 
146 void
148 
149 /*----------------------------------------------------------------------------*/
150 
152 
153 #endif /* __CS_FIELD_POINTER_H__ */