programmer's documentation
cs_property.h
Go to the documentation of this file.
1 #ifndef __CS_PROPERTY_H__
2 #define __CS_PROPERTY_H__
3 
4 /*============================================================================
5  * Manage the definition/setting of properties
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2015 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_cdo.h"
35 #include "cs_param.h"
36 #include "cs_cdo_connect.h"
37 #include "cs_cdo_quantities.h"
38 #include "cs_time_step.h"
39 
40 /*----------------------------------------------------------------------------*/
41 
43 
44 /*============================================================================
45  * Macro definitions
46  *============================================================================*/
47 
48 /*============================================================================
49  * Type definitions
50  *============================================================================*/
51 
52 /* Type of property considered */
53 typedef enum {
54 
55  CS_PROPERTY_ISO, // isotropic
56  CS_PROPERTY_ORTHO, // orthotropic
57  CS_PROPERTY_ANISO, // anisotropic
59 
61 
62 typedef struct _cs_property_t cs_property_t;
63 
64 /*============================================================================
65  * Global variables
66  *============================================================================*/
67 
68 /*============================================================================
69  * Public function prototypes
70  *============================================================================*/
71 
72 /*----------------------------------------------------------------------------*/
84 /*----------------------------------------------------------------------------*/
85 
86 cs_property_t *
87 cs_property_create(const char *name,
88  const char *key_type,
89  const cs_cdo_quantities_t *cdoq,
90  const cs_cdo_connect_t *connect,
91  const cs_time_step_t *time_step);
92 
93 /*----------------------------------------------------------------------------*/
101 /*----------------------------------------------------------------------------*/
102 
103 cs_property_t *
104 cs_property_free(cs_property_t *pty);
105 
106 /*----------------------------------------------------------------------------*/
115 /*----------------------------------------------------------------------------*/
116 
117 bool
118 cs_property_check_name(const cs_property_t *pty,
119  const char *ref_name);
120 
121 /*----------------------------------------------------------------------------*/
129 /*----------------------------------------------------------------------------*/
130 
131 bool
132 cs_property_is_uniform(const cs_property_t *pty);
133 
134 /*----------------------------------------------------------------------------*/
142 /*----------------------------------------------------------------------------*/
143 
144 const char *
145 cs_property_get_name(const cs_property_t *pty);
146 
147 /*----------------------------------------------------------------------------*/
153 /*----------------------------------------------------------------------------*/
154 
155 void
156 cs_property_summary(const cs_property_t *pty);
157 
158 //*----------------------------------------------------------------------------*/
165 /*----------------------------------------------------------------------------*/
166 
167 void
168 cs_property_set_value(cs_property_t *pty,
169  const double val[]);
170 
171 /*----------------------------------------------------------------------------*/
178 /*----------------------------------------------------------------------------*/
179 
180 void
181 cs_property_def_by_value(cs_property_t *pty,
182  const char *val);
183 
184 /*----------------------------------------------------------------------------*/
191 /*----------------------------------------------------------------------------*/
192 
193 void
194 cs_property_def_by_analytic(cs_property_t *pty,
195  cs_analytic_func_t *func);
196 
197 /*----------------------------------------------------------------------------*/
204 /*----------------------------------------------------------------------------*/
205 
206 void
207 cs_property_def_by_law(cs_property_t *pty,
208  cs_onevar_law_func_t *func);
209 
210 /*----------------------------------------------------------------------------*/
218 /*----------------------------------------------------------------------------*/
219 
220 void
221 cs_property_set_array(cs_property_t *pty,
222  cs_flag_t array_flag,
223  const cs_real_t *array);
224 
225 /*----------------------------------------------------------------------------*/
232 /*----------------------------------------------------------------------------*/
233 
234 void
235 cs_property_set_struct(cs_property_t *pty,
236  const void *structure);
237 
238 /*----------------------------------------------------------------------------*/
246 /*----------------------------------------------------------------------------*/
247 
248 void
249 cs_property_set_option(cs_property_t *pty,
250  const char *keyname,
251  const char *keyval);
252 
253 /*----------------------------------------------------------------------------*/
263 /*----------------------------------------------------------------------------*/
264 
265 void
267  const cs_property_t *pty,
268  bool do_inversion,
269  cs_real_3_t *tensor);
270 
271 /*----------------------------------------------------------------------------*/
280 /*----------------------------------------------------------------------------*/
281 
282 cs_real_t
284  const cs_property_t *pty);
285 
286 /*----------------------------------------------------------------------------*/
287 
289 
290 #endif /* __CS_PROPERTY_H__ */
time step descriptor
Definition: cs_time_step.h:51
const char * cs_property_get_name(const cs_property_t *pty)
Retrieve the name of a property.
Definition: cs_property.c:321
void cs_property_def_by_analytic(cs_property_t *pty, cs_analytic_func_t *func)
Define a cs_property_t structure thanks to an analytic function.
Definition: cs_property.c:544
Definition: cs_property.h:56
void cs_property_def_by_law(cs_property_t *pty, cs_onevar_law_func_t *func)
Define a cs_property_t structure thanks to a law function.
Definition: cs_property.c:564
cs_property_type_t
Definition: cs_property.h:53
void cs_property_def_by_value(cs_property_t *pty, const char *val)
Define the value of a cs_property_t structure.
Definition: cs_property.c:486
void cs_property_set_struct(cs_property_t *pty, const void *structure)
Set "array" members of a cs_property_t structure.
Definition: cs_property.c:606
void cs_property_set_array(cs_property_t *pty, cs_flag_t array_flag, const cs_real_t *array)
Set members of a cs_property_t structure.
Definition: cs_property.c:585
#define BEGIN_C_DECLS
Definition: cs_defs.h:429
Definition: cs_cdo_connect.h:67
void cs_property_get_cell_tensor(cs_lnum_t c_id, const cs_property_t *pty, bool do_inversion, cs_real_3_t *tensor)
Compute the value of the tensor attached a property at the cell center.
Definition: cs_property.c:678
Definition: cs_cdo_quantities.h:86
cs_property_t * cs_property_create(const char *name, const char *key_type, const cs_cdo_quantities_t *cdoq, const cs_cdo_connect_t *connect, const cs_time_step_t *time_step)
Create and initialize a new property structure.
Definition: cs_property.c:187
bool cs_property_check_name(const cs_property_t *pty, const char *ref_name)
Check if the given property has the name ref_name.
Definition: cs_property.c:269
void cs_property_summary(const cs_property_t *pty)
Print a summary of a cs_property_t structure.
Definition: cs_property.c:338
void( cs_onevar_law_func_t)(double var_value, const void *law_param, cs_get_t *retval)
Compute the value of a quantity according to a law depending only on one variable. This law is described by a set of parameters stored in a structure. result = law(var_value)
Definition: cs_cdo.h:128
Definition: cs_property.h:55
void( cs_analytic_func_t)(cs_real_t time, const cs_real_3_t xyz, cs_get_t *retval)
Generic analytic function.
Definition: cs_cdo.h:96
void cs_property_set_value(cs_property_t *pty, const double val[])
Set the value of a property attached to a cs_property_t structure.
Definition: cs_property.c:424
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:307
cs_property_t * cs_property_free(cs_property_t *pty)
Free a cs_property_t structure.
Definition: cs_property.c:244
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:292
void cs_property_set_option(cs_property_t *pty, const char *keyname, const char *keyval)
Set optional parameters related to a cs_property_t structure.
Definition: cs_property.c:626
#define END_C_DECLS
Definition: cs_defs.h:430
double cs_real_t
Definition: cs_defs.h:296
cs_real_t cs_property_get_cell_value(cs_lnum_t c_id, const cs_property_t *pty)
Compute the value of a property at the cell center.
Definition: cs_property.c:873
Definition: cs_property.h:58
Definition: cs_property.h:57
unsigned short int cs_flag_t
Definition: cs_cdo.h:50
bool cs_property_is_uniform(const cs_property_t *pty)
returns true if the property is uniform, otherwise false
Definition: cs_property.c:299