9.2
general documentation
cs_cdo_toolbox.h
Go to the documentation of this file.
1#ifndef CS_CDO_TOOLBOX_H
2#define CS_CDO_TOOLBOX_H
3
4/*============================================================================
5 * Set of toolbox functions: shared buffer, balance, synchronization
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2026 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 * Local headers
30 *----------------------------------------------------------------------------*/
31
32#include "cdo/cs_cdo_connect.h"
33#include "cdo/cs_flag.h"
34#include "cdo/cs_xdef.h"
35
36/*============================================================================
37 * Macro definitions
38 *============================================================================*/
39
40/* Strategy of synchronization of values shared across several cells
41 * This applies to vertices, edges and faces
42 *
43 * CS_CDO_SYNC_ZERO_VALUE
44 * If zero is a possible value then set this value, otherwise one takes
45 * the mean-value
46 *
47 * CS_CDO_SYNC_MEAN_VALUE
48 * Compute the mean-value across values to set
49 *
50 */
51
52#define CS_CDO_SYNC_ZERO_VALUE 1
53#define CS_CDO_SYNC_MEAN_VALUE 2
54
55/*============================================================================
56 * Type definitions
57 *============================================================================*/
58
59/*
60 * Structure used to store information generated during the analysis
61 * of the balance of each term of an equation
62 */
63
64typedef struct {
65
66 /* Where the balance is computed: primal vertices or primal cells */
67
71
72 /* Balance for each main term */
73
80
82
83/*============================================================================
84 * Public function prototypes
85 *============================================================================*/
86
87/*----------------------------------------------------------------------------*/
104/*----------------------------------------------------------------------------*/
105
106void cs_cdo_toolbox_init(const cs_cdo_connect_t *connect,
107 cs_flag_t eb_flag,
108 cs_flag_t fb_flag,
109 cs_flag_t cb_flag,
110 cs_flag_t vb_flag,
111 cs_flag_t vcb_flag,
112 cs_flag_t hho_flag,
113 cs_flag_t mac_flag);
114
115/*----------------------------------------------------------------------------*/
119/*----------------------------------------------------------------------------*/
120
121void
123
124/*----------------------------------------------------------------------------*/
132/*----------------------------------------------------------------------------*/
133
134cs_real_t *
136
137/*----------------------------------------------------------------------------*/
143/*----------------------------------------------------------------------------*/
144
145size_t
147
148/*----------------------------------------------------------------------------*/
157/*----------------------------------------------------------------------------*/
158
161 cs_lnum_t size);
162
163/*----------------------------------------------------------------------------*/
169/*----------------------------------------------------------------------------*/
170
171void
173
174/*----------------------------------------------------------------------------*/
181/*----------------------------------------------------------------------------*/
182
183void
186
187/*----------------------------------------------------------------------------*/
193/*----------------------------------------------------------------------------*/
194
195void
197
198/*----------------------------------------------------------------------------*/
207/*----------------------------------------------------------------------------*/
208
209void
211 cs_xdef_t **defs,
212 cs_lnum_t def2v_idx[],
213 cs_lnum_t def2v_ids[]);
214
215/*----------------------------------------------------------------------------*/
224/*----------------------------------------------------------------------------*/
225
226void
228 cs_xdef_t **defs,
229 cs_lnum_t def2e_idx[],
230 cs_lnum_t def2e_ids[]);
231
232/*----------------------------------------------------------------------------*/
241/*----------------------------------------------------------------------------*/
242
243void
245 cs_xdef_t **defs,
246 cs_lnum_t def2f_idx[],
247 cs_lnum_t def2f_ids[]);
248
249/*----------------------------------------------------------------------------*/
257/*----------------------------------------------------------------------------*/
258
259void
261 int *counter,
262 cs_real_t *values);
263
264#endif /* CS_CDO_TOOLBOX_H */
size_t cs_cdo_toolbox_get_tmpbuf_size(void)
Get the allocation size of the temporary buffer.
Definition: cs_cdo_toolbox.cpp:299
void cs_cdo_sync_vertex_mean_values(int dim, int *counter, cs_real_t *values)
Compute the mean-value across ranks at each vertex.
Definition: cs_cdo_toolbox.cpp:735
void cs_cdo_toolbox_init(const cs_cdo_connect_t *connect, cs_flag_t eb_flag, cs_flag_t fb_flag, cs_flag_t cb_flag, cs_flag_t vb_flag, cs_flag_t vcb_flag, cs_flag_t hho_flag, cs_flag_t mac_flag)
Allocate a pointer to a buffer of size at least the n_cells for managing temporary usage of memory wh...
Definition: cs_cdo_toolbox.cpp:114
void cs_cdo_toolbox_finalize(void)
Free buffers shared among the equations solved with CDO schemes.
Definition: cs_cdo_toolbox.cpp:255
void cs_cdo_sync_vol_def_at_edges(int n_defs, cs_xdef_t **defs, cs_lnum_t def2e_idx[], cs_lnum_t def2e_ids[])
Synchronize the volumetric definitions to consider at each edge.
Definition: cs_cdo_toolbox.cpp:535
void cs_cdo_balance_reset(cs_cdo_balance_t *b)
Reset a cs_cdo_balance_t structure.
Definition: cs_cdo_toolbox.cpp:353
void cs_cdo_sync_vol_def_at_faces(int n_defs, cs_xdef_t **defs, cs_lnum_t def2f_idx[], cs_lnum_t def2f_ids[])
Synchronize the volumetric definitions to consider at each face.
Definition: cs_cdo_toolbox.cpp:637
void cs_cdo_balance_sync(const cs_cdo_connect_t *connect, cs_cdo_balance_t *b)
Synchronize balance terms if this is a parallel computation.
Definition: cs_cdo_toolbox.cpp:378
void cs_cdo_balance_destroy(cs_cdo_balance_t **p_balance)
Free a cs_cdo_balance_t structure.
Definition: cs_cdo_toolbox.cpp:408
void cs_cdo_sync_vol_def_at_vertices(int n_defs, cs_xdef_t **defs, cs_lnum_t def2v_idx[], cs_lnum_t def2v_ids[])
Synchronize the volumetric definitions to consider at each vertex.
Definition: cs_cdo_toolbox.cpp:433
cs_real_t * cs_cdo_toolbox_get_tmpbuf(void)
Retrieve a pointer to a buffer of size at least the 2*n_cells The size of the temporary buffer can be...
Definition: cs_cdo_toolbox.cpp:285
cs_cdo_balance_t * cs_cdo_balance_create(cs_flag_t location, cs_lnum_t size)
Allocate a cs_cdo_balance_t structure.
Definition: cs_cdo_toolbox.cpp:316
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
unsigned short int cs_flag_t
Definition: cs_defs.h:334
Definition: cs_cdo_toolbox.h:64
cs_real_t * boundary_term
Definition: cs_cdo_toolbox.h:79
cs_real_t * unsteady_term
Definition: cs_cdo_toolbox.h:74
cs_real_t * advection_term
Definition: cs_cdo_toolbox.h:77
cs_real_t * reaction_term
Definition: cs_cdo_toolbox.h:75
cs_real_t * source_term
Definition: cs_cdo_toolbox.h:78
cs_lnum_t size
Definition: cs_cdo_toolbox.h:69
cs_flag_t location
Definition: cs_cdo_toolbox.h:68
cs_real_t * balance
Definition: cs_cdo_toolbox.h:70
cs_real_t * diffusion_term
Definition: cs_cdo_toolbox.h:76
Definition: cs_cdo_connect.h:57
Structure storing medata for defining a quantity in a very flexible way.
Definition: cs_xdef.h:156