7.0
general documentation
cs_flag.h
Go to the documentation of this file.
1 #ifndef __CS_FLAG_H__
2 #define __CS_FLAG_H__
3 
4 /*============================================================================
5  * Manage the definition/setting of a computation
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2021 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 
62 #define CS_FLAG_BOUNDARY_CELL_BY_FACE (1 << 0)
63 #define CS_FLAG_BOUNDARY_CELL_BY_VERTEX (1 << 1)
64 #define CS_FLAG_BOUNDARY_CELL_BY_EDGE (1 << 2)
65 #define CS_FLAG_SOLID_CELL (1 << 3)
66 
73 #define CS_FLAG_SYS_MASS_MATRIX (1 << 0)
74 #define CS_FLAG_SYS_SYM (1 << 1)
75 #define CS_FLAG_SYS_TIME_DIAG (1 << 2)
76 #define CS_FLAG_SYS_REAC_DIAG (1 << 3)
77 #define CS_FLAG_SYS_SOURCES_HLOC (1 << 4)
78 #define CS_FLAG_SYS_VECTOR (1 << 5)
87 #define CS_FLAG_STATE_UNIFORM (1 << 0)
88 #define CS_FLAG_STATE_CELLWISE (1 << 1)
89 #define CS_FLAG_STATE_FACEWISE (1 << 2)
90 #define CS_FLAG_STATE_STEADY (1 << 3)
91 #define CS_FLAG_STATE_POTENTIAL (1 << 4)
92 #define CS_FLAG_STATE_CIRCULATION (1 << 5)
93 #define CS_FLAG_STATE_FLUX (1 << 6)
94 #define CS_FLAG_STATE_DENSITY (1 << 7)
95 #define CS_FLAG_STATE_OWNER (1 << 8)
104 #define CS_FLAG_FULL_LOC (1 << 0)
105 #define CS_FLAG_SCALAR (1 << 1)
106 #define CS_FLAG_VECTOR (1 << 2)
107 #define CS_FLAG_TENSOR (1 << 3)
108 #define CS_FLAG_VERTEX (1 << 4)
109 #define CS_FLAG_EDGE (1 << 5)
110 #define CS_FLAG_FACE (1 << 6)
111 #define CS_FLAG_CELL (1 << 7)
112 #define CS_FLAG_PRIMAL (1 << 8)
113 #define CS_FLAG_DUAL (1 << 9)
114 #define CS_FLAG_BORDER (1 << 10)
115 #define CS_FLAG_BY_CELL (1 << 11)
116 #define CS_FLAG_BY_FACE (1 << 12)
128 #define CS_FLAG_SCHEME_SCALAR (1 << 0)
129 #define CS_FLAG_SCHEME_VECTOR (1 << 1)
130 #define CS_FLAG_SCHEME_NAVSTO (1 << 2)
131 #define CS_FLAG_SCHEME_POLY0 (1 << 3)
132 #define CS_FLAG_SCHEME_POLY1 (1 << 4)
133 #define CS_FLAG_SCHEME_POLY2 (1 << 5)
139 /*============================================================================
140  * Type definitions
141  *============================================================================*/
142 
143 typedef unsigned char cs_mask_t; /* Elementary flag */
144 
145 /*============================================================================
146  * Global variables
147  *============================================================================*/
148 
149 /* Default locations */
150 extern const cs_flag_t cs_flag_primal_vtx;
151 extern const cs_flag_t cs_flag_primal_edge;
152 extern const cs_flag_t cs_flag_primal_face;
153 extern const cs_flag_t cs_flag_primal_cell;
154 extern const cs_flag_t cs_flag_dual_vtx;
155 extern const cs_flag_t cs_flag_dual_face;
156 extern const cs_flag_t cs_flag_dual_cell;
157 extern const cs_flag_t cs_flag_dual_face_byc;
158 
159 /* Part of dual cell closure belonging to a boundary primal face */
161 
162 /* According to the extended flag defined below one can identify which set of
163  * quantities or connectivities have to be built on-the-fly and stored in a
164  * local structure possibly owned by each thread and with a cellwise scope */
165 
166 typedef unsigned int cs_eflag_t;
167 
168 /* Store predefined flags */
169 extern const cs_eflag_t cs_flag_need_v;
170 extern const cs_eflag_t cs_flag_need_e;
171 extern const cs_eflag_t cs_flag_need_f;
172 extern const cs_eflag_t cs_flag_need_fe;
173 extern const cs_eflag_t cs_flag_need_ef;
174 extern const cs_eflag_t cs_flag_need_peq;
175 extern const cs_eflag_t cs_flag_need_dfq;
176 extern const cs_eflag_t cs_flag_need_pfq;
177 extern const cs_eflag_t cs_flag_need_deq;
178 extern const cs_eflag_t cs_flag_need_pfc;
179 
180 typedef enum {
181 
182  /* Compute simple and cellwise information for vertices */
183  CS_FLAG_COMP_PV = 1 << 0, /* = 1 */
184 
185  /* Compute cellwise quantities for vertices */
186  CS_FLAG_COMP_PVQ = 1 << 1, /* = 2 */
187 
188  /* Compute simple and cellwise information for edges */
189  CS_FLAG_COMP_PE = 1 << 2, /* = 4 */
190 
191  /* Compute cellwise quantities for edges */
192  CS_FLAG_COMP_PEQ = 1 << 3, /* = 8 */
193 
194  /* Compute cellwise quantities for dual faces (associated to edges) */
195  CS_FLAG_COMP_DFQ = 1 << 4, /* = 16 */
196 
197  /* Compute simple and cellwise information for faces */
198  CS_FLAG_COMP_PF = 1 << 5, /* = 32 */
199 
200  /* Compute cellwise quantities for faces */
201  CS_FLAG_COMP_PFQ = 1 << 6, /* = 64 */
202 
203  /* Compute cellwise quantities for dual edges (associated to faces) */
204  CS_FLAG_COMP_DEQ = 1 << 7, /* = 128 */
205 
206  /* Compute the cellwise connectivity edge to vertices */
207  CS_FLAG_COMP_EV = 1 << 8, /* = 256 */
208 
209  /* Compute cellwise connectivity face to edges */
210  CS_FLAG_COMP_FE = 1 << 9, /* = 512 */
211 
212  /* Compute cellwise quantities associated to the couple (face, edge) */
213  CS_FLAG_COMP_FEQ = 1 << 10, /* = 1024 */
214 
215  /* Compute cellwise connectivity face to vertices */
216  CS_FLAG_COMP_FV = 1 << 11, /* = 2048 */
217 
218  /* Compute cellwise connectivity edge to faces */
219  CS_FLAG_COMP_EF = 1 << 12, /* = 4096 */
220 
221  /* Compute elemental portion of dual faces associated to the couple
222  (edge, face) */
223  CS_FLAG_COMP_SEF = 1 << 13, /* = 8192 */
224 
225  /* Compute cellwise quantities related to the height of the pyramid with
226  basis spanned by a face and with apex the cell center */
227  CS_FLAG_COMP_HFQ = 1 << 14, /* = 16384 */
228 
229  /* Compute cellwise orientation of oriented edges belonging to a face */
230  CS_FLAG_COMP_FES = 1 << 15, /* = 32768 */
231 
232  /* Compute cellwise quantities related to the volume of the pyramid with
233  basis spanned by a face and with apex the cell center */
234  CS_FLAG_COMP_PFC = 1 << 16, /* = 65536 */
235 
236  /* Compute cellwise quantities related to the volume surrounding an edge */
237  CS_FLAG_COMP_PEC = 1 << 17, /* = 131072 */
238 
239  /* Compute cellwise diameters */
240  CS_FLAG_COMP_DIAM = 1 << 18, /* = 262144 */
241 
243 
244 /*============================================================================
245  * Public function prototypes
246  *============================================================================*/
247 
248 /*----------------------------------------------------------------------------*/
259 /*----------------------------------------------------------------------------*/
260 
261 static inline bool
262 cs_flag_test(cs_flag_t flag_to_check,
263  cs_flag_t reference)
264 {
265  if ((flag_to_check & reference) == reference)
266  return true;
267  else
268  return false;
269 }
270 
271 /*----------------------------------------------------------------------------*/
282 /*----------------------------------------------------------------------------*/
283 
284 static inline bool
285 cs_flag_at_least(cs_flag_t flag_to_check,
286  int n_masks,
287  cs_flag_t masks[])
288 {
289  for (int i = 0; i < n_masks; i++)
290  if ((flag_to_check & masks[i]) == masks[i])
291  return true;
292  return false;
293 }
294 
295 /*----------------------------------------------------------------------------*/
307 /*----------------------------------------------------------------------------*/
308 
309 static inline bool
310 cs_eflag_test(cs_eflag_t flag_to_check,
311  cs_eflag_t reference)
312 {
313  if ((flag_to_check & reference) == reference)
314  return true;
315  else
316  return false;
317 }
318 
319 /*----------------------------------------------------------------------------*/
325 /*----------------------------------------------------------------------------*/
326 
327 const char *
329 
330 /*----------------------------------------------------------------------------*/
331 
333 
334 #endif /* __CS_FLAG_H__ */
Definition: cs_flag.h:223
Definition: cs_flag.h:201
Definition: cs_flag.h:216
unsigned char cs_mask_t
Definition: cs_flag.h:143
const char * cs_flag_str_location(cs_flag_t loc)
Retrieve the label associated to a location flag.
Definition: cs_flag.c:115
Definition: cs_flag.h:198
#define BEGIN_C_DECLS
Definition: cs_defs.h:495
const cs_flag_t cs_flag_dual_cell
Definition: cs_flag.c:60
Definition: cs_flag.h:237
const cs_flag_t cs_flag_primal_cell
Definition: cs_flag.c:56
Definition: cs_flag.h:234
Definition: cs_flag.h:207
Definition: cs_flag.h:189
const cs_eflag_t cs_flag_need_e
Definition: cs_flag.c:75
const cs_eflag_t cs_flag_need_pfq
Definition: cs_flag.c:90
Definition: cs_flag.h:219
const cs_flag_t cs_flag_dual_face_byc
Definition: cs_flag.c:61
const cs_eflag_t cs_flag_need_deq
Definition: cs_flag.c:93
Definition: cs_flag.h:192
const cs_flag_t cs_flag_dual_face
Definition: cs_flag.c:59
const cs_eflag_t cs_flag_need_pfc
Definition: cs_flag.c:95
const cs_flag_t cs_flag_primal_face
Definition: cs_flag.c:55
Definition: cs_flag.h:227
Definition: cs_flag.h:204
const cs_flag_t cs_flag_dual_closure_byf
Definition: cs_flag.c:63
const cs_flag_t cs_flag_primal_vtx
Definition: cs_flag.c:53
const cs_eflag_t cs_flag_need_peq
Definition: cs_flag.c:86
Definition: cs_flag.h:210
const cs_eflag_t cs_flag_need_f
Definition: cs_flag.c:78
const cs_flag_t cs_flag_primal_edge
Definition: cs_flag.c:54
#define END_C_DECLS
Definition: cs_defs.h:496
unsigned short int cs_flag_t
Definition: cs_defs.h:309
Definition: cs_flag.h:240
Definition: cs_flag.h:230
unsigned int cs_eflag_t
Definition: cs_flag.h:166
const cs_eflag_t cs_flag_need_fe
Definition: cs_flag.c:82
cs_flag_comp_bits_t
Definition: cs_flag.h:180
const cs_eflag_t cs_flag_need_ef
Definition: cs_flag.c:84
Definition: cs_flag.h:183
Definition: cs_flag.h:186
const cs_eflag_t cs_flag_need_v
Definition: cs_flag.c:73
Definition: cs_flag.h:213
const cs_eflag_t cs_flag_need_dfq
Definition: cs_flag.c:88
const cs_flag_t cs_flag_dual_vtx
Definition: cs_flag.c:57
Definition: cs_flag.h:195