programmer's documentation
cs_evaluate.h
Go to the documentation of this file.
1 #ifndef __CS_EVALUATE_H__
2 #define __CS_EVALUATE_H__
3 
4 /*============================================================================
5  * Functions and structures to deal with evaluation of quantities
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_connect.h"
36 #include "cs_cdo_local.h"
37 #include "cs_cdo_quantities.h"
38 #include "cs_param.h"
39 #include "cs_time_step.h"
40 #include "cs_xdef.h"
41 
42 /*----------------------------------------------------------------------------*/
43 
45 
46 /*============================================================================
47  * Macro definitions
48  *============================================================================*/
49 
50 /*============================================================================
51  * Type definitions
52  *============================================================================*/
53 
54 /*============================================================================
55  * Public function prototypes
56  *============================================================================*/
57 
58 /*----------------------------------------------------------------------------*/
66 /*----------------------------------------------------------------------------*/
67 
68 void
70  const cs_cdo_connect_t *connect,
71  const cs_time_step_t *time_step);
72 
73 /*----------------------------------------------------------------------------*/
82 /*----------------------------------------------------------------------------*/
83 
84 void
86  const cs_xdef_t *def,
87  double retval[]);
88 
89 /*----------------------------------------------------------------------------*/
99 /*----------------------------------------------------------------------------*/
100 
101 void
103  const cs_xdef_t *def,
104  double retval[]);
105 
106 /*----------------------------------------------------------------------------*/
115 /*----------------------------------------------------------------------------*/
116 
117 void
119  const cs_xdef_t *def,
120  double retval[]);
121 
122 /*----------------------------------------------------------------------------*/
132 /*----------------------------------------------------------------------------*/
133 
134 void
136  const cs_xdef_t *def,
137  double retval[]);
138 
139 /*----------------------------------------------------------------------------*/
147 /*----------------------------------------------------------------------------*/
148 
149 void
151  const cs_xdef_t *def,
152  double retval[]);
153 
154 /*----------------------------------------------------------------------------*/
162 /*----------------------------------------------------------------------------*/
163 
164 void
166  const cs_xdef_t *def,
167  double retval[]);
168 
169 /*----------------------------------------------------------------------------*/
177 /*----------------------------------------------------------------------------*/
178 
179 void
181  const cs_xdef_t *def,
182  double retval[]);
183 
184 /*----------------------------------------------------------------------------*/
192 /*----------------------------------------------------------------------------*/
193 
194 static inline void
196  const cs_xdef_t *def,
197  double retval[])
198 {
199  /* Sanity checks */
200  assert(def != NULL);
201 
202  switch (def->type) {
203 
204  case CS_XDEF_BY_VALUE:
205  cs_evaluate_average_on_faces_by_value(dof_flag, def, retval);
206  break;
207 
209  cs_evaluate_average_on_faces_by_analytic(dof_flag, def, retval);
210  break;
211 
212  default:
213  bft_error(__FILE__, __LINE__, 0, " %s: Case not handled yet.", __func__);
214 
215  }
216 }
217 
218 /*----------------------------------------------------------------------------*/
226 /*----------------------------------------------------------------------------*/
227 
228 void
230  const cs_xdef_t *def,
231  double retval[]);
232 
233 /*----------------------------------------------------------------------------*/
241 /*----------------------------------------------------------------------------*/
242 
243 void
245  const cs_xdef_t *def,
246  double retval[]);
247 
248 /*----------------------------------------------------------------------------*/
256 /*----------------------------------------------------------------------------*/
257 
258 void
260  const cs_xdef_t *def,
261  double retval[]);
262 
263 /*----------------------------------------------------------------------------*/
271 /*----------------------------------------------------------------------------*/
272 
273 static inline void
275  const cs_xdef_t *def,
276  double retval[])
277 {
278  /* Sanity checks */
279  assert(def != NULL);
280 
281  switch (def->type) {
282 
283  case CS_XDEF_BY_VALUE:
284  cs_evaluate_average_on_cells_by_value(dof_flag, def, retval);
285  break;
286 
288  cs_evaluate_average_on_cells_by_analytic(dof_flag, def, retval);
289  break;
290 
291  case CS_XDEF_BY_ARRAY:
292  cs_evaluate_average_on_cells_by_array(dof_flag, def, retval);
293 
294  default:
295  bft_error(__FILE__, __LINE__, 0, " %s: Case not handled yet.", __func__);
296 
297  }
298 }
299 
300 /*----------------------------------------------------------------------------*/
301 
303 
304 #endif /* __CS_EVALUATE_H__ */
time step descriptor
Definition: cs_time_step.h:51
void cs_evaluate_potential_by_value(cs_flag_t dof_flag, const cs_xdef_t *def, double retval[])
Evaluate the quantity attached to a potential field for all the DoFs.
Definition: cs_evaluate.c:1875
Definition: cs_xdef.h:86
void cs_evaluate_set_shared_pointers(const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_time_step_t *time_step)
Set shared pointers to main domain members.
Definition: cs_evaluate.c:1544
void cs_evaluate_density_by_analytic(cs_flag_t dof_flag, const cs_xdef_t *def, double retval[])
Compute the value related to each DoF in the case of a density field The value defined by the analyti...
Definition: cs_evaluate.c:1566
#define BEGIN_C_DECLS
Definition: cs_defs.h:461
Definition: cs_cdo_connect.h:69
static void cs_evaluate_average_on_faces(cs_flag_t dof_flag, const cs_xdef_t *def, double retval[])
Evaluate the average of a function on the faces.
Definition: cs_evaluate.h:195
Definition: cs_xdef.h:81
void bft_error(const char *const file_name, const int line_num, const int sys_error_code, const char *const format,...)
Calls the error handler (set by bft_error_handler_set() or default).
Definition: bft_error.c:193
Definition: cs_cdo_quantities.h:94
cs_xdef_type_t type
Definition: cs_xdef.h:156
void cs_evaluate_average_on_cells_by_value(cs_flag_t dof_flag, const cs_xdef_t *def, double retval[])
Evaluate the average of a function on the cells.
Definition: cs_evaluate.c:2137
void cs_evaluate_average_on_cells_by_array(cs_flag_t dof_flag, const cs_xdef_t *def, double retval[])
Evaluate the average of a function on the cells.
Definition: cs_evaluate.c:2185
Definition: cs_xdef.h:80
void cs_evaluate_average_on_cells_by_analytic(cs_flag_t dof_flag, const cs_xdef_t *def, double retval[])
Evaluate the average of a function on the cells.
Definition: cs_evaluate.c:2259
void cs_evaluate_average_on_faces_by_value(cs_flag_t dof_flag, const cs_xdef_t *def, double retval[])
Evaluate the average of a function on the faces.
Definition: cs_evaluate.c:1951
Structure storing medata for defining a quantity in a very flexible way.
Definition: cs_xdef.h:122
void cs_evaluate_average_on_faces_by_analytic(cs_flag_t dof_flag, const cs_xdef_t *def, double retval[])
Evaluate the average of a function on the faces.
Definition: cs_evaluate.c:2025
#define END_C_DECLS
Definition: cs_defs.h:462
unsigned short int cs_flag_t
Definition: cs_defs.h:299
static void cs_evaluate_average_on_cells(cs_flag_t dof_flag, const cs_xdef_t *def, double retval[])
Evaluate the average of a function on the cells.
Definition: cs_evaluate.h:274
void cs_evaluate_potential_by_analytic(cs_flag_t dof_flag, const cs_xdef_t *def, double retval[])
Evaluate the quantity attached to a potential field for all the DoFs when the definition relies on an...
Definition: cs_evaluate.c:1694
void cs_evaluate_density_by_value(cs_flag_t dof_flag, const cs_xdef_t *def, double retval[])
Evaluate the quantity defined by a value in the case of a density field for all the degrees of freedo...
Definition: cs_evaluate.c:1639
void cs_evaluate_potential_by_qov(cs_flag_t dof_flag, const cs_xdef_t *def, double retval[])
Define a value to each DoF in the case of a potential field in order to put a given quantity inside t...
Definition: cs_evaluate.c:1833