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