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: HHO-P1 and CDO-Fb vector-valued shares the same structures
52 */
53 #define CS_CDO_CONNECT_VTX_SCAL 0 /* Vb or VCb scalar-valued eq. */
54 #define CS_CDO_CONNECT_VTX_VECT 1 /* Vb or VCb vector-valued eq. */
55 #define CS_CDO_CONNECT_FACE_SP0 2 /* Fb or HHO-P0 scalar-valued eq. */
56 #define CS_CDO_CONNECT_FACE_SP1 3 /* HHO-P1 scalar-valued */
57 #define CS_CDO_CONNECT_FACE_VP0 3 /* Fb vector-valued eq. */
58 #define CS_CDO_CONNECT_FACE_SP2 4 /* HHO-P2 scalar-valued eq. */
59 #define CS_CDO_CONNECT_N_CASES 5
60 
61 /* Additional macros */
62 #define CS_TRIANGLE_CASE 3 /* Number of vertices in a triangle */
63 
64 /*============================================================================
65  * Type definitions
66  *============================================================================*/
67 
68 /* Connectivity structure */
69 typedef struct {
70 
73  cs_lnum_t n_faces[3]; // 0: all, 1: border, 2: interior
75 
76  /* Edge-related members */
77  cs_adjacency_t *e2v; // edge --> vertices connectivity
78 
79  /* Face-related members */
80  cs_adjacency_t *f2c; // face --> cells connectivity
81  cs_adjacency_t *f2e; // face --> edges connectivity
82 
83  /* Cell-related members */
84  fvm_element_t *cell_type; // type of cell
85  cs_flag_t *cell_flag; // Flag (Border)
86  cs_adjacency_t *c2f; // cell --> faces connectivity
87  cs_adjacency_t *c2e; // cell --> edges connectivity
88  cs_adjacency_t *c2v; // cell --> vertices connectivity
89 
90  /* Delta of ids between the min./max. values of entities related to a cell
91  Useful to store compactly the link between mesh ids and cell mesh ids
92  needed during the cell mesh definition */
95 
96  /* Max. connectitivy size for cells */
97  int n_max_vbyc; // max. number of vertices in a cell
98  int n_max_ebyc; // max. number of edges in a cell
99  int n_max_fbyc; // max. number of faces in a cell
100  int n_max_vbyf; // max. number of vertices in a face
101  int n_max_v2fc; // max. number of faces connected to a vertex in a cell
102  int n_max_v2ec; // max. number of edges connected to a vertex in a cell
103 
104  /* Structures to handle parallelism/assembler */
107 
109 
110 /*============================================================================
111  * Global variables
112  *============================================================================*/
113 
114 /*============================================================================
115  * Static Inline Public function prototypes
116  *============================================================================*/
117 
118 /*----------------------------------------------------------------------------*/
130 /*----------------------------------------------------------------------------*/
131 
132 static inline void
134  const cs_lnum_t *e2v_ids,
135  const cs_lnum_t start_idx,
136  cs_lnum_t *v0,
137  cs_lnum_t *v1,
138  cs_lnum_t *v2)
139 {
140  const cs_lnum_t _2e0 = 2*f2e_ids[start_idx],
141  _2e1 = 2*f2e_ids[start_idx+1];
142  const cs_lnum_t tmp = e2v_ids[_2e1];
143 
144  *v0 = e2v_ids[_2e0];
145  *v1 = e2v_ids[_2e0+1];
146  *v2 = ((tmp != *v0) && (tmp != *v1)) ? tmp : e2v_ids[_2e1+1];
147 }
148 
149 /*============================================================================
150  * Public function prototypes
151  *============================================================================*/
152 
153 /*----------------------------------------------------------------------------*/
169 /*----------------------------------------------------------------------------*/
170 
173  cs_flag_t vb_scheme_flag,
174  cs_flag_t vcb_scheme_flag,
175  cs_flag_t fb_scheme_flag,
176  cs_flag_t hho_scheme_flag);
177 
178 /*----------------------------------------------------------------------------*/
186 /*----------------------------------------------------------------------------*/
187 
190 
191 /*----------------------------------------------------------------------------*/
197 /*----------------------------------------------------------------------------*/
198 
199 void
201 
202 /*----------------------------------------------------------------------------*/
209 /*----------------------------------------------------------------------------*/
210 
211 void
212 cs_cdo_connect_dump(const cs_cdo_connect_t *connect);
213 
214 /*----------------------------------------------------------------------------*/
215 
217 
218 #endif /* __CS_CDO_CONNECT_H__ */
cs_lnum_t v_max_cell_range
Definition: cs_cdo_connect.h:94
cs_adjacency_t * c2v
Definition: cs_cdo_connect.h:88
cs_adjacency_t * e2v
Definition: cs_cdo_connect.h:77
Definition: cs_mesh_adjacencies.h:89
int n_max_vbyc
Definition: cs_cdo_connect.h:97
#define BEGIN_C_DECLS
Definition: cs_defs.h:461
cs_adjacency_t * f2c
Definition: cs_cdo_connect.h:80
void cs_cdo_connect_dump(const cs_cdo_connect_t *connect)
Dump a cs_cdo_connect_t structure.
Definition: cs_cdo_connect.c:1178
fvm_element_t * cell_type
Definition: cs_cdo_connect.h:84
Definition: cs_cdo_connect.h:69
int n_max_vbyf
Definition: cs_cdo_connect.h:100
cs_lnum_t n_cells
Definition: cs_cdo_connect.h:74
int n_max_ebyc
Definition: cs_cdo_connect.h:98
cs_adjacency_t * f2e
Definition: cs_cdo_connect.h:81
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:934
cs_lnum_t n_edges
Definition: cs_cdo_connect.h:72
cs_lnum_t n_vertices
Definition: cs_cdo_connect.h:71
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:1069
fvm_element_t
Definition: fvm_defs.h:48
#define CS_CDO_CONNECT_N_CASES
Definition: cs_cdo_connect.h:59
cs_adjacency_t * c2e
Definition: cs_cdo_connect.h:87
cs_flag_t * cell_flag
Definition: cs_cdo_connect.h:85
int n_max_v2fc
Definition: cs_cdo_connect.h:101
Definition: cs_range_set.h:57
int n_max_v2ec
Definition: cs_cdo_connect.h:102
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:133
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:93
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:1108
#define END_C_DECLS
Definition: cs_defs.h:462
int n_max_fbyc
Definition: cs_cdo_connect.h:99
unsigned short int cs_flag_t
Definition: cs_defs.h:299
cs_adjacency_t * c2f
Definition: cs_cdo_connect.h:86
Definition: mesh.f90:26