1
#ifndef __FVM_NODAL_H__
2
#define __FVM_NODAL_H__
4
/*============================================================================
5
* Main structure for a nodal representation associated with a mesh
6
*============================================================================*/
9
This file is part of Code_Saturne, a general-purpose CFD tool.
11
Copyright (C) 1998-2011 EDF S.A.
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
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
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.
28
/*----------------------------------------------------------------------------*/
30
/*----------------------------------------------------------------------------
32
*----------------------------------------------------------------------------*/
35
#include "fvm_group.h"
36
#include "fvm_io_num.h"
38
/*----------------------------------------------------------------------------*/
43
} /* Fake brace to force back Emacs auto-indentation back to column 0 */
45
#endif /* __cplusplus */
47
/*=============================================================================
49
*============================================================================*/
51
/*============================================================================
53
*============================================================================*/
55
/*----------------------------------------------------------------------------
56
* Structure defining a mesh in nodal definition
57
*----------------------------------------------------------------------------*/
59
typedef struct _fvm_nodal_t fvm_nodal_t;
61
/*=============================================================================
62
* Static global variables
63
*============================================================================*/
65
/* Number of vertices associated with each "nodal" element type */
67
extern const int fvm_nodal_n_vertices_element[];
69
/*=============================================================================
70
* Public function prototypes
71
*============================================================================*/
73
/*----------------------------------------------------------------------------
74
* Creation of a nodal mesh representation structure.
77
* name <-- name that should be assigned to the nodal mesh
78
* dim <-- spatial dimension
81
* pointer to created nodal mesh representation structure
82
*----------------------------------------------------------------------------*/
85
fvm_nodal_create(const char *name,
88
/*----------------------------------------------------------------------------
89
* Destruction of a nodal mesh representation structure.
92
* this_nodal <-> pointer to structure that should be destroyed
96
*----------------------------------------------------------------------------*/
99
fvm_nodal_destroy(fvm_nodal_t *this_nodal);
101
/*----------------------------------------------------------------------------
102
* Copy a nodal mesh representation structure, sharing arrays with the
103
* original structure.
106
* this_nodal <-> pointer to structure that should be copied
109
* pointer to created nodal mesh representation structure
110
*----------------------------------------------------------------------------*/
113
fvm_nodal_copy(const fvm_nodal_t *this_nodal);
115
/*----------------------------------------------------------------------------
116
* Reduction of a nodal mesh representation structure: only the associations
117
* (numberings) necessary to redistribution of fields for output are
118
* conserved, the full connectivity being in many cases no longer useful
119
* once it has been output. If the del_vertex_num value is set
120
* to true, vertex-based values may not be output in parallel mode
121
* after this function is called.
124
* this_nodal <-> pointer to structure that should be reduced
125
* del_vertex_num <-- indicates if vertex parent indirection and
126
* I/O numbering are destroyed (1) or not (0)
127
*----------------------------------------------------------------------------*/
130
fvm_nodal_reduce(fvm_nodal_t *this_nodal,
133
/*----------------------------------------------------------------------------
134
* Change entity parent numbering; this is useful when entities of the
135
* parent mesh have been renumbered after a nodal mesh representation
136
* structure's creation.
139
* this_nodal <-- nodal mesh structure
140
* new_parent_num <-- pointer to local parent renumbering array
141
* ({1, ..., n} <-- {1, ..., n})
142
* entity_dim <-- 3 for cells, 2 for faces, 1 for edges,
144
*----------------------------------------------------------------------------*/
147
fvm_nodal_change_parent_num(fvm_nodal_t *this_nodal,
148
const fvm_lnum_t new_parent_num[],
151
/*----------------------------------------------------------------------------
152
* Remove entity parent numbering; this is useful for example when we
153
* want to assign coordinates or fields to an extracted mesh using
154
* arrays relative to the mesh, and not to its parent.
156
* This is equivalent to calling fvm_nodal_change_parent_num(), with
157
* 'trivial' (1 o n) new_parent_num[] values.
160
* this_nodal <-- nodal mesh structure
161
* entity_dim <-- 3 for cells, 2 for faces, 1 for edges,
163
*----------------------------------------------------------------------------*/
166
fvm_nodal_remove_parent_num(fvm_nodal_t *this_nodal,
169
/*----------------------------------------------------------------------------
170
* Build external numbering for entities based on global numbers.
173
* this_nodal <-- nodal mesh structure
174
* parent_global_number <-- pointer to list of global (i.e. domain splitting
175
* independent) parent entity numbers
176
* entity_dim <-- 3 for cells, 2 for faces, 1 for edges,
178
*----------------------------------------------------------------------------*/
181
fvm_nodal_init_io_num(fvm_nodal_t *this_nodal,
182
const fvm_gnum_t parent_global_numbers[],
185
/*----------------------------------------------------------------------------
186
* Preset number and list of vertices to assign to a nodal mesh.
188
* If the parent_vertex_num argument is NULL, the list is assumed to
189
* be {1, 2, ..., n}. If parent_vertex_num is given, it specifies a
190
* list of n vertices from a larger set (1 to n numbering).
192
* Ownership of the given parent vertex numbering array is
193
* transferred to the nodal mesh representation structure.
195
* This function should be called before fvm_nodal_set_shared_vertices()
196
* or fvm_nodal_transfer_vertices() if we want to force certain
197
* vertices to appear in the mesh (especially if we want to define
198
* a mesh containing only vertices).
201
* this_nodal <-> nodal mesh structure
202
* n_vertices <-- number of vertices to assign
203
* parent_vertex_num <-- parent numbers of vertices to assign
204
*----------------------------------------------------------------------------*/
207
fvm_nodal_define_vertex_list(fvm_nodal_t *this_nodal,
208
fvm_lnum_t n_vertices,
209
fvm_lnum_t parent_vertex_num[]);
211
/*----------------------------------------------------------------------------
212
* Assign shared vertex coordinates to an extracted nodal mesh,
213
* renumbering vertex numbers based on those really referenced,
214
* and updating connectivity arrays in accordance.
216
* This function should be called once all element sections have
217
* been added to a nodal mesh representation.
220
* this_nodal <-> nodal mesh structure
221
* vertex_coords <-- coordinates of parent vertices (interlaced)
222
*----------------------------------------------------------------------------*/
225
fvm_nodal_set_shared_vertices(fvm_nodal_t *this_nodal,
226
const fvm_coord_t vertex_coords[]);
228
/*----------------------------------------------------------------------------
229
* Assign private vertex coordinates to a nodal mesh,
230
* renumbering vertex numbers based on those really referenced,
231
* and updating connectivity arrays in accordance.
233
* Ownership of the given coordinates array is transferred to
234
* the nodal mesh representation structure.
236
* This function should only be called once all element sections
237
* have been added to a nodal mesh representation.
240
* this_nodal <-> nodal mesh structure
241
* vertex_coords <-- coordinates of parent vertices (interlaced)
244
* updated pointer to vertex_coords (may be different from initial
245
* argument if vertices were renumbered).
246
*----------------------------------------------------------------------------*/
249
fvm_nodal_transfer_vertices(fvm_nodal_t *this_nodal,
250
fvm_coord_t vertex_coords[]);
252
/*----------------------------------------------------------------------------
253
* Make vertex coordinates of a nodal mesh private.
255
* If vertex coordinates were previously shared, those coordinates that
256
* are actually refernces are copied, and the relation to parent vertices
259
* If vertices were already private, the mesh is not modified.
262
* this_nodal <-> nodal mesh structure
263
*----------------------------------------------------------------------------*/
266
fvm_nodal_make_vertices_private(fvm_nodal_t *this_nodal);
268
/*----------------------------------------------------------------------------
269
* Assign group class set descriptions to a nodal mesh.
271
* The structure builds its own copy of the group class sets,
272
* renumbering them so as to discard those not referenced.
273
* Empty group classes are also renumbered to zero.
275
* This function should only be called once all element sections
276
* have been added to a nodal mesh representation.
279
* this_nodal <-> nodal mesh structure
280
* gc_set <-- group class set descriptions
281
*----------------------------------------------------------------------------*/
284
fvm_nodal_set_group_class_set(fvm_nodal_t *this_nodal,
285
const fvm_group_class_set_t *gc_set);
287
/*----------------------------------------------------------------------------
288
* Obtain the name of a nodal mesh.
291
* this_nodal <-- pointer to nodal mesh structure
294
* pointer to constant string containing the mesh name
295
*----------------------------------------------------------------------------*/
298
fvm_nodal_get_name(const fvm_nodal_t *this_nodal);
300
/*----------------------------------------------------------------------------
301
* Return spatial dimension of the nodal mesh.
304
* this_nodal <-- pointer to nodal mesh structure
308
*----------------------------------------------------------------------------*/
311
fvm_nodal_get_dim(const fvm_nodal_t *this_nodal);
313
/*----------------------------------------------------------------------------
314
* Return maximum dimension of entities in a nodal mesh.
317
* this_nodal <-- pointer to nodal mesh structure
320
* maximum dimension of entities in mesh (0 to 3)
321
*----------------------------------------------------------------------------*/
324
fvm_nodal_get_max_entity_dim(const fvm_nodal_t *this_nodal);
326
/*----------------------------------------------------------------------------
327
* Return number of entities of a given dimension in a nodal mesh.
330
* this_nodal <-- pointer to nodal mesh structure
331
* entity_dim <-- dimension of entities we want to count (0 to 3)
334
* number of entities of given dimension in mesh
335
*----------------------------------------------------------------------------*/
338
fvm_nodal_get_n_entities(const fvm_nodal_t *this_nodal,
341
/*----------------------------------------------------------------------------
342
* Return global number of vertices associated with nodal mesh.
345
* this_nodal <-- pointer to nodal mesh structure
348
* global number of vertices associated with nodal mesh
349
*----------------------------------------------------------------------------*/
352
fvm_nodal_get_n_g_vertices(const fvm_nodal_t *this_nodal);
354
/*----------------------------------------------------------------------------
355
* Return global number of elements of a given type associated with nodal mesh.
358
* this_nodal <-- pointer to nodal mesh structure
359
* element_type <-- type of elements for query
362
* global number of elements of the given type associated with nodal mesh
363
*----------------------------------------------------------------------------*/
366
fvm_nodal_get_n_g_elements(const fvm_nodal_t *this_nodal,
367
fvm_element_t element_type);
369
/*----------------------------------------------------------------------------
370
* Return local number of elements of a given type associated with nodal mesh.
373
* this_nodal <-- pointer to nodal mesh structure
374
* element_type <-- type of elements for query
377
* local number of elements of the given type associated with nodal mesh
378
*----------------------------------------------------------------------------*/
381
fvm_nodal_get_n_elements(const fvm_nodal_t *this_nodal,
382
fvm_element_t element_type);
384
/*----------------------------------------------------------------------------
385
* Return local parent numbering array for all entities of a given
386
* dimension in a nodal mesh.
388
* The number of entities of the given dimension may be obtained
389
* through fvm_nodal_get_n_entities(), the parent_num[] array is populated
390
* with the parent entity numbers of those entities, in order (i.e. in
391
* local section order, section by section).
394
* this_nodal <-- pointer to nodal mesh structure
395
* entity_dim <-- dimension of entities we are interested in (0 to 3)
396
* parent_num --> entity parent numbering (array must be pre-allocated)
397
*----------------------------------------------------------------------------*/
400
fvm_nodal_get_parent_num(const fvm_nodal_t *this_nodal,
402
fvm_lnum_t parent_num[]);
404
/*----------------------------------------------------------------------------
405
* Compute tesselation a a nodal mesh's sections of a given type, and add the
406
* corresponding structure to the mesh representation.
408
* If global element numbers are used (i.e. in parallel mode), this function
409
* should be only be used after calling fvm_nodal_init_io_num().
411
* If some mesh sections have already been tesselated, their tesselation
415
* this_nodal <-> pointer to nodal mesh structure
416
* type <-> element type that should be tesselated
417
* error_count --> number of elements with a tesselation error
419
*----------------------------------------------------------------------------*/
422
fvm_nodal_tesselate(fvm_nodal_t *this_nodal,
424
fvm_lnum_t *error_count);
426
/*----------------------------------------------------------------------------
427
* Build a nodal representation structure based on extraction of a
431
* name <-- name to assign to extracted mesh
432
* this_nodal <-> pointer to nodal mesh structure
433
*----------------------------------------------------------------------------*/
436
fvm_nodal_copy_edges(const char *name,
437
const fvm_nodal_t *this_nodal);
439
/*----------------------------------------------------------------------------
440
* Dump printout of a nodal representation structure.
443
* this_nodal <-- pointer to structure that should be dumped
444
*----------------------------------------------------------------------------*/
447
fvm_nodal_dump(const fvm_nodal_t *this_nodal);
449
/*----------------------------------------------------------------------------*/
453
#endif /* __cplusplus */
455
#endif /* __FVM_NODAL_H__ */