7.0
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 #define CS_CDO_CONNECT_VTX_SCAL 0 /* Vb or VCb scalar-valued DoF */
56 #define CS_CDO_CONNECT_VTX_VECT 1 /* Vb or VCb vector-valued DoF */
57 #define CS_CDO_CONNECT_FACE_SP0 2 /* Fb or HHO-P0 scalar-valued DoF */
58 #define CS_CDO_CONNECT_FACE_VP0 3 /* Fb vector-valued DoF */
59 #define CS_CDO_CONNECT_FACE_SP1 3 /* HHO-P1 scalar-valued */
60 #define CS_CDO_CONNECT_FACE_SP2 4 /* HHO-P2 scalar-valued DoF */
61 #define CS_CDO_CONNECT_FACE_VHP0 3 /* HHO-P0 vector-valued DoF */
62 #define CS_CDO_CONNECT_FACE_VHP1 5 /* HHO-P1 vector-valued DoF */
63 #define CS_CDO_CONNECT_FACE_VHP2 6 /* HHO-P2 vector-valued DoF */
64 #define CS_CDO_CONNECT_EDGE_SCAL 7 /* Eb scalar-valued DoF */
65 
66 #define CS_CDO_CONNECT_N_CASES 8
67 
68 /* Additional macros */
69 #define CS_TRIANGLE_CASE 3 /* Number of vertices in a triangle */
70 
71 /*============================================================================
72  * Type definitions
73  *============================================================================*/
74 
75 /* Connectivity structure */
76 typedef struct {
77 
81  cs_lnum_t n_faces[3]; /* 0: all, 1: border, 2: interior */
83 
84  /* Edge-related members */
85  cs_adjacency_t *e2v; /* edge --> vertices connectivity */
86 
87  /* Face-related members */
88  cs_adjacency_t *f2c; /* face --> cells connectivity */
89  cs_adjacency_t *f2e; /* face --> edges connectivity */
90  cs_adjacency_t *bf2v; /* border face --> vertices connectivity
91  (map from cs_mesh_t) */
92  cs_adjacency_t *if2v; /* interior face --> vertices connectivity
93  (map from cs_mesh_t) */
94 
95  /* Cell-related members */
96  fvm_element_t *cell_type; /* type of cell */
97  cs_flag_t *cell_flag; /* Flag (Border/Solid) */
98  cs_adjacency_t *c2f; /* cell --> faces connectivity */
99  cs_adjacency_t *c2e; /* cell --> edges connectivity */
100  cs_adjacency_t *c2v; /* cell --> vertices connectivity */
101 
102  /* Delta of ids between the min./max. values of entities related to a cell
103  Useful to store compactly the link between mesh ids and cell mesh ids
104  needed during the cell mesh definition */
107 
108  /* Max. connectitivy size for cells */
109  int n_max_vbyc; /* max. number of vertices in a cell */
110  int n_max_ebyc; /* max. number of edges in a cell */
111  int n_max_fbyc; /* max. number of faces in a cell */
112  int n_max_vbyf; /* max. number of vertices in a face */
113  int n_max_v2fc; /* max. number of faces connected to a vertex in a cell */
114  int n_max_v2ec; /* max. number of edges connected to a vertex in a cell */
115 
116  /* Adjacency related to linear systems (allocated only if needed) */
117  cs_adjacency_t *v2v; /* vertex to vertices through cells */
118  cs_adjacency_t *f2f; /* face to faces through cells */
119  cs_adjacency_t *e2e; /* edge to edges through cells */
120 
121  /* Structures to handle parallelism/assembler */
124 
126 
127 /*============================================================================
128  * Global variables
129  *============================================================================*/
130 
131 /*============================================================================
132  * Static Inline Public function prototypes
133  *============================================================================*/
134 
135 /*----------------------------------------------------------------------------*/
147 /*----------------------------------------------------------------------------*/
148 
149 static inline void
150 cs_connect_get_next_3_vertices(const cs_lnum_t *f2e_ids,
151  const cs_lnum_t *e2v_ids,
152  const cs_lnum_t start_idx,
153  cs_lnum_t *v0,
154  cs_lnum_t *v1,
155  cs_lnum_t *v2)
156 {
157  const cs_lnum_t _2e0 = 2*f2e_ids[start_idx],
158  _2e1 = 2*f2e_ids[start_idx+1];
159  const cs_lnum_t tmp = e2v_ids[_2e1];
160 
161  *v0 = e2v_ids[_2e0];
162  *v1 = e2v_ids[_2e0+1];
163  *v2 = ((tmp != *v0) && (tmp != *v1)) ? tmp : e2v_ids[_2e1+1];
164 }
165 
166 /*============================================================================
167  * Public function prototypes
168  *============================================================================*/
169 
170 /*----------------------------------------------------------------------------*/
178 /*----------------------------------------------------------------------------*/
179 
182 
183 /*----------------------------------------------------------------------------*/
200 /*----------------------------------------------------------------------------*/
201 
204  cs_flag_t eb_scheme_flag,
205  cs_flag_t fb_scheme_flag,
206  cs_flag_t vb_scheme_flag,
207  cs_flag_t vcb_scheme_flag,
208  cs_flag_t hho_scheme_flag);
209 
210 /*----------------------------------------------------------------------------*/
218 /*----------------------------------------------------------------------------*/
219 
222 
223 /*----------------------------------------------------------------------------*/
234 /*----------------------------------------------------------------------------*/
235 
236 void
238  const cs_real_t *edge_values,
239  cs_real_t **p_curl_values);
240 
241 /*----------------------------------------------------------------------------*/
252 /*----------------------------------------------------------------------------*/
253 
254 void
256  const cs_real_t *edge_values,
257  cs_real_t **p_curl_values);
258 
259 /*----------------------------------------------------------------------------*/
268 /*----------------------------------------------------------------------------*/
269 
270 void
272  cs_flag_t eb_scheme_flag,
273  cs_flag_t vb_scheme_flag,
274  cs_flag_t vcb_scheme_flag);
275 
276 /*----------------------------------------------------------------------------*/
283 /*----------------------------------------------------------------------------*/
284 
285 void
286 cs_cdo_connect_dump(const cs_cdo_connect_t *connect);
287 
288 /*----------------------------------------------------------------------------*/
289 
291 
292 #endif /* __CS_CDO_CONNECT_H__ */
unsigned long cs_gnum_t
global mesh entity number
Definition: cs_defs.h:286
cs_lnum_t v_max_cell_range
Definition: cs_cdo_connect.h:106
cs_adjacency_t * c2v
Definition: cs_cdo_connect.h:100
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:988
cs_adjacency_t * e2v
Definition: cs_cdo_connect.h:85
Definition: cs_mesh_adjacencies.h:67
cs_adjacency_t * f2f
Definition: cs_cdo_connect.h:118
int n_max_vbyc
Definition: cs_cdo_connect.h:109
#define BEGIN_C_DECLS
Definition: cs_defs.h:495
cs_adjacency_t * bf2v
Definition: cs_cdo_connect.h:90
cs_adjacency_t * f2c
Definition: cs_cdo_connect.h:88
void cs_cdo_connect_dump(const cs_cdo_connect_t *connect)
Dump a cs_cdo_connect_t structure.
Definition: cs_cdo_connect.c:1402
fvm_element_t * cell_type
Definition: cs_cdo_connect.h:96
Definition: cs_cdo_connect.h:76
int n_max_vbyf
Definition: cs_cdo_connect.h:112
cs_lnum_t n_cells
Definition: cs_cdo_connect.h:82
double cs_real_t
Floating-point value.
Definition: cs_defs.h:307
int n_max_ebyc
Definition: cs_cdo_connect.h:110
cs_adjacency_t * f2e
Definition: cs_cdo_connect.h:89
cs_adjacency_t * e2e
Definition: cs_cdo_connect.h:119
Definition: cs_mesh.h:84
cs_lnum_t n_edges
Definition: cs_cdo_connect.h:79
cs_lnum_t n_vertices
Definition: cs_cdo_connect.h:78
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:1177
fvm_element_t
Definition: fvm_defs.h:48
#define CS_CDO_CONNECT_N_CASES
Definition: cs_cdo_connect.h:66
cs_adjacency_t * if2v
Definition: cs_cdo_connect.h:92
cs_adjacency_t * c2e
Definition: cs_cdo_connect.h:99
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:1286
cs_flag_t * cell_flag
Definition: cs_cdo_connect.h:97
int n_max_v2fc
Definition: cs_cdo_connect.h:113
Definition: cs_range_set.h:57
int n_max_v2ec
Definition: cs_cdo_connect.h:114
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:105
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:301
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:913
#define END_C_DECLS
Definition: cs_defs.h:496
int n_max_fbyc
Definition: cs_cdo_connect.h:111
unsigned short int cs_flag_t
Definition: cs_defs.h:309
cs_gnum_t n_g_edges
Definition: cs_cdo_connect.h:80
cs_adjacency_t * c2f
Definition: cs_cdo_connect.h:98
Definition: mesh.f90:26
cs_adjacency_t * v2v
Definition: cs_cdo_connect.h:117
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:1242