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