9.2
general documentation
fvm_nodal_priv.h
Go to the documentation of this file.
1#ifndef FVM_NODAL_PRIV_H
2#define FVM_NODAL_PRIV_H
3
4/*============================================================================
5 * Main structure for a nodal representation associated with a mesh
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2026 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#include "base/cs_defs.h"
31
32/*----------------------------------------------------------------------------
33 * Local headers
34 *----------------------------------------------------------------------------*/
35
36#include "mesh/cs_mesh.h"
37#include "fvm/fvm_defs.h"
38#include "fvm/fvm_group.h"
39#include "fvm/fvm_nodal.h"
40#include "fvm/fvm_tesselation.h"
41
42/*=============================================================================
43 * Macro definitions
44 *============================================================================*/
45
46/*============================================================================
47 * Type definitions
48 *============================================================================*/
49
50/*----------------------------------------------------------------------------
51 * Structure defining a mesh section
52 *----------------------------------------------------------------------------*/
53
54typedef struct _fvm_nodal_section_t {
55
56 /* Basic information */
57 /*-------------------*/
58
59 int entity_dim; /* Entity dimension */
60
61 cs_lnum_t n_elements; /* Number of elements */
62
63 fvm_element_t type; /* Element types */
64
65 int boundary_flag; /* Is section on boundary ?
66 -1: does not apply or unspecified;
67 0: no
68 1: yes */
69
70 /* Connectivity */
71 /*--------------*/
72
73 size_t connectivity_size; /* Size of vertex_num array;
74 for strided elements:
75 (n_elements * stride)
76 for polygons:
77 (vertex_index[n_elements])
78 for polyhedra:
79 (vertex_index[n_faces]) */
80
81 int stride; /* Element size for regular elements
82 (0 for polygons and polyhedra) */
83
84 cs_lnum_t n_faces; /* Number of faces defining polyhedra */
85
86 /* Pointers to connectivity arrays, which may be shared */
87
88 const cs_lnum_t *face_index; /* polyhedron -> faces index (O to n-1);
89 size: n_elements + 1 */
90 const cs_lnum_t *face_num; /* polyhedron -> face numbers (1 to n, signed,
91 > 0 for outwards pointing face normal
92 < 0 for inwards pointing face normal);
93 size: face_index[n_elements] */
94
95 const cs_lnum_t *vertex_index; /* polygon face -> vertices index (O to n-1);
96 size: n_faces + 1 */
97
98 const cs_lnum_t *vertex_num; /* vertex numbers (1 to n);
99 size: connectivity_size */
100
101 /* Pointers to local connectivity arrays, if owner */
102
103 cs_lnum_t *_face_index; /* face_index if owner, NULL if shared */
104 cs_lnum_t *_face_num; /* face_num if owner, NULL if shared */
105 cs_lnum_t *_vertex_index; /* vertex_index if owner, NULL if shared */
106 cs_lnum_t *_vertex_num; /* vertex numbers if owner, NULL if shared */
107
108 /* Pointers to group class ids, if present */
109
110 int *gc_id; /* Group class id, NULL if implicit 0 */
111
112 /* Optional tagging */
113
114 int *tag; /* Element tag */
115
116 /* Auxiliary structure used to define subdivision of elements into
117 simpler element types (usually polygons to triangles and
118 polyhedra to tetrahedra and pyramids) */
119
121
122 /* Numbering */
123 /*-----------*/
124
125 const cs_lnum_t *parent_element_id; /* Local ids (0 to n-1) of local
126 elements in the parent mesh,
127 associated with the section's
128 elements.
129
130 This array is necessary to redis-
131 tribute output fields when the
132 section has been either associated
133 with an unsorted mixed mesh,
134 renumbered, or is associated with a
135 subset of a more complete mesh,
136 such as a clip plane. When used for
137 a subset, it also defines the lists
138 of elements of the parent mesh
139 belonging to that subset.
140
141 This array is present only when non
142 "trivial" (i.e. not 0, 1, ..., n-1). */
143
144 cs_lnum_t *_parent_element_id; /* pointer to parent_element_num if
145 owner, NULL otherwise */
146
147 fvm_io_num_t *global_element_num; /* Global element numbers */
148
150
151/*----------------------------------------------------------------------------
152 * Structure defining a mesh in nodal definition
153 *----------------------------------------------------------------------------*/
154
156
157 /* Global indicators */
158 /*-------------------*/
159
160 char *name; /* Mesh name */
161
162 int dim; /* Spatial dimension */
163 int num_dom; /* Local domain number */
164 int n_doms; /* Global number of domains */
165 int n_sections; /* Number of sections */
166
167 /* Local dimensions */
168 /*------------------*/
169
170 /* Total number of cells, faces, edges, and vertices */
175
176 /* Vertex definitions; */
177 /*---------------------*/
178
179 const cs_coord_t *vertex_coords; /* pointer to vertex coordinates
180 (always interlaced:
181 x1, y1, z1, x2, y2, z2, ...) */
182 cs_coord_t *_vertex_coords; /* pointer to vertex coordinates if
183 owner (for use with own algorithms) */
184
185 const cs_lnum_t *parent_vertex_id; /* Local ids (0 to n-1) of local
186 vertices in the parent mesh.
187
188 This array is necessary to redis-
189 tribute output fields when a nodal
190 mesh has been renumbered or is
191 associated with a subset of a more
192 complete mesh, such as a clip plane
193 (in which case it also defines the
194 lists of vertices of the parent
195 mesh in that subset).
196
197 This array is present only when non
198 "trivial" (i.e. not 0, 1, ..., n-1). */
199
200 cs_lnum_t *_parent_vertex_id; /* pointer to parent_vertex_id if
201 owner, NULL otherwise */
202
203 fvm_io_num_t *global_vertex_num; /* Global vertex numbering */
204
205 /* Mesh connectivity */
206 /*-------------------*/
207
208 fvm_nodal_section_t **sections; /* Array of section descriptions */
209
210 /* Metadata */
211 /*----------*/
212
213 /* Group class descriptions if present */
214
215 fvm_group_class_set_t *gc_set; /* Pointer to group class set, or NULL */
216
217 /* Optional global vertex labels.
218 As these are expected to be used only for small sets (i.e. probes)
219 where the point set is built from a global definition and data movement
220 would adds complexity and overhead, the labels refer to a global view
221 on rank 0; for the same reason, only shared labels are needed */
222
223 char **global_vertex_labels; /* Pointer to vertex labels, or NULL */
224
225 /* Pointer to parent mesh, if defined */
226
228
229};
230
231/*=============================================================================
232 * Semi-private function prototypes
233 *============================================================================*/
234
235/*----------------------------------------------------------------------------
236 * Creation of a nodal mesh section representation structure.
237 *
238 * parameters:
239 * type <-- type of element defined by this section
240 *
241 * returns:
242 * pointer to created nodal mesh section representation structure
243 *----------------------------------------------------------------------------*/
244
247
248/*----------------------------------------------------------------------------
249 * Destruction of a nodal mesh section representation structure.
250 *
251 * parameters:
252 * this_section <-> pointer to structure that should be destroyed
253 *
254 * returns:
255 * null pointer
256 *----------------------------------------------------------------------------*/
257
260
261/*----------------------------------------------------------------------------
262 * Copy selected shared connectivity information to private connectivity
263 * for a nodal mesh section .
264 *
265 * parameters:
266 * this_section <-> pointer to section structure
267 * copy_face_index <-- copy face index (polyhedra only) ?
268 * copy_face_num <-- copy face numbers (polyhedra only) ?
269 * copy_vertex_index <-- copy vertex index (polyhedra/polygons only) ?
270 * copy_vertex_num <-- copy vertex numbers ?
271 *----------------------------------------------------------------------------*/
272
273void
275 bool copy_face_index,
276 bool copy_face_num,
277 bool copy_vertex_index,
278 bool copy_vertex_num);
279
280/*----------------------------------------------------------------------------
281 * Return global number of elements associated with section.
282 *
283 * parameters:
284 * this_section <-- pointer to section structure
285 *
286 * returns:
287 * global number of elements associated with section
288 *----------------------------------------------------------------------------*/
289
292
293/*----------------------------------------------------------------------------
294 * Return global number of vertices associated with nodal mesh.
295 *
296 * parameters:
297 * this_nodal <-- pointer to nodal mesh structure
298 *
299 * returns:
300 * global number of vertices associated with nodal mesh
301 *----------------------------------------------------------------------------*/
302
304fvm_nodal_n_g_vertices(const fvm_nodal_t *this_nodal);
305
306/*----------------------------------------------------------------------------
307 * Define cell->face connectivity for strided cell types.
308 *
309 * parameters:
310 * element_type <-- type of strided element
311 * n_faces --> number of element faces
312 * n_face_vertices --> number of vertices of each face
313 * face_vertices --> face -> vertex base connectivity (0 to n-1)
314 *----------------------------------------------------------------------------*/
315
316void
318 int *n_faces,
319 int n_face_vertices[6],
320 int face_vertices[6][4]);
321
322/*----------------------------------------------------------------------------*/
323
324#endif /* FVM_NODAL_PRIV_H */
double cs_coord_t
Definition: cs_defs.h:330
unsigned cs_gnum_t
global mesh entity number
Definition: cs_defs.h:317
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
fvm_element_t
Definition: fvm_defs.h:44
struct _fvm_group_class_set_t fvm_group_class_set_t
Definition: fvm_group.h:56
struct _fvm_io_num_t fvm_io_num_t
Definition: fvm_io_num.h:72
void fvm_nodal_cell_face_connect(fvm_element_t element_type, int *n_faces, int n_face_vertices[6], int face_vertices[6][4])
cs_gnum_t fvm_nodal_section_n_g_elements(const fvm_nodal_section_t *this_section)
fvm_nodal_section_t * fvm_nodal_section_destroy(fvm_nodal_section_t *this_section)
fvm_nodal_section_t * fvm_nodal_section_create(const fvm_element_t type)
cs_gnum_t fvm_nodal_n_g_vertices(const fvm_nodal_t *this_nodal)
void fvm_nodal_section_copy_on_write(fvm_nodal_section_t *this_section, bool copy_face_index, bool copy_face_num, bool copy_vertex_index, bool copy_vertex_num)
struct _fvm_tesselation_t fvm_tesselation_t
Definition: fvm_tesselation.h:65
Definition: fvm_nodal_priv.h:155
cs_coord_t * _vertex_coords
Definition: fvm_nodal_priv.h:182
int n_sections
Definition: fvm_nodal_priv.h:165
cs_lnum_t n_faces
Definition: fvm_nodal_priv.h:172
cs_lnum_t * _parent_vertex_id
Definition: fvm_nodal_priv.h:200
const cs_coord_t * vertex_coords
Definition: fvm_nodal_priv.h:179
char * name
Definition: fvm_nodal_priv.h:160
int dim
Definition: fvm_nodal_priv.h:162
fvm_io_num_t * global_vertex_num
Definition: fvm_nodal_priv.h:203
const cs_mesh_t * parent
Definition: fvm_nodal_priv.h:227
fvm_group_class_set_t * gc_set
Definition: fvm_nodal_priv.h:215
int num_dom
Definition: fvm_nodal_priv.h:163
cs_lnum_t n_cells
Definition: fvm_nodal_priv.h:171
fvm_nodal_section_t ** sections
Definition: fvm_nodal_priv.h:208
const cs_lnum_t * parent_vertex_id
Definition: fvm_nodal_priv.h:185
cs_lnum_t n_vertices
Definition: fvm_nodal_priv.h:174
char ** global_vertex_labels
Definition: fvm_nodal_priv.h:223
cs_lnum_t n_edges
Definition: fvm_nodal_priv.h:173
int n_doms
Definition: fvm_nodal_priv.h:164
Definition: cs_mesh.h:85
Definition: fvm_nodal_priv.h:54
int stride
Definition: fvm_nodal_priv.h:81
const cs_lnum_t * vertex_index
Definition: fvm_nodal_priv.h:95
cs_lnum_t * _face_num
Definition: fvm_nodal_priv.h:104
const cs_lnum_t * face_num
Definition: fvm_nodal_priv.h:90
fvm_element_t type
Definition: fvm_nodal_priv.h:63
int * tag
Definition: fvm_nodal_priv.h:114
cs_lnum_t * _vertex_index
Definition: fvm_nodal_priv.h:105
cs_lnum_t n_faces
Definition: fvm_nodal_priv.h:84
fvm_io_num_t * global_element_num
Definition: fvm_nodal_priv.h:147
cs_lnum_t * _face_index
Definition: fvm_nodal_priv.h:103
int * gc_id
Definition: fvm_nodal_priv.h:110
cs_lnum_t n_elements
Definition: fvm_nodal_priv.h:61
fvm_tesselation_t * tesselation
Definition: fvm_nodal_priv.h:120
int entity_dim
Definition: fvm_nodal_priv.h:59
size_t connectivity_size
Definition: fvm_nodal_priv.h:73
cs_lnum_t * _vertex_num
Definition: fvm_nodal_priv.h:106
const cs_lnum_t * vertex_num
Definition: fvm_nodal_priv.h:98
int boundary_flag
Definition: fvm_nodal_priv.h:65
const cs_lnum_t * face_index
Definition: fvm_nodal_priv.h:88
cs_lnum_t * _parent_element_id
Definition: fvm_nodal_priv.h:144
const cs_lnum_t * parent_element_id
Definition: fvm_nodal_priv.h:125