programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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-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  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_base.h"
35 #include "cs_cdo.h"
36 #include "cs_quadrature.h"
37 
38 /*----------------------------------------------------------------------------*/
39 
41 
42 /*============================================================================
43  * Macro definitions
44  *============================================================================*/
45 
46 /*============================================================================
47  * Type definitions
48  *============================================================================*/
49 
50 typedef enum {
51 
60 
62 
63 typedef enum {
64 
65  CS_XDEF_SUPPORT_TIME, /* support for time step description */
66  CS_XDEF_SUPPORT_BOUNDARY, /* zones attached to boundary faces */
67  CS_XDEF_SUPPORT_VOLUME, /* zones attached to cells */
69 
71 
72 typedef struct {
73 
74  int dim; /* dimension of the values attached to
75  this description */
76  cs_xdef_type_t type; /* type of definition */
77 
78  int z_id; /* zone id related to this definition */
79  cs_xdef_support_t support; /* support for this definition */
80 
81  cs_flag_t state; /* steady, uniform, cellwise... */
82  cs_flag_t meta; /* Metadata about the descitption. These
83  metadata may vary according to the object
84  on which the description applies */
85  cs_quadrature_type_t qtype; /* type of quadrature to use for evaluating
86  the description */
87 
88  void *input; /* pointer to metadat to complete
89  the description */
90 
91 } cs_xdef_t;
92 
93 /* Input structure when an array is used for the definition */
94 typedef struct {
95 
96  int stride; /* array stride */
97  cs_flag_t loc; /* flag to know where are defined array values */
98  cs_real_t *values; /* array values */
99  const cs_lnum_t *index; /* optional index for accessing to the values */
100 
102 
103 /* Input structure when an analytic function is used for the definition */
104 typedef struct {
105 
106  void *input; // NULL or pointer to a structure cast on-the-fly
107  cs_analytic_func_t *func; // function to call
108 
110 
111 /* Input structure when an analytic function is used for the definition */
112 typedef struct {
113 
114  void *input; // NULL or pointer to a structure cast on-the-fly
115  cs_timestep_func_t *func; // function to call
116 
118 
119 /*============================================================================
120  * Public function prototypes
121  *============================================================================*/
122 
123 /*----------------------------------------------------------------------------*/
137 /*----------------------------------------------------------------------------*/
138 
139 cs_xdef_t *
141  int dim,
142  int z_id,
143  cs_flag_t state,
144  cs_flag_t meta,
145  void *input);
146 
147 /*----------------------------------------------------------------------------*/
161 /*----------------------------------------------------------------------------*/
162 
163 cs_xdef_t *
165  int dim,
166  int z_id,
167  cs_flag_t state,
168  cs_flag_t meta,
169  void *input);
170 
171 /*----------------------------------------------------------------------------*/
186 /*----------------------------------------------------------------------------*/
187 
188 cs_xdef_t *
190  cs_flag_t state,
191  cs_flag_t meta,
192  void *input);
193 
194 /*----------------------------------------------------------------------------*/
202 /*----------------------------------------------------------------------------*/
203 
204 cs_xdef_t *
206 
207 /*----------------------------------------------------------------------------*/
215 /*----------------------------------------------------------------------------*/
216 
217 void
219  cs_quadrature_type_t qtype);
220 
221 /*----------------------------------------------------------------------------*/
230 /*----------------------------------------------------------------------------*/
231 
234 
235 /*----------------------------------------------------------------------------*/
243 /*----------------------------------------------------------------------------*/
244 
246 cs_xdef_get_type(const cs_xdef_t *d);
247 
248 /*----------------------------------------------------------------------------*/
256 /*----------------------------------------------------------------------------*/
257 
258 cs_flag_t
260 
261 /*----------------------------------------------------------------------------*/
267 /*----------------------------------------------------------------------------*/
268 
269 void
271 
272 /*----------------------------------------------------------------------------*/
273 
275 
276 #endif /* __CS_XDEF_H__ */
int z_id
Definition: cs_xdef.h:78
cs_flag_t state
Definition: cs_xdef.h:81
Definition: cs_xdef.h:67
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:439
void * input
Definition: cs_xdef.h:106
cs_xdef_t * cs_xdef_free(cs_xdef_t *d)
Free a cs_xdef_t structure.
Definition: cs_xdef.c:383
cs_xdef_support_t support
Definition: cs_xdef.h:79
void * input
Definition: cs_xdef.h:88
const cs_lnum_t * index
Definition: cs_xdef.h:99
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:96
void * input
Definition: cs_xdef.h:114
cs_timestep_func_t * func
Definition: cs_xdef.h:115
#define BEGIN_C_DECLS
Definition: cs_defs.h:453
Definition: cs_xdef.h:94
cs_real_t * values
Definition: cs_xdef.h:98
cs_xdef_type_t cs_xdef_get_type(const cs_xdef_t *d)
Retrieve the flag dedicated to the state.
Definition: cs_xdef.c:458
Definition: cs_xdef.h:57
Definition: cs_xdef.h:54
Definition: cs_xdef.h:55
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:209
cs_flag_t cs_xdef_get_state_flag(const cs_xdef_t *d)
Retrieve the flag dedicated to the state.
Definition: cs_xdef.c:477
double cs_real_t
Floating-point value.
Definition: cs_defs.h:297
cs_xdef_support_t
Definition: cs_xdef.h:63
cs_quadrature_type_t
Definition: cs_quadrature.h:48
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:418
int dim
Definition: cs_xdef.h:74
cs_analytic_func_t * func
Definition: cs_xdef.h:107
cs_xdef_type_t
Definition: cs_xdef.h:50
cs_flag_t loc
Definition: cs_xdef.h:97
Definition: cs_xdef.h:53
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:320
cs_flag_t meta
Definition: cs_xdef.h:82
Definition: cs_xdef.h:72
Definition: cs_xdef.h:56
int stride
Definition: cs_xdef.h:96
Definition: cs_xdef.h:68
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, it enables to access in coords at the right location and the same thing to fill retval if compact is set to false.
Definition: cs_cdo.h:169
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:293
#define END_C_DECLS
Definition: cs_defs.h:454
unsigned short int cs_flag_t
Definition: cs_defs.h:299
Definition: cs_xdef.h:52
Definition: cs_xdef.h:104
cs_xdef_type_t type
Definition: cs_xdef.h:76
Definition: cs_xdef.h:66
cs_real_t( cs_timestep_func_t)(int time_iter, double time, void *input)
Function which defines the time step according to the number of iteration already done...
Definition: cs_cdo.h:192
Definition: cs_xdef.h:59
Definition: cs_xdef.h:58
void cs_xdef_log(cs_xdef_t *d)
Output the settings related to a a cs_xdef_t structure.
Definition: cs_xdef.c:494
cs_quadrature_type_t qtype
Definition: cs_xdef.h:85
Definition: cs_xdef.h:65
Definition: cs_xdef.h:112