8.2
general documentation
Loading...
Searching...
No Matches
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
79 cs_gnum_t n_g_edges;
80
81 cs_adjacency_t *e2v; /* edge --> vertices connectivity */
82
83 /* range set and interface set structures for scalar-valued edge DoFs
84 (these structures may be not allocated according to the settings) */
85
88
89 /* Face-related members */
90 /* -------------------- */
91
92 cs_lnum_t n_faces[3]; /* 0: all, 1: border, 2: interior */
93
94 cs_adjacency_t *f2c; /* face --> cells connectivity */
95 cs_adjacency_t *f2e; /* face --> edges connectivity */
96 cs_adjacency_t *bf2v; /* border face --> vertices connectivity
97 (map from cs_mesh_t) */
98 cs_adjacency_t *if2v; /* interior face --> vertices connectivity
99 (map from cs_mesh_t) */
100
101 /* range set and interface set structures for scalar-valued edge DoFs
102 (these structures may be not allocated according to the settings) */
103
106
107 /* Cell-related members */
108 /* -------------------- */
109
112
113 fvm_element_t *cell_type; /* type of cell */
114 cs_flag_t *cell_flag; /* Flag (Border/Solid) */
115 cs_adjacency_t *c2f; /* cell --> faces connectivity */
116 cs_adjacency_t *c2e; /* cell --> edges connectivity */
117 cs_adjacency_t *c2v; /* cell --> vertices connectivity */
118
119 /* Delta of ids between the min./max. values of entities related to a cell
120 Useful to store compactly the link between mesh ids and cell mesh ids
121 needed during the cell mesh definition */
122
125
126 /* Max. connectitivy size for cells */
127
128 int n_max_vbyc; /* max. number of vertices in a cell */
129 int n_max_ebyc; /* max. number of edges in a cell */
130 int n_max_fbyc; /* max. number of faces in a cell */
131 int n_max_vbyf; /* max. number of vertices in a face */
132 int n_max_v2fc; /* max. number of faces connected to a vertex in a cell */
133 int n_max_v2ec; /* max. number of edges connected to a vertex in a cell */
134
135 /* Adjacency related to linear systems (allocated only if needed) */
136
137 cs_adjacency_t *v2v; /* vertex to vertices through cells */
138 cs_adjacency_t *f2f; /* face to faces through cells */
139 cs_adjacency_t *e2e; /* edge to edges through cells */
140
142
143/*============================================================================
144 * Global variables
145 *============================================================================*/
146
147/*============================================================================
148 * Static Inline Public function prototypes
149 *============================================================================*/
150
151/*----------------------------------------------------------------------------*/
163/*----------------------------------------------------------------------------*/
164
165static inline void
167 const cs_lnum_t *e2v_ids,
168 const cs_lnum_t start_idx,
169 cs_lnum_t *v0,
170 cs_lnum_t *v1,
171 cs_lnum_t *v2)
172{
173 const cs_lnum_t _2e0 = 2*f2e_ids[start_idx],
174 _2e1 = 2*f2e_ids[start_idx+1];
175 const cs_lnum_t tmp = e2v_ids[_2e1];
176
177 *v0 = e2v_ids[_2e0];
178 *v1 = e2v_ids[_2e0+1];
179 *v2 = ((tmp != *v0) && (tmp != *v1)) ? tmp : e2v_ids[_2e1+1];
180}
181
182/*============================================================================
183 * Public function prototypes
184 *============================================================================*/
185
186/*----------------------------------------------------------------------------*/
204/*----------------------------------------------------------------------------*/
205
208 cs_flag_t eb_scheme_flag,
209 cs_flag_t fb_scheme_flag,
210 cs_flag_t cb_scheme_flag,
211 cs_flag_t vb_scheme_flag,
212 cs_flag_t vcb_scheme_flag,
213 cs_flag_t hho_scheme_flag);
214
215/*----------------------------------------------------------------------------*/
224/*----------------------------------------------------------------------------*/
225
228 cs_cdo_connect_t *connect);
229
230/*----------------------------------------------------------------------------*/
239/*----------------------------------------------------------------------------*/
240
241void
243 cs_flag_t eb_scheme_flag,
244 cs_flag_t vb_scheme_flag,
245 cs_flag_t vcb_scheme_flag);
246
247/*----------------------------------------------------------------------------*/
253/*----------------------------------------------------------------------------*/
254
255void
257
258/*----------------------------------------------------------------------------*/
262/*----------------------------------------------------------------------------*/
263
264void
266
267/*----------------------------------------------------------------------------*/
276/*----------------------------------------------------------------------------*/
277
278double *
280
281/*----------------------------------------------------------------------------*/
287/*----------------------------------------------------------------------------*/
288
289long long
291
292/*----------------------------------------------------------------------------*/
303/*----------------------------------------------------------------------------*/
304
305void
307 int n_vtx_dofs,
308 bool interlaced,
309 cs_interface_set_t **p_ifs,
310 cs_range_set_t **p_rs);
311
312/*----------------------------------------------------------------------------*/
323/*----------------------------------------------------------------------------*/
324
325void
327 cs_lnum_t n_faces,
328 int n_face_dofs,
329 cs_interface_set_t **p_ifs,
330 cs_range_set_t **p_rs);
331
332/*----------------------------------------------------------------------------*/
340/*----------------------------------------------------------------------------*/
341
344
345/*----------------------------------------------------------------------------*/
356/*----------------------------------------------------------------------------*/
357
358void
360 const cs_real_t *edge_values,
361 cs_real_t **p_curl_values);
362
363/*----------------------------------------------------------------------------*/
369/*----------------------------------------------------------------------------*/
370
371void
373
374/*----------------------------------------------------------------------------*/
375
377
378#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.c:1487
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.c:1280
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.c:1384
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.c:1111
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.c:1445
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.c:1168
void cs_cdo_connect_free_cw_buffer(void)
Free the cell-wise buffer(s)
Definition cs_cdo_connect.c:1318
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)
Allocate and define a new cs_cdo_connect_t structure Range sets and interface sets are allocated and ...
Definition cs_cdo_connect.c:934
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.c:1350
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:166
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.c:1365
#define BEGIN_C_DECLS
Definition cs_defs.h:528
double cs_real_t
Floating-point value.
Definition cs_defs.h:332
#define END_C_DECLS
Definition cs_defs.h:529
int cs_lnum_t
local mesh entity id
Definition cs_defs.h:325
unsigned short int cs_flag_t
Definition cs_defs.h:334
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:124
cs_gnum_t n_g_edges
Definition cs_cdo_connect.h:79
int n_max_v2fc
Definition cs_cdo_connect.h:132
cs_flag_t * cell_flag
Definition cs_cdo_connect.h:114
int n_max_fbyc
Definition cs_cdo_connect.h:130
cs_adjacency_t * v2v
Definition cs_cdo_connect.h:137
cs_interface_set_t * vtx_ifs
Definition cs_cdo_connect.h:72
int n_max_ebyc
Definition cs_cdo_connect.h:129
int n_max_vbyc
Definition cs_cdo_connect.h:128
cs_adjacency_t * c2f
Definition cs_cdo_connect.h:115
int n_max_v2ec
Definition cs_cdo_connect.h:133
int n_max_vbyf
Definition cs_cdo_connect.h:131
cs_range_set_t * face_rset
Definition cs_cdo_connect.h:104
cs_range_set_t * edge_rset
Definition cs_cdo_connect.h:86
cs_lnum_t e_max_cell_range
Definition cs_cdo_connect.h:123
cs_lnum_t n_cells_with_ghosts
Definition cs_cdo_connect.h:111
cs_lnum_t n_faces[3]
Definition cs_cdo_connect.h:92
cs_lnum_t n_cells
Definition cs_cdo_connect.h:110
cs_range_set_t * vtx_rset
Definition cs_cdo_connect.h:71
cs_adjacency_t * c2v
Definition cs_cdo_connect.h:117
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:95
cs_adjacency_t * e2e
Definition cs_cdo_connect.h:139
fvm_element_t * cell_type
Definition cs_cdo_connect.h:113
cs_lnum_t n_edges
Definition cs_cdo_connect.h:78
cs_interface_set_t * face_ifs
Definition cs_cdo_connect.h:105
cs_adjacency_t * if2v
Definition cs_cdo_connect.h:98
cs_adjacency_t * f2c
Definition cs_cdo_connect.h:94
cs_adjacency_t * c2e
Definition cs_cdo_connect.h:116
cs_interface_set_t * edge_ifs
Definition cs_cdo_connect.h:87
cs_adjacency_t * bf2v
Definition cs_cdo_connect.h:96
cs_adjacency_t * f2f
Definition cs_cdo_connect.h:138
Definition cs_mesh.h:85
Definition cs_range_set.h:57