programmer's 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-2018 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 */
54 #define CS_CDO_CONNECT_VTX_SCAL 0 /* Vb or VCb scalar-valued eq. */
55 #define CS_CDO_CONNECT_VTX_VECT 1 /* Vb or VCb vector-valued eq. */
56 #define CS_CDO_CONNECT_FACE_SP0 2 /* Fb or HHO-P0 scalar-valued eq. */
57 #define CS_CDO_CONNECT_FACE_VP0 3 /* Fb vector-valued eq. */
58 #define CS_CDO_CONNECT_FACE_SP1 3 /* HHO-P1 scalar-valued */
59 #define CS_CDO_CONNECT_FACE_SP2 4 /* HHO-P2 scalar-valued eq. */
60 #define CS_CDO_CONNECT_FACE_VHP0 3 /* HHO-P0 vector-valued eq. */
61 #define CS_CDO_CONNECT_FACE_VHP1 5 /* HHO-P1 vector-valued eq. */
62 #define CS_CDO_CONNECT_FACE_VHP2 6 /* HHO-P2 vector-valued eq. */
63 
64 #define CS_CDO_CONNECT_N_CASES 7
65 
66 /* Additional macros */
67 #define CS_TRIANGLE_CASE 3 /* Number of vertices in a triangle */
68 
69 /*============================================================================
70  * Type definitions
71  *============================================================================*/
72 
73 /* Connectivity structure */
74 typedef struct {
75 
78  cs_lnum_t n_faces[3]; /* 0: all, 1: border, 2: interior */
80 
81  /* Edge-related members */
82  cs_adjacency_t *e2v; /* edge --> vertices connectivity */
83 
84  /* Face-related members */
85  cs_adjacency_t *f2c; /* face --> cells connectivity */
86  cs_adjacency_t *f2e; /* face --> edges connectivity */
87  cs_adjacency_t *bf2v; /* border face --> vertices connectivity
88  (map from cs_mesh_t) */
89 
90  /* Cell-related members */
91  fvm_element_t *cell_type; /* type of cell */
92  cs_flag_t *cell_flag; /* Flag (Border) */
93  cs_adjacency_t *c2f; /* cell --> faces connectivity */
94  cs_adjacency_t *c2e; /* cell --> edges connectivity */
95  cs_adjacency_t *c2v; /* cell --> vertices connectivity */
96 
97  /* Delta of ids between the min./max. values of entities related to a cell
98  Useful to store compactly the link between mesh ids and cell mesh ids
99  needed during the cell mesh definition */
102 
103  /* Max. connectitivy size for cells */
104  int n_max_vbyc; /* max. number of vertices in a cell */
105  int n_max_ebyc; /* max. number of edges in a cell */
106  int n_max_fbyc; /* max. number of faces in a cell */
107  int n_max_vbyf; /* max. number of vertices in a face */
108  int n_max_v2fc; /* max. number of faces connected to a vertex in a cell */
109  int n_max_v2ec; /* max. number of edges connected to a vertex in a cell */
110 
111  /* Structures to handle parallelism/assembler */
114 
116 
117 /*============================================================================
118  * Global variables
119  *============================================================================*/
120 
121 /*============================================================================
122  * Static Inline Public function prototypes
123  *============================================================================*/
124 
125 /*----------------------------------------------------------------------------*/
137 /*----------------------------------------------------------------------------*/
138 
139 static inline void
141  const cs_lnum_t *e2v_ids,
142  const cs_lnum_t start_idx,
143  cs_lnum_t *v0,
144  cs_lnum_t *v1,
145  cs_lnum_t *v2)
146 {
147  const cs_lnum_t _2e0 = 2*f2e_ids[start_idx],
148  _2e1 = 2*f2e_ids[start_idx+1];
149  const cs_lnum_t tmp = e2v_ids[_2e1];
150 
151  *v0 = e2v_ids[_2e0];
152  *v1 = e2v_ids[_2e0+1];
153  *v2 = ((tmp != *v0) && (tmp != *v1)) ? tmp : e2v_ids[_2e1+1];
154 }
155 
156 /*============================================================================
157  * Public function prototypes
158  *============================================================================*/
159 
160 /*----------------------------------------------------------------------------*/
176 /*----------------------------------------------------------------------------*/
177 
180  cs_flag_t vb_scheme_flag,
181  cs_flag_t vcb_scheme_flag,
182  cs_flag_t fb_scheme_flag,
183  cs_flag_t hho_scheme_flag);
184 
185 /*----------------------------------------------------------------------------*/
193 /*----------------------------------------------------------------------------*/
194 
197 
198 /*----------------------------------------------------------------------------*/
204 /*----------------------------------------------------------------------------*/
205 
206 void
208 
209 /*----------------------------------------------------------------------------*/
216 /*----------------------------------------------------------------------------*/
217 
218 void
219 cs_cdo_connect_dump(const cs_cdo_connect_t *connect);
220 
221 /*----------------------------------------------------------------------------*/
222 
224 
225 #endif /* __CS_CDO_CONNECT_H__ */
cs_lnum_t v_max_cell_range
Definition: cs_cdo_connect.h:101
cs_adjacency_t * c2v
Definition: cs_cdo_connect.h:95
cs_adjacency_t * e2v
Definition: cs_cdo_connect.h:82
Definition: cs_mesh_adjacencies.h:90
int n_max_vbyc
Definition: cs_cdo_connect.h:104
#define BEGIN_C_DECLS
Definition: cs_defs.h:462
cs_adjacency_t * bf2v
Definition: cs_cdo_connect.h:87
cs_adjacency_t * f2c
Definition: cs_cdo_connect.h:85
void cs_cdo_connect_dump(const cs_cdo_connect_t *connect)
Dump a cs_cdo_connect_t structure.
Definition: cs_cdo_connect.c:939
fvm_element_t * cell_type
Definition: cs_cdo_connect.h:91
Definition: cs_cdo_connect.h:74
int n_max_vbyf
Definition: cs_cdo_connect.h:107
cs_lnum_t n_cells
Definition: cs_cdo_connect.h:79
int n_max_ebyc
Definition: cs_cdo_connect.h:105
cs_adjacency_t * f2e
Definition: cs_cdo_connect.h:86
Definition: cs_mesh.h:63
cs_cdo_connect_t * cs_cdo_connect_init(cs_mesh_t *mesh, cs_flag_t vb_scheme_flag, cs_flag_t vcb_scheme_flag, cs_flag_t fb_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:659
cs_lnum_t n_edges
Definition: cs_cdo_connect.h:77
cs_lnum_t n_vertices
Definition: cs_cdo_connect.h:76
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:822
fvm_element_t
Definition: fvm_defs.h:48
#define CS_CDO_CONNECT_N_CASES
Definition: cs_cdo_connect.h:64
cs_adjacency_t * c2e
Definition: cs_cdo_connect.h:94
cs_flag_t * cell_flag
Definition: cs_cdo_connect.h:92
int n_max_v2fc
Definition: cs_cdo_connect.h:108
Definition: cs_range_set.h:57
int n_max_v2ec
Definition: cs_cdo_connect.h:109
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:140
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:100
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:293
void cs_cdo_connect_summary(const cs_cdo_connect_t *connect)
Summary of connectivity information.
Definition: cs_cdo_connect.c:869
#define END_C_DECLS
Definition: cs_defs.h:463
int n_max_fbyc
Definition: cs_cdo_connect.h:106
unsigned short int cs_flag_t
Definition: cs_defs.h:299
cs_adjacency_t * c2f
Definition: cs_cdo_connect.h:93
Definition: mesh.f90:26