programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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-2014 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  /* Auxiliary structure used to define subdivision of elements into
111  simpler element types (usually polygons to triangles and
112  polyhedra to tetrahedra and pyramids) */
113 
114  fvm_tesselation_t *tesselation;
115 
116  /* Numbering */
117  /*-----------*/
118 
119  const cs_lnum_t *parent_element_num; /* Local numbers (1 to n) of local
120  elements in the parent mesh,
121  associated with the section's
122  elements.
123 
124  This array is necessary to redis-
125  tribute output fields when the
126  section has been either associated
127  with an unsorted mixed mesh,
128  renumbered, or is associated with a
129  subset of a more complete mesh,
130  such as a clip plane. When used for
131  a subset, it also defines the lists
132  of elements of the parent mesh
133  belonging to that subset.
134 
135  This array is present only when non
136  "trivial" (i.e. not 1, 2, ..., n). */
137 
138  cs_lnum_t *_parent_element_num; /* pointer to parent_element_num if
139  owner, NULL otherwise */
140 
141  fvm_io_num_t *global_element_num; /* Global element numbers */
142 
144 
145 /*----------------------------------------------------------------------------
146  * Structure defining a mesh in nodal definition
147  *----------------------------------------------------------------------------*/
148 
149 struct _fvm_nodal_t {
150 
151  /* Global indicators */
152  /*-------------------*/
153 
154  char *name; /* Mesh name */
155 
156  int dim; /* Spatial dimension */
157  int num_dom; /* Local domain number */
158  int n_doms; /* Global number of domains */
159  int n_sections; /* Number of sections */
160 
161  /* Local dimensions */
162  /*------------------*/
163 
164  /* Total number of cells, faces, edges, and vertices */
169 
170  /* Vertex definitions; */
171  /*---------------------*/
172 
173  const cs_coord_t *vertex_coords; /* pointer to vertex coordinates
174  (always interlaced:
175  x1, y1, z1, x2, y2, z2, ...) */
176  cs_coord_t *_vertex_coords; /* pointer to vertex coordinates if
177  owner (for use with own algorithms) */
178 
179  const cs_lnum_t *parent_vertex_num; /* Local numbers (1 to n) of local
180  vertices in the parent mesh.
181 
182  This array is necessary to redis-
183  tribute output fields when a nodal
184  mesh has been renumbered or is
185  associated with a subset of a more
186  complete mesh, such as a clip plane
187  (in which case it also defines the
188  lists of vertices of the parent
189  mesh in that subset).
190 
191  This array is present only when non
192  "trivial" (i.e. not 1, 2, ..., n). */
193 
194  cs_lnum_t *_parent_vertex_num; /* pointer to parent_vertex_num if
195  owner, NULL otherwise */
196 
197  fvm_io_num_t *global_vertex_num; /* Global vertex numbering */
198 
199  /* Mesh connectivity */
200  /*-------------------*/
201 
202  fvm_nodal_section_t **sections; /* Array of section descriptions */
203 
204  /* Group class descriptions if present */
205 
206  fvm_group_class_set_t *gc_set; /* Pointer to group class set, or NULL */
207 
208 };
209 
210 /*=============================================================================
211  * Semi-private function prototypes
212  *============================================================================*/
213 
214 /*----------------------------------------------------------------------------
215  * Creation of a nodal mesh section representation structure.
216  *
217  * parameters:
218  * type <-- type of element defined by this section
219  *
220  * returns:
221  * pointer to created nodal mesh section representation structure
222  *----------------------------------------------------------------------------*/
223 
226 
227 /*----------------------------------------------------------------------------
228  * Destruction of a nodal mesh section representation structure.
229  *
230  * parameters:
231  * this_section <-> pointer to structure that should be destroyed
232  *
233  * returns:
234  * NULL pointer
235  *----------------------------------------------------------------------------*/
236 
239 
240 /*----------------------------------------------------------------------------
241  * Copy selected shared connectivity information to private connectivity
242  * for a nodal mesh section .
243  *
244  * parameters:
245  * this_section <-> pointer to section structure
246  * copy_face_index <-- copy face index (polyhedra only) ?
247  * copy_face_num <-- copy face numbers (polyhedra only) ?
248  * copy_vertex_index <-- copy vertex index (polyhedra/polygons only) ?
249  * copy_vertex_num <-- copy vertex numbers ?
250  *----------------------------------------------------------------------------*/
251 
252 void
254  _Bool copy_face_index,
255  _Bool copy_face_num,
256  _Bool copy_vertex_index,
257  _Bool copy_vertex_num);
258 
259 /*----------------------------------------------------------------------------
260  * Return global number of elements associated with section.
261  *
262  * parameters:
263  * this_section <-- pointer to section structure
264  *
265  * returns:
266  * global number of elements associated with section
267  *----------------------------------------------------------------------------*/
268 
269 cs_gnum_t
271 
272 /*----------------------------------------------------------------------------
273  * Return global number of vertices associated with nodal mesh.
274  *
275  * parameters:
276  * this_nodal <-- pointer to nodal mesh structure
277  *
278  * returns:
279  * global number of vertices associated with nodal mesh
280  *----------------------------------------------------------------------------*/
281 
282 cs_gnum_t
283 fvm_nodal_n_g_vertices(const fvm_nodal_t *this_nodal);
284 
285 /*----------------------------------------------------------------------------
286  * Define cell->face connectivity for strided cell types.
287  *
288  * parameters:
289  * element_type <-- type of strided element
290  * n_faces --> number of element faces
291  * n_face_vertices --> number of vertices of each face
292  * face_vertices --> face -> vertex base connectivity (0 to n-1)
293  *----------------------------------------------------------------------------*/
294 
295 void
297  int *n_faces,
298  int n_face_vertices[6],
299  int face_vertices[6][4]);
300 
301 /*----------------------------------------------------------------------------*/
302 
304 
305 #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:114
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:158
Definition: fvm_nodal_priv.h:57
int n_sections
Definition: fvm_nodal_priv.h:159
fvm_nodal_section_t * fvm_nodal_section_create(const fvm_element_t type)
Definition: fvm_nodal.c:674
int num_dom
Definition: fvm_nodal_priv.h:157
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.c:895
Definition: fvm_nodal_priv.h:149
cs_gnum_t fvm_nodal_n_g_vertices(const fvm_nodal_t *this_nodal)
Definition: fvm_nodal.c:872
#define BEGIN_C_DECLS
Definition: cs_defs.h:405
cs_lnum_t * _vertex_index
Definition: fvm_nodal_priv.h:103
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)
Definition: fvm_nodal.c:789
const cs_coord_t * vertex_coords
Definition: fvm_nodal_priv.h:173
cs_lnum_t n_cells
Definition: fvm_nodal_priv.h:165
fvm_element_t type
Definition: fvm_nodal_priv.h:66
char * name
Definition: fvm_nodal_priv.h:154
cs_lnum_t * _parent_element_num
Definition: fvm_nodal_priv.h:138
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:202
fvm_io_num_t * global_element_num
Definition: fvm_nodal_priv.h:141
cs_coord_t * _vertex_coords
Definition: fvm_nodal_priv.h:176
fvm_io_num_t * global_vertex_num
Definition: fvm_nodal_priv.h:197
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:119
cs_gnum_t fvm_nodal_section_n_g_elements(const fvm_nodal_section_t *this_section)
Definition: fvm_nodal.c:853
int entity_dim
Definition: fvm_nodal_priv.h:62
cs_lnum_t n_vertices
Definition: fvm_nodal_priv.h:168
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:194
fvm_group_class_set_t * gc_set
Definition: fvm_nodal_priv.h:206
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)
Definition: fvm_nodal.c:738
const cs_lnum_t * parent_vertex_num
Definition: fvm_nodal_priv.h:179
#define END_C_DECLS
Definition: cs_defs.h:406
cs_lnum_t n_faces
Definition: fvm_nodal_priv.h:166
const cs_lnum_t * vertex_index
Definition: fvm_nodal_priv.h:93
const cs_lnum_t * face_index
Definition: fvm_nodal_priv.h:86
cs_lnum_t * _face_num
Definition: fvm_nodal_priv.h:102
cs_lnum_t n_faces
Definition: fvm_nodal_priv.h:82
int dim
Definition: fvm_nodal_priv.h:156
cs_lnum_t n_edges
Definition: fvm_nodal_priv.h:167