8.3
general documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
cs_cdo_connect.h
Go to the documentation of this file.
1#ifndef __CS_CDO_CONNECT_H__
2#define __CS_CDO_CONNECT_H__
3
4/*============================================================================
5 * Manage connectivity (Topological features of the mesh)
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2024 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 "fvm_defs.h"
35
36#include "cs_base.h"
37#include "cs_flag.h"
38#include "cs_param_types.h"
39#include "cs_mesh.h"
40#include "cs_mesh_adjacencies.h"
41#include "cs_range_set.h"
42
43/*----------------------------------------------------------------------------*/
44
46
47/*============================================================================
48 * Macro definitions
49 *============================================================================*/
50
51/* Additional macros */
52
53#define CS_TRIANGLE_CASE 3 /* Number of vertices in a triangle */
54
55/*============================================================================
56 * Type definitions
57 *============================================================================*/
58
59/* Connectivity structure */
60
61typedef struct {
62
63 /* Vertex-related members */
64 /* ---------------------- */
65
67
68 /* range set and interface set structures for scalar-valued vertex DoFs
69 (these structures may be not allocated according to the settings) */
70
73
74
75 /* Edge-related members */
76 /* -------------------- */
77
80
81 cs_adjacency_t *e2v; /* edge --> vertices connectivity */
82 cs_adjacency_t *e2f; /* edge --> faces connectivity */
83
84 /* range set and interface set structures for scalar-valued edge DoFs
85 (these structures may be not allocated according to the settings) */
86
89
90 /* Face-related members */
91 /* -------------------- */
92
93 cs_lnum_t n_faces[3]; /* 0: all, 1: border, 2: interior */
94
95 cs_adjacency_t *f2c; /* face --> cells connectivity */
96 cs_adjacency_t *f2e; /* face --> edges connectivity */
97 cs_adjacency_t *bf2v; /* border face --> vertices connectivity
98 (map from cs_mesh_t) */
99 cs_adjacency_t *if2v; /* interior face --> vertices connectivity
100 (map from cs_mesh_t) */
101
102 /* range set and interface set structures for scalar-valued edge DoFs
103 (these structures may be not allocated according to the settings) */
104
107
108 /* Cell-related members */
109 /* -------------------- */
110
113
114 fvm_element_t *cell_type; /* type of cell */
115 cs_flag_t *cell_flag; /* flag (border/solid) */
116 cs_adjacency_t *c2f; /* cell --> faces connectivity */
117 cs_adjacency_t *c2e; /* cell --> edges connectivity */
118 cs_adjacency_t *c2v; /* cell --> vertices connectivity */
119
120 /* Delta of ids between the min./max. values of entities related to a cell
121 Useful to store compactly the link between mesh ids and cell mesh ids
122 needed during the cell mesh definition */
123
126
127 /* Max. connectitivy size for cells */
128
129 int n_max_vbyc; /* max. number of vertices in a cell */
130 int n_max_ebyc; /* max. number of edges in a cell */
131 int n_max_fbyc; /* max. number of faces in a cell */
132 int n_max_vbyf; /* max. number of vertices in a face */
133 int n_max_v2fc; /* max. number of faces connected to a vertex in a cell */
134 int n_max_v2ec; /* max. number of edges connected to a vertex in a cell */
135
136 /* Adjacency related to linear systems (allocated only if needed) */
137
138 cs_adjacency_t *v2v; /* vertex to vertices through cells */
139 cs_adjacency_t *f2f; /* face to faces through cells */
140 cs_adjacency_t *f2xf; /* face to extended faces through cells + edges
141 * for MAC scheme */
142 cs_adjacency_t *f2f_ed; /* face to faces through edges + same directions
143 * for MAC scheme */
144 cs_adjacency_t *e2e; /* edge to edges through cells */
145
147
148/*============================================================================
149 * Global variables
150 *============================================================================*/
151
152/*============================================================================
153 * Static Inline Public function prototypes
154 *============================================================================*/
155
156/*----------------------------------------------------------------------------*/
168/*----------------------------------------------------------------------------*/
169
170static inline void
172 const cs_lnum_t *e2v_ids,
173 const cs_lnum_t start_idx,
174 cs_lnum_t *v0,
175 cs_lnum_t *v1,
176 cs_lnum_t *v2)
177{
178 const cs_lnum_t _2e0 = 2*f2e_ids[start_idx],
179 _2e1 = 2*f2e_ids[start_idx+1];
180 const cs_lnum_t tmp = e2v_ids[_2e1];
181
182 *v0 = e2v_ids[_2e0];
183 *v1 = e2v_ids[_2e0+1];
184 *v2 = ((tmp != *v0) && (tmp != *v1)) ? tmp : e2v_ids[_2e1+1];
185}
186
187/*============================================================================
188 * Public function prototypes
189 *============================================================================*/
190
191/*----------------------------------------------------------------------------*/
210/*----------------------------------------------------------------------------*/
211
213 cs_flag_t eb_scheme_flag,
214 cs_flag_t fb_scheme_flag,
215 cs_flag_t cb_scheme_flag,
216 cs_flag_t vb_scheme_flag,
217 cs_flag_t vcb_scheme_flag,
218 cs_flag_t hho_scheme_flag,
219 cs_flag_t mac_scheme_flag);
220
221/*----------------------------------------------------------------------------*/
230/*----------------------------------------------------------------------------*/
231
234 cs_cdo_connect_t *connect);
235
236/*----------------------------------------------------------------------------*/
245/*----------------------------------------------------------------------------*/
246
247void
249 cs_flag_t eb_scheme_flag,
250 cs_flag_t vb_scheme_flag,
251 cs_flag_t vcb_scheme_flag);
252
253/*----------------------------------------------------------------------------*/
259/*----------------------------------------------------------------------------*/
260
261void
263
264/*----------------------------------------------------------------------------*/
268/*----------------------------------------------------------------------------*/
269
270void
272
273/*----------------------------------------------------------------------------*/
282/*----------------------------------------------------------------------------*/
283
284double *
286
287/*----------------------------------------------------------------------------*/
293/*----------------------------------------------------------------------------*/
294
295long long
297
298/*----------------------------------------------------------------------------*/
309/*----------------------------------------------------------------------------*/
310
311void
313 int n_vtx_dofs,
314 bool interlaced,
315 cs_interface_set_t **p_ifs,
316 cs_range_set_t **p_rs);
317
318/*----------------------------------------------------------------------------*/
329/*----------------------------------------------------------------------------*/
330
331void
333 cs_lnum_t n_faces,
334 int n_face_dofs,
335 cs_interface_set_t **p_ifs,
336 cs_range_set_t **p_rs);
337
338/*----------------------------------------------------------------------------*/
346/*----------------------------------------------------------------------------*/
347
350
351/*----------------------------------------------------------------------------*/
362/*----------------------------------------------------------------------------*/
363
364void
366 const cs_real_t *edge_values,
367 cs_real_t **p_curl_values);
368
369/*----------------------------------------------------------------------------*/
375/*----------------------------------------------------------------------------*/
376
377void
379
380/*----------------------------------------------------------------------------*/
381
383
384#endif /* __CS_CDO_CONNECT_H__ */
void cs_cdo_connect_dump(const cs_cdo_connect_t *connect)
Dump a cs_cdo_connect_t structure for debugging purpose.
Definition: cs_cdo_connect.cpp:1591
void cs_cdo_connect_allocate_cw_buffer(const cs_cdo_connect_t *connect)
Allocate and initialize the cell-wise buffer(s)
Definition: cs_cdo_connect.cpp:1382
void cs_cdo_connect_assign_vtx_ifs_rs(const cs_mesh_t *mesh, int n_vtx_dofs, bool interlaced, cs_interface_set_t **p_ifs, cs_range_set_t **p_rs)
Allocate and define a cs_range_set_t structure and a cs_interface_set_t structure for schemes with Do...
Definition: cs_cdo_connect.cpp:1489
cs_cdo_connect_t * cs_cdo_connect_build(cs_mesh_t *mesh, cs_flag_t eb_scheme_flag, cs_flag_t fb_scheme_flag, cs_flag_t cb_scheme_flag, cs_flag_t vb_scheme_flag, cs_flag_t vcb_scheme_flag, cs_flag_t hho_scheme_flag, cs_flag_t mac_scheme_flag)
Allocate and define a new cs_cdo_connect_t structure Range sets and interface sets are allocated and ...
Definition: cs_cdo_connect.cpp:1020
void cs_cdo_connect_assign_face_ifs_rs(const cs_mesh_t *mesh, cs_lnum_t n_faces, int n_face_dofs, cs_interface_set_t **p_ifs, cs_range_set_t **p_rs)
Allocate and define a cs_range_set_t structure and a cs_interface_set_t structure for schemes with Do...
cs_cdo_connect_t * cs_cdo_connect_free(const cs_mesh_t *mesh, cs_cdo_connect_t *connect)
Destroy a cs_cdo_connect_t structure.
Definition: cs_cdo_connect.cpp:1210
void cs_cdo_connect_discrete_curl(const cs_cdo_connect_t *connect, const cs_real_t *edge_values, cs_real_t **p_curl_values)
Compute the discrete curl operator across each primal faces. From an edge-based array (seen as circul...
Definition: cs_cdo_connect.cpp:1549
void cs_cdo_connect_log_summary(const cs_cdo_connect_t *connect, cs_flag_t eb_scheme_flag, cs_flag_t vb_scheme_flag, cs_flag_t vcb_scheme_flag)
Summary of the connectivity information.
Definition: cs_cdo_connect.cpp:1269
void cs_cdo_connect_free_cw_buffer(void)
Free the cell-wise buffer(s)
Definition: cs_cdo_connect.cpp:1423
double * cs_cdo_connect_get_cw_buffer(int thr_id)
Retrieve the cell-wise buffer associated to the current thread. Use cs_get_thread_id when the thread ...
Definition: cs_cdo_connect.cpp:1455
cs_interface_set_t * cs_cdo_connect_define_face_interface(const cs_mesh_t *mesh)
Create and define a new cs_interface_set_t structure on faces.
static void cs_connect_get_next_3_vertices(const cs_lnum_t *f2e_ids, const cs_lnum_t *e2v_ids, const cs_lnum_t start_idx, cs_lnum_t *v0, cs_lnum_t *v1, cs_lnum_t *v2)
Get the next three vertices in a row from a face to edge connectivity and a edge to vertex connectivi...
Definition: cs_cdo_connect.h:171
long long cs_cdo_connect_get_time_perfo(void)
Retrieve the time elapsed to build the cs_cdo_connect_t structure.
Definition: cs_cdo_connect.cpp:1470
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
uint64_t cs_gnum_t
global mesh entity number
Definition: cs_defs.h:325
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
unsigned short int cs_flag_t
Definition: cs_defs.h:344
struct _cs_interface_set_t cs_interface_set_t
Definition: cs_interface.h:61
fvm_element_t
Definition: fvm_defs.h:48
Definition: mesh.f90:26
Definition: cs_mesh_adjacencies.h:68
Definition: cs_cdo_connect.h:61
cs_lnum_t v_max_cell_range
Definition: cs_cdo_connect.h:125
cs_gnum_t n_g_edges
Definition: cs_cdo_connect.h:79
int n_max_v2fc
Definition: cs_cdo_connect.h:133
cs_flag_t * cell_flag
Definition: cs_cdo_connect.h:115
int n_max_fbyc
Definition: cs_cdo_connect.h:131
cs_adjacency_t * v2v
Definition: cs_cdo_connect.h:138
cs_interface_set_t * vtx_ifs
Definition: cs_cdo_connect.h:72
int n_max_ebyc
Definition: cs_cdo_connect.h:130
int n_max_vbyc
Definition: cs_cdo_connect.h:129
cs_adjacency_t * c2f
Definition: cs_cdo_connect.h:116
int n_max_v2ec
Definition: cs_cdo_connect.h:134
cs_adjacency_t * e2f
Definition: cs_cdo_connect.h:82
int n_max_vbyf
Definition: cs_cdo_connect.h:132
cs_adjacency_t * f2xf
Definition: cs_cdo_connect.h:140
cs_range_set_t * face_rset
Definition: cs_cdo_connect.h:105
cs_range_set_t * edge_rset
Definition: cs_cdo_connect.h:87
cs_lnum_t e_max_cell_range
Definition: cs_cdo_connect.h:124
cs_lnum_t n_cells_with_ghosts
Definition: cs_cdo_connect.h:112
cs_lnum_t n_cells
Definition: cs_cdo_connect.h:111
cs_range_set_t * vtx_rset
Definition: cs_cdo_connect.h:71
cs_adjacency_t * c2v
Definition: cs_cdo_connect.h:118
cs_adjacency_t * e2v
Definition: cs_cdo_connect.h:81
cs_lnum_t n_vertices
Definition: cs_cdo_connect.h:66
cs_adjacency_t * f2e
Definition: cs_cdo_connect.h:96
cs_adjacency_t * e2e
Definition: cs_cdo_connect.h:144
fvm_element_t * cell_type
Definition: cs_cdo_connect.h:114
cs_adjacency_t * f2f_ed
Definition: cs_cdo_connect.h:142
cs_lnum_t n_edges
Definition: cs_cdo_connect.h:78
cs_interface_set_t * face_ifs
Definition: cs_cdo_connect.h:106
cs_adjacency_t * if2v
Definition: cs_cdo_connect.h:99
cs_adjacency_t * f2c
Definition: cs_cdo_connect.h:95
cs_adjacency_t * c2e
Definition: cs_cdo_connect.h:117
cs_interface_set_t * edge_ifs
Definition: cs_cdo_connect.h:88
cs_adjacency_t * bf2v
Definition: cs_cdo_connect.h:97
cs_adjacency_t * f2f
Definition: cs_cdo_connect.h:139
Definition: cs_mesh.h:85
Definition: cs_range_set.h:57