programmer's documentation
cs_volume_zone.h
Go to the documentation of this file.
1 #ifndef __CS_VOLUME_ZONE_H__
2 #define __CS_VOLUME_ZONE_H__
3 
4 /*============================================================================
5  * Volume zones handling.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2018 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  * Standard C library headers
32  *----------------------------------------------------------------------------*/
33 
34 /*----------------------------------------------------------------------------
35  * Local headers
36  *----------------------------------------------------------------------------*/
37 
38 #include "cs_base.h"
39 #include "cs_mesh_location.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
55 /*
56  * Zone type
57  */
58 
60 #define CS_VOLUME_ZONE_INITIALIZATION (1 << 0)
61 
63 #define CS_VOLUME_ZONE_POROSITY (1 << 1)
64 
66 #define CS_VOLUME_ZONE_HEAD_LOSS (1 << 2)
67 
69 #define CS_VOLUME_ZONE_SOURCE_TERM (1 << 3)
70 
72 #define CS_VOLUME_ZONE_MASS_SOURCE_TERM (1 << 4)
73 
76 /*============================================================================
77  * Type definitions
78  *============================================================================*/
79 
82 typedef struct {
83 
84  const char *name;
86  int id;
87  int type;
95  bool time_varying;
101 
102 /*=============================================================================
103  * Global variables
104  *============================================================================*/
105 
106 /*============================================================================
107  * Public function prototypes
108  *============================================================================*/
109 
110 /*----------------------------------------------------------------------------*/
118 /*----------------------------------------------------------------------------*/
119 
120 void
122 
123 /*----------------------------------------------------------------------------*/
127 /*----------------------------------------------------------------------------*/
128 
129 void
131 
132 /*----------------------------------------------------------------------------*/
136 /*----------------------------------------------------------------------------*/
137 
138 int
140 
141 /*----------------------------------------------------------------------------*/
147 /*----------------------------------------------------------------------------*/
148 
149 int
151 
152 /*----------------------------------------------------------------------------*/
160 /*----------------------------------------------------------------------------*/
161 
162 void
163 cs_volume_zone_build_all(bool mesh_modified);
164 
165 /*----------------------------------------------------------------------------*/
175 /*----------------------------------------------------------------------------*/
176 
177 int
178 cs_volume_zone_define(const char *name,
179  const char *criteria,
180  int type_flag);
181 
182 /*----------------------------------------------------------------------------*/
200 /*----------------------------------------------------------------------------*/
201 
202 int
203 cs_volume_zone_define_by_func(const char *name,
205  void *input,
206  int type_flag);
207 
208 /*----------------------------------------------------------------------------*/
218 /*----------------------------------------------------------------------------*/
219 
220 const cs_volume_zone_t *
221 cs_volume_zone_by_id(int id);
222 
223 /*----------------------------------------------------------------------------*/
233 /*----------------------------------------------------------------------------*/
234 
235 const cs_volume_zone_t *
236 cs_volume_zone_by_name(const char *name);
237 
238 /*----------------------------------------------------------------------------*/
248 /*----------------------------------------------------------------------------*/
249 
250 const cs_volume_zone_t *
251 cs_volume_zone_by_name_try(const char *name);
252 
253 /*----------------------------------------------------------------------------*/
260 /*----------------------------------------------------------------------------*/
261 
262 void
264  bool type_flag);
265 
266 /*----------------------------------------------------------------------------*/
273 /*----------------------------------------------------------------------------*/
274 
275 void
277  bool time_varying);
278 
279 /*----------------------------------------------------------------------------*/
286 /*----------------------------------------------------------------------------*/
287 
288 void
290  bool allow_overlay)
291 ;
292 /*----------------------------------------------------------------------------*/
299 /*----------------------------------------------------------------------------*/
300 
301 const int *
303 
304 /*----------------------------------------------------------------------------*/
310 /*----------------------------------------------------------------------------*/
311 
312 void
314 
315 /*----------------------------------------------------------------------------*/
319 /*----------------------------------------------------------------------------*/
320 
321 void
323 
324 /*----------------------------------------------------------------------------*/
333 /*----------------------------------------------------------------------------*/
334 
335 cs_lnum_t
336 cs_volume_zone_n_type_zones(int type_flag);
337 
338 /*----------------------------------------------------------------------------*/
350 /*----------------------------------------------------------------------------*/
351 
352 cs_lnum_t
353 cs_volume_zone_n_type_cells(int type_flag);
354 
355 /*----------------------------------------------------------------------------*/
366 /*----------------------------------------------------------------------------*/
367 
368 void
370  cs_lnum_t cell_ids[]);
371 
372 /*----------------------------------------------------------------------------*/
373 
375 
376 #endif /* __CS_VOLUME_ZONE_H__ */
bool allow_overlay
Definition: cs_volume_zone.h:97
void cs_volume_zone_log_info(const cs_volume_zone_t *z)
Print info relative to a given volume zone to log file.
Definition: cs_volume_zone.c:727
int cs_volume_zone_define_by_func(const char *name, cs_mesh_location_select_t *func, void *input, int type_flag)
Define a new mesh location with an associated selection function.
Definition: cs_volume_zone.c:553
const cs_lnum_t * cell_ids
Definition: cs_volume_zone.h:92
void cs_volume_zone_log_setup(void)
Log setup information relative to defined volume zones.
Definition: cs_volume_zone.c:774
void() cs_mesh_location_select_t(void *input, const cs_mesh_t *m, int location_id, cs_lnum_t *n_elts, cs_lnum_t **elt_ids)
Definition: cs_mesh_location.h:94
#define BEGIN_C_DECLS
Definition: cs_defs.h:451
void cs_volume_zone_select_type_cells(int type_flag, cs_lnum_t cell_ids[])
Select cells associated with volume zones of a given type.
Definition: cs_volume_zone.c:853
const cs_volume_zone_t * cs_volume_zone_by_id(int id)
Return a pointer to a volume zone based on its id.
Definition: cs_volume_zone.c:588
const int * cs_volume_zone_cell_zone_id(void)
Return pointer to zone id associated with each cell.
Definition: cs_volume_zone.c:713
int cs_volume_zone_define(const char *name, const char *criteria, int type_flag)
Define a new volume zone using a selection criteria string.
Definition: cs_volume_zone.c:509
void cs_volume_zone_set_overlay(int id, bool allow_overlay)
Set overlay behavior for a given volume zone.
Definition: cs_volume_zone.c:695
cs_lnum_t cs_volume_zone_n_type_cells(int type_flag)
Return number of volume zone cells associated with a given zone flag.
Definition: cs_volume_zone.c:827
void cs_volume_zone_set_type(int id, bool type_flag)
Set type flag for a given volume zone.
Definition: cs_volume_zone.c:659
void cs_volume_zone_finalize(void)
Free all volume zone structures.
Definition: cs_volume_zone.c:345
cs_lnum_t cs_volume_zone_n_type_zones(int type_flag)
Return number of volume zones associated with a given zone flag.
Definition: cs_volume_zone.c:800
cs_lnum_t n_cells
Definition: cs_volume_zone.h:91
const char * name
Definition: cs_volume_zone.h:84
const cs_volume_zone_t * cs_volume_zone_by_name(const char *name)
Return a pointer to a volume zone based on its name if present.
Definition: cs_volume_zone.c:612
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:293
int id
Definition: cs_volume_zone.h:86
void cs_volume_zone_initialize(void)
Initialize volume zone structures.
Definition: cs_volume_zone.c:319
#define END_C_DECLS
Definition: cs_defs.h:452
bool time_varying
Definition: cs_volume_zone.h:95
void cs_volume_zone_set_time_varying(int id, bool time_varying)
Set time varying behavior for a given volume zone.
Definition: cs_volume_zone.c:677
int type
Definition: cs_volume_zone.h:87
int cs_volume_zone_n_zones(void)
Return number of volume zones defined.
Definition: cs_volume_zone.c:369
Definition: cs_volume_zone.h:82
const cs_volume_zone_t * cs_volume_zone_by_name_try(const char *name)
Return a pointer to a volume zone based on its name if present.
Definition: cs_volume_zone.c:638
int location_id
Definition: cs_volume_zone.h:89
int cs_volume_zone_n_zones_time_varying(void)
Return number of volume zones which may vary in time.
Definition: cs_volume_zone.c:383
void cs_volume_zone_build_all(bool mesh_modified)
Update association of volume zones with a mesh.
Definition: cs_volume_zone.c:406