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