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