My Project
programmer's documentation
Loading...
Searching...
No Matches
cs_xdef.h
Go to the documentation of this file.
1#ifndef __CS_XDEF_H__
2#define __CS_XDEF_H__
3
4/*============================================================================
5 * Routines to handle extended definitions of quantities (cs_xdef_t structures)
6 *============================================================================*/
7
8/*
9 This file is part of Code_Saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2019 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 <string.h>
35
36#include "cs_base.h"
37#include "cs_boundary_zone.h"
38#include "cs_param.h"
39#include "cs_quadrature.h"
40#include "cs_volume_zone.h"
41
42/*----------------------------------------------------------------------------*/
43
45
46/*============================================================================
47 * Macro definitions
48 *============================================================================*/
49
50/*============================================================================
51 * Type definitions
52 *============================================================================*/
53
95
110typedef enum {
111
112 CS_XDEF_SUPPORT_TIME, /* support for time step description */
113 CS_XDEF_SUPPORT_BOUNDARY, /* zones attached to boundary faces */
115
117
119
172
206
212typedef struct {
213
218 void *input;
219
224
226
232typedef struct {
233
241 void *input;
243
245
246/*============================================================================
247 * Public function prototypes
248 *============================================================================*/
249
250/*----------------------------------------------------------------------------*/
259/*----------------------------------------------------------------------------*/
260
261static inline int
262cs_get_vol_zone_id(const char *z_name)
263{
264 int z_id = 0;
265 if (z_name != NULL) {
266 if (strlen(z_name) > 0) {
267 const cs_zone_t *z = cs_volume_zone_by_name(z_name);
268 z_id = z->id;
269 }
270 }
271 return z_id;
272}
273
274/*----------------------------------------------------------------------------*/
283/*----------------------------------------------------------------------------*/
284
285static inline int
286cs_get_bdy_zone_id(const char *z_name)
287{
288 int z_id = 0;
289 if (z_name != NULL) {
290 if (strlen(z_name) > 0) {
291 const cs_zone_t *z = cs_boundary_zone_by_name(z_name);
292 z_id = z->id;
293 }
294 }
295 return z_id;
296}
297
298/*============================================================================
299 * Public function prototypes
300 *============================================================================*/
301
302/*----------------------------------------------------------------------------*/
316/*----------------------------------------------------------------------------*/
317
318cs_xdef_t *
320 int dim,
321 int z_id,
322 cs_flag_t state,
323 cs_flag_t meta,
324 void *input);
325
326/*----------------------------------------------------------------------------*/
340/*----------------------------------------------------------------------------*/
341
342cs_xdef_t *
344 int dim,
345 int z_id,
346 cs_flag_t state,
347 cs_flag_t meta,
348 void *input);
349
350/*----------------------------------------------------------------------------*/
363/*----------------------------------------------------------------------------*/
364
365cs_xdef_t *
367 cs_flag_t state,
368 cs_flag_t meta,
369 void *input);
370
371/*----------------------------------------------------------------------------*/
379/*----------------------------------------------------------------------------*/
380
381cs_xdef_t *
383
384/*----------------------------------------------------------------------------*/
392/*----------------------------------------------------------------------------*/
393
394cs_xdef_t *
396
397/*----------------------------------------------------------------------------*/
406/*----------------------------------------------------------------------------*/
407
408void
410 bool is_owner,
411 cs_real_t *array);
412
413/*----------------------------------------------------------------------------*/
421/*----------------------------------------------------------------------------*/
422
423void
425 cs_lnum_t *array_index);
426
427/*----------------------------------------------------------------------------*/
435/*----------------------------------------------------------------------------*/
436
437void
440
441/*----------------------------------------------------------------------------*/
450/*----------------------------------------------------------------------------*/
451
454
455/*----------------------------------------------------------------------------*/
463/*----------------------------------------------------------------------------*/
464
467
468/*----------------------------------------------------------------------------*/
476/*----------------------------------------------------------------------------*/
477
480
481/*----------------------------------------------------------------------------*/
488/*----------------------------------------------------------------------------*/
489
490void
491cs_xdef_log(const char *prefix,
492 const cs_xdef_t *d);
493
494/*----------------------------------------------------------------------------*/
495
497
498#endif /* __CS_XDEF_H__ */
const cs_zone_t * cs_boundary_zone_by_name(const char *name)
Return a pointer to a boundary zone based on its name if present.
Definition cs_boundary_zone.c:706
#define BEGIN_C_DECLS
Definition cs_defs.h:467
double cs_real_t
Floating-point value.
Definition cs_defs.h:302
#define END_C_DECLS
Definition cs_defs.h:468
int cs_lnum_t
local mesh entity id
Definition cs_defs.h:298
unsigned short int cs_flag_t
Definition cs_defs.h:304
void() cs_time_func_t(int time_iter, double time, void *input, cs_real_t *retval)
Function which defines the evolution of a quantity according to the number of iteration already done,...
Definition cs_param.h:88
void() cs_analytic_func_t(cs_real_t time, cs_lnum_t n_elts, const cs_lnum_t *elt_ids, const cs_real_t *coords, bool compact, void *input, cs_real_t *retval)
Generic function pointer for an analytic function elt_ids is optional. If not NULL,...
Definition cs_param.h:66
cs_quadrature_type_t
Definition cs_quadrature.h:51
const cs_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:676
cs_quadrature_type_t cs_xdef_get_quadrature(cs_xdef_t *d)
Get the type of quadrature to use for evaluating the given description.
Definition cs_xdef.c:585
static int cs_get_bdy_zone_id(const char *z_name)
Retrieve the boundary zone if from the zone name (If name = NULL or has an empty length,...
Definition cs_xdef.h:286
cs_xdef_type_t cs_xdef_get_type(const cs_xdef_t *d)
Retrieve the flag dedicated to the state.
Definition cs_xdef.c:604
cs_xdef_t * cs_xdef_copy(cs_xdef_t *src)
copy a cs_xdef_t structure
Definition cs_xdef.c:444
static int cs_get_vol_zone_id(const char *z_name)
Retrieve the volume zone if from the zone name (If name = NULL or has an empty length,...
Definition cs_xdef.h:262
cs_xdef_type_t
Definition cs_xdef.h:82
@ CS_XDEF_BY_ANALYTIC_FUNCTION
Definition cs_xdef.h:84
@ CS_XDEF_BY_ARRAY
Definition cs_xdef.h:85
@ CS_XDEF_BY_TIME_FUNCTION
Definition cs_xdef.h:89
@ CS_XDEF_BY_QOV
Definition cs_xdef.h:88
@ CS_N_XDEF_TYPES
Definition cs_xdef.h:92
@ CS_XDEF_BY_FUNCTION
Definition cs_xdef.h:87
@ CS_XDEF_BY_VALUE
Definition cs_xdef.h:90
@ CS_XDEF_BY_FIELD
Definition cs_xdef.h:86
cs_xdef_t * cs_xdef_free(cs_xdef_t *d)
Free a cs_xdef_t structure.
Definition cs_xdef.c:409
void cs_xdef_set_array_index(cs_xdef_t *d, cs_lnum_t *array_index)
In case of definition by array, set the index to get access to the array values.
Definition cs_xdef.c:537
cs_flag_t cs_xdef_get_state_flag(const cs_xdef_t *d)
Retrieve the flag dedicated to the state.
Definition cs_xdef.c:623
cs_xdef_t * cs_xdef_volume_create(cs_xdef_type_t type, int dim, int z_id, cs_flag_t state, cs_flag_t meta, void *input)
Allocate and initialize a new cs_xdef_t structure based on volumic elements.
Definition cs_xdef.c:92
cs_xdef_support_t
Definition cs_xdef.h:110
@ CS_XDEF_SUPPORT_BOUNDARY
Definition cs_xdef.h:113
@ CS_XDEF_SUPPORT_VOLUME
Definition cs_xdef.h:114
@ CS_XDEF_SUPPORT_TIME
Definition cs_xdef.h:112
@ CS_N_XDEF_SUPPORTS
Definition cs_xdef.h:116
void cs_xdef_set_array(cs_xdef_t *d, bool is_owner, cs_real_t *array)
In case of definition by array, set the array after having added this definition.
Definition cs_xdef.c:503
void cs_xdef_log(const char *prefix, const cs_xdef_t *d)
Output the settings related to a cs_xdef_t structure.
Definition cs_xdef.c:641
void cs_xdef_set_quadrature(cs_xdef_t *d, cs_quadrature_type_t qtype)
Set the type of quadrature to use for evaluating the given description.
Definition cs_xdef.c:564
cs_xdef_t * cs_xdef_timestep_create(cs_xdef_type_t type, cs_flag_t state, cs_flag_t meta, void *input)
Allocate and initialize a new cs_xdef_t structure for setting the time step.
Definition cs_xdef.c:346
cs_xdef_t * cs_xdef_boundary_create(cs_xdef_type_t type, int dim, int z_id, cs_flag_t state, cs_flag_t meta, void *input)
Allocate and initialize a new cs_xdef_t structure based on boundary elements.
Definition cs_xdef.c:235
static int input(void)
Input structure when an analytic function is used for the definition.
Definition cs_xdef.h:212
cs_analytic_func_t * func
Definition cs_xdef.h:223
void * input
Definition cs_xdef.h:218
Input structure when an array is used for the definition.
Definition cs_xdef.h:178
cs_lnum_t * index
Definition cs_xdef.h:202
cs_real_t * values
Definition cs_xdef.h:201
bool is_owner
Definition cs_xdef.h:203
cs_flag_t loc
Definition cs_xdef.h:200
int stride
Definition cs_xdef.h:199
Structure storing medata for defining a quantity in a very flexible way.
Definition cs_xdef.h:126
cs_quadrature_type_t qtype
Definition cs_xdef.h:167
cs_flag_t meta
Definition cs_xdef.h:165
cs_xdef_type_t type
Definition cs_xdef.h:160
void * input
Definition cs_xdef.h:169
cs_xdef_support_t support
Definition cs_xdef.h:162
int z_id
Definition cs_xdef.h:161
cs_flag_t state
Definition cs_xdef.h:164
int dim
Definition cs_xdef.h:159
Input structure when a time step function is used for the definition.
Definition cs_xdef.h:232
cs_time_func_t * func
Definition cs_xdef.h:242
void * input
Definition cs_xdef.h:241
Definition cs_zone.h:55
int id
Definition cs_zone.h:59