7.1
general documentation
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-2021 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_mesh.h"
39 #include "cs_mesh_adjacencies.h"
40 #include "cs_range_set.h"
41 
42 /*----------------------------------------------------------------------------*/
43 
45 
46 /*============================================================================
47  * Macro definitions
48  *============================================================================*/
49 
50 /* Main categories to consider for high-level structures
51  Remark: scalar-valued HHO-P1 and vector-valued CDO-Fb shares the same
52  structures
53  DoF = Degrees of Freedom
54 */
55 
56 #define CS_CDO_CONNECT_VTX_SCAL 0 /* Vb or VCb scalar-valued DoF */
57 #define CS_CDO_CONNECT_VTX_VECT 1 /* Vb or VCb vector-valued DoF */
58 #define CS_CDO_CONNECT_FACE_SP0 2 /* Fb or HHO-P0 scalar-valued DoF */
59 #define CS_CDO_CONNECT_FACE_VP0 3 /* Fb vector-valued DoF */
60 #define CS_CDO_CONNECT_FACE_SP1 3 /* HHO-P1 scalar-valued */
61 #define CS_CDO_CONNECT_FACE_SP2 4 /* HHO-P2 scalar-valued DoF */
62 #define CS_CDO_CONNECT_FACE_VHP0 3 /* HHO-P0 vector-valued DoF */
63 #define CS_CDO_CONNECT_FACE_VHP1 5 /* HHO-P1 vector-valued DoF */
64 #define CS_CDO_CONNECT_FACE_VHP2 6 /* HHO-P2 vector-valued DoF */
65 #define CS_CDO_CONNECT_EDGE_SCAL 7 /* Eb scalar-valued DoF */
66 
67 #define CS_CDO_CONNECT_N_CASES 8
68 
69 /* Additional macros */
70 
71 #define CS_TRIANGLE_CASE 3 /* Number of vertices in a triangle */
72 
73 /*============================================================================
74  * Type definitions
75  *============================================================================*/
76 
77 /* Connectivity structure */
78 
79 typedef struct {
80 
84  cs_lnum_t n_faces[3]; /* 0: all, 1: border, 2: interior */
86 
87  /* Edge-related members */
88 
89  cs_adjacency_t *e2v; /* edge --> vertices connectivity */
90 
91  /* Face-related members */
92 
93  cs_adjacency_t *f2c; /* face --> cells connectivity */
94  cs_adjacency_t *f2e; /* face --> edges connectivity */
95  cs_adjacency_t *bf2v; /* border face --> vertices connectivity
96  (map from cs_mesh_t) */
97  cs_adjacency_t *if2v; /* interior face --> vertices connectivity
98  (map from cs_mesh_t) */
99 
100  /* Cell-related members */
101 
102  fvm_element_t *cell_type; /* type of cell */
103  cs_flag_t *cell_flag; /* Flag (Border/Solid) */
104  cs_adjacency_t *c2f; /* cell --> faces connectivity */
105  cs_adjacency_t *c2e; /* cell --> edges connectivity */
106  cs_adjacency_t *c2v; /* cell --> vertices connectivity */
107 
108  /* Delta of ids between the min./max. values of entities related to a cell
109  Useful to store compactly the link between mesh ids and cell mesh ids
110  needed during the cell mesh definition */
111 
114 
115  /* Max. connectitivy size for cells */
116 
117  int n_max_vbyc; /* max. number of vertices in a cell */
118  int n_max_ebyc; /* max. number of edges in a cell */
119  int n_max_fbyc; /* max. number of faces in a cell */
120  int n_max_vbyf; /* max. number of vertices in a face */
121  int n_max_v2fc; /* max. number of faces connected to a vertex in a cell */
122  int n_max_v2ec; /* max. number of edges connected to a vertex in a cell */
123 
124  /* Adjacency related to linear systems (allocated only if needed) */
125 
126  cs_adjacency_t *v2v; /* vertex to vertices through cells */
127  cs_adjacency_t *f2f; /* face to faces through cells */
128  cs_adjacency_t *e2e; /* edge to edges through cells */
129 
130  /* Structures to handle parallelism/assembler */
131 
134 
136 
137 /*============================================================================
138  * Global variables
139  *============================================================================*/
140 
141 /*============================================================================
142  * Static Inline Public function prototypes
143  *============================================================================*/
144 
145 /*----------------------------------------------------------------------------*/
157 /*----------------------------------------------------------------------------*/
158 
159 static inline void
160 cs_connect_get_next_3_vertices(const cs_lnum_t *f2e_ids,
161  const cs_lnum_t *e2v_ids,
162  const cs_lnum_t start_idx,
163  cs_lnum_t *v0,
164  cs_lnum_t *v1,
165  cs_lnum_t *v2)
166 {
167  const cs_lnum_t _2e0 = 2*f2e_ids[start_idx],
168  _2e1 = 2*f2e_ids[start_idx+1];
169  const cs_lnum_t tmp = e2v_ids[_2e1];
170 
171  *v0 = e2v_ids[_2e0];
172  *v1 = e2v_ids[_2e0+1];
173  *v2 = ((tmp != *v0) && (tmp != *v1)) ? tmp : e2v_ids[_2e1+1];
174 }
175 
176 /*============================================================================
177  * Public function prototypes
178  *============================================================================*/
179 
180 /*----------------------------------------------------------------------------*/
188 /*----------------------------------------------------------------------------*/
189 
192 
193 /*----------------------------------------------------------------------------*/
210 /*----------------------------------------------------------------------------*/
211 
214  cs_flag_t eb_scheme_flag,
215  cs_flag_t fb_scheme_flag,
216  cs_flag_t vb_scheme_flag,
217  cs_flag_t vcb_scheme_flag,
218  cs_flag_t hho_scheme_flag);
219 
220 /*----------------------------------------------------------------------------*/
228 /*----------------------------------------------------------------------------*/
229 
232 
233 /*----------------------------------------------------------------------------*/
244 /*----------------------------------------------------------------------------*/
245 
246 void
248  const cs_real_t *edge_values,
249  cs_real_t **p_curl_values);
250 
251 /*----------------------------------------------------------------------------*/
262 /*----------------------------------------------------------------------------*/
263 
264 void
266  const cs_real_t *edge_values,
267  cs_real_t **p_curl_values);
268 
269 /*----------------------------------------------------------------------------*/
278 /*----------------------------------------------------------------------------*/
279 
280 void
282  cs_flag_t eb_scheme_flag,
283  cs_flag_t vb_scheme_flag,
284  cs_flag_t vcb_scheme_flag);
285 
286 /*----------------------------------------------------------------------------*/
293 /*----------------------------------------------------------------------------*/
294 
295 void
296 cs_cdo_connect_dump(const cs_cdo_connect_t *connect);
297 
298 /*----------------------------------------------------------------------------*/
299 
301 
302 #endif /* __CS_CDO_CONNECT_H__ */
unsigned long cs_gnum_t
global mesh entity number
Definition: cs_defs.h:301
cs_lnum_t v_max_cell_range
Definition: cs_cdo_connect.h:113
cs_adjacency_t * c2v
Definition: cs_cdo_connect.h:106
cs_cdo_connect_t * cs_cdo_connect_init(cs_mesh_t *mesh, cs_flag_t eb_scheme_flag, cs_flag_t fb_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:1023
cs_adjacency_t * e2v
Definition: cs_cdo_connect.h:89
Definition: cs_mesh_adjacencies.h:68
cs_adjacency_t * f2f
Definition: cs_cdo_connect.h:127
int n_max_vbyc
Definition: cs_cdo_connect.h:117
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
cs_adjacency_t * bf2v
Definition: cs_cdo_connect.h:95
cs_adjacency_t * f2c
Definition: cs_cdo_connect.h:93
void cs_cdo_connect_dump(const cs_cdo_connect_t *connect)
Dump a cs_cdo_connect_t structure.
Definition: cs_cdo_connect.c:1465
fvm_element_t * cell_type
Definition: cs_cdo_connect.h:102
Definition: cs_cdo_connect.h:79
int n_max_vbyf
Definition: cs_cdo_connect.h:120
cs_lnum_t n_cells
Definition: cs_cdo_connect.h:85
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
int n_max_ebyc
Definition: cs_cdo_connect.h:118
cs_adjacency_t * f2e
Definition: cs_cdo_connect.h:94
cs_adjacency_t * e2e
Definition: cs_cdo_connect.h:128
Definition: cs_mesh.h:84
cs_lnum_t n_edges
Definition: cs_cdo_connect.h:82
cs_lnum_t n_vertices
Definition: cs_cdo_connect.h:81
cs_cdo_connect_t * cs_cdo_connect_free(cs_cdo_connect_t *connect)
Destroy a cs_cdo_connect_t structure.
Definition: cs_cdo_connect.c:1234
fvm_element_t
Definition: fvm_defs.h:48
#define CS_CDO_CONNECT_N_CASES
Definition: cs_cdo_connect.h:67
cs_adjacency_t * if2v
Definition: cs_cdo_connect.h:97
cs_adjacency_t * c2e
Definition: cs_cdo_connect.h:105
void cs_cdo_connect_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 connectivity information.
Definition: cs_cdo_connect.c:1345
cs_flag_t * cell_flag
Definition: cs_cdo_connect.h:103
int n_max_v2fc
Definition: cs_cdo_connect.h:121
Definition: cs_range_set.h:57
int n_max_v2ec
Definition: cs_cdo_connect.h:122
struct _cs_interface_set_t cs_interface_set_t
Definition: cs_interface.h:61
cs_lnum_t e_max_cell_range
Definition: cs_cdo_connect.h:112
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:316
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.
Definition: cs_cdo_connect.c:948
#define END_C_DECLS
Definition: cs_defs.h:511
int n_max_fbyc
Definition: cs_cdo_connect.h:119
unsigned short int cs_flag_t
Definition: cs_defs.h:324
cs_gnum_t n_g_edges
Definition: cs_cdo_connect.h:83
cs_adjacency_t * c2f
Definition: cs_cdo_connect.h:104
Definition: mesh.f90:26
cs_adjacency_t * v2v
Definition: cs_cdo_connect.h:126
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:1300