My Project
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-2019 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  cs_adjacency_t *if2v; /* interior face --> vertices connectivity
90  (map from cs_mesh_t) */
91 
92  /* Cell-related members */
93  fvm_element_t *cell_type; /* type of cell */
94  cs_flag_t *cell_flag; /* Flag (Border) */
95  cs_adjacency_t *c2f; /* cell --> faces connectivity */
96  cs_adjacency_t *c2e; /* cell --> edges connectivity */
97  cs_adjacency_t *c2v; /* cell --> vertices connectivity */
98 
99  /* Delta of ids between the min./max. values of entities related to a cell
100  Useful to store compactly the link between mesh ids and cell mesh ids
101  needed during the cell mesh definition */
104 
105  /* Max. connectitivy size for cells */
106  int n_max_vbyc; /* max. number of vertices in a cell */
107  int n_max_ebyc; /* max. number of edges in a cell */
108  int n_max_fbyc; /* max. number of faces in a cell */
109  int n_max_vbyf; /* max. number of vertices in a face */
110  int n_max_v2fc; /* max. number of faces connected to a vertex in a cell */
111  int n_max_v2ec; /* max. number of edges connected to a vertex in a cell */
112 
113  /* Adjacency related to most of the linear systems */
114  cs_adjacency_t *v2v; /* vertex to vertices through cells */
115  cs_adjacency_t *f2f; /* face to faces through cells */
116 
117  /* Structures to handle parallelism/assembler */
120 
122 
123 /*============================================================================
124  * Global variables
125  *============================================================================*/
126 
127 /*============================================================================
128  * Static Inline Public function prototypes
129  *============================================================================*/
130 
131 /*----------------------------------------------------------------------------*/
143 /*----------------------------------------------------------------------------*/
144 
145 static inline void
147  const cs_lnum_t *e2v_ids,
148  const cs_lnum_t start_idx,
149  cs_lnum_t *v0,
150  cs_lnum_t *v1,
151  cs_lnum_t *v2)
152 {
153  const cs_lnum_t _2e0 = 2*f2e_ids[start_idx],
154  _2e1 = 2*f2e_ids[start_idx+1];
155  const cs_lnum_t tmp = e2v_ids[_2e1];
156 
157  *v0 = e2v_ids[_2e0];
158  *v1 = e2v_ids[_2e0+1];
159  *v2 = ((tmp != *v0) && (tmp != *v1)) ? tmp : e2v_ids[_2e1+1];
160 }
161 
162 /*============================================================================
163  * Public function prototypes
164  *============================================================================*/
165 
166 /*----------------------------------------------------------------------------*/
182 /*----------------------------------------------------------------------------*/
183 
186  cs_flag_t vb_scheme_flag,
187  cs_flag_t vcb_scheme_flag,
188  cs_flag_t fb_scheme_flag,
189  cs_flag_t hho_scheme_flag);
190 
191 /*----------------------------------------------------------------------------*/
199 /*----------------------------------------------------------------------------*/
200 
203 
204 /*----------------------------------------------------------------------------*/
210 /*----------------------------------------------------------------------------*/
211 
212 void
214 
215 /*----------------------------------------------------------------------------*/
222 /*----------------------------------------------------------------------------*/
223 
224 void
225 cs_cdo_connect_dump(const cs_cdo_connect_t *connect);
226 
227 /*----------------------------------------------------------------------------*/
228 
230 
231 #endif /* __CS_CDO_CONNECT_H__ */
cs_cdo_connect_t::n_max_vbyf
int n_max_vbyf
Definition: cs_cdo_connect.h:109
cs_cdo_connect_t::cell_flag
cs_flag_t * cell_flag
Definition: cs_cdo_connect.h:94
cs_cdo_connect_t::n_max_v2fc
int n_max_v2fc
Definition: cs_cdo_connect.h:110
cs_interface_set_t
struct _cs_interface_set_t cs_interface_set_t
Definition: cs_interface.h:61
cs_cdo_connect_init
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:797
cs_cdo_connect_t::c2f
cs_adjacency_t * c2f
Definition: cs_cdo_connect.h:95
cs_cdo_connect_t::c2e
cs_adjacency_t * c2e
Definition: cs_cdo_connect.h:96
cs_cdo_connect_t::e_max_cell_range
cs_lnum_t e_max_cell_range
Definition: cs_cdo_connect.h:102
cs_cdo_connect_free
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:967
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
cs_cdo_connect_t::c2v
cs_adjacency_t * c2v
Definition: cs_cdo_connect.h:97
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_cdo_connect_t::e2v
cs_adjacency_t * e2v
Definition: cs_cdo_connect.h:82
mesh
Definition: mesh.f90:26
cs_cdo_connect_t::n_vertices
cs_lnum_t n_vertices
Definition: cs_cdo_connect.h:76
cs_cdo_connect_t::f2f
cs_adjacency_t * f2f
Definition: cs_cdo_connect.h:115
cs_mesh.h
cs_range_set.h
fvm_element_t
fvm_element_t
Definition: fvm_defs.h:48
cs_cdo_connect_summary
void cs_cdo_connect_summary(const cs_cdo_connect_t *connect)
Summary of connectivity information.
Definition: cs_cdo_connect.c:1018
CS_CDO_CONNECT_N_CASES
#define CS_CDO_CONNECT_N_CASES
Definition: cs_cdo_connect.h:64
cs_cdo_connect_t::v_max_cell_range
cs_lnum_t v_max_cell_range
Definition: cs_cdo_connect.h:103
cs_cdo_connect_t::v2v
cs_adjacency_t * v2v
Definition: cs_cdo_connect.h:114
cs_cdo_connect_t::cell_type
fvm_element_t * cell_type
Definition: cs_cdo_connect.h:93
cs_cdo_connect_t::n_cells
cs_lnum_t n_cells
Definition: cs_cdo_connect.h:79
cs_mesh_adjacencies.h
cs_cdo_connect_t::n_max_vbyc
int n_max_vbyc
Definition: cs_cdo_connect.h:106
cs_cdo_connect_dump
void cs_cdo_connect_dump(const cs_cdo_connect_t *connect)
Dump a cs_cdo_connect_t structure.
Definition: cs_cdo_connect.c:1105
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_cdo_connect_t
Definition: cs_cdo_connect.h:74
cs_range_set_t
Definition: cs_range_set.h:57
cs_adjacency_t
Definition: cs_mesh_adjacencies.h:90
cs_flag.h
cs_connect_get_next_3_vertices
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:146
cs_cdo_connect_t::f2c
cs_adjacency_t * f2c
Definition: cs_cdo_connect.h:85
cs_cdo_connect_t::n_max_fbyc
int n_max_fbyc
Definition: cs_cdo_connect.h:108
cs_cdo_connect_t::bf2v
cs_adjacency_t * bf2v
Definition: cs_cdo_connect.h:87
cs_flag_t
unsigned short int cs_flag_t
Definition: cs_defs.h:304
cs_cdo_connect_t::n_max_v2ec
int n_max_v2ec
Definition: cs_cdo_connect.h:111
fvm_defs.h
cs_cdo_connect_t::n_edges
cs_lnum_t n_edges
Definition: cs_cdo_connect.h:77
cs_mesh_t
Definition: cs_mesh.h:63
cs_cdo_connect_t::if2v
cs_adjacency_t * if2v
Definition: cs_cdo_connect.h:89
cs_base.h
cs_cdo_connect_t::n_max_ebyc
int n_max_ebyc
Definition: cs_cdo_connect.h:107
cs_cdo_connect_t::f2e
cs_adjacency_t * f2e
Definition: cs_cdo_connect.h:86