programmer's documentation
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
src
fvm
fvm_nodal.h
Go to the documentation of this file.
1
#ifndef __FVM_NODAL_H__
2
#define __FVM_NODAL_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-2013 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_io_num.h
"
39
40
/*----------------------------------------------------------------------------*/
41
42
BEGIN_C_DECLS
43
44
/*=============================================================================
45
* Macro definitions
46
*============================================================================*/
47
48
/*============================================================================
49
* Type definitions
50
*============================================================================*/
51
52
/*----------------------------------------------------------------------------
53
* Structure defining a mesh in nodal definition
54
*----------------------------------------------------------------------------*/
55
56
typedef
struct
_fvm_nodal_t
fvm_nodal_t;
57
58
/*=============================================================================
59
* Static global variables
60
*============================================================================*/
61
62
/* Number of vertices associated with each "nodal" element type */
63
64
extern
const
int
fvm_nodal_n_vertices_element
[];
65
66
/*=============================================================================
67
* Public function prototypes
68
*============================================================================*/
69
70
/*----------------------------------------------------------------------------
71
* Creation of a nodal mesh representation structure.
72
*
73
* parameters:
74
* name <-- name that should be assigned to the nodal mesh
75
* dim <-- spatial dimension
76
*
77
* returns:
78
* pointer to created nodal mesh representation structure
79
*----------------------------------------------------------------------------*/
80
81
fvm_nodal_t *
82
fvm_nodal_create
(
const
char
*
name
,
83
int
dim
);
84
85
/*----------------------------------------------------------------------------
86
* Destruction of a nodal mesh representation structure.
87
*
88
* parameters:
89
* this_nodal <-> pointer to structure that should be destroyed
90
*
91
* returns:
92
* NULL pointer
93
*----------------------------------------------------------------------------*/
94
95
fvm_nodal_t *
96
fvm_nodal_destroy
(fvm_nodal_t *this_nodal);
97
98
/*----------------------------------------------------------------------------
99
* Copy a nodal mesh representation structure, sharing arrays with the
100
* original structure.
101
*
102
* parameters:
103
* this_nodal <-> pointer to structure that should be copied
104
*
105
* returns:
106
* pointer to created nodal mesh representation structure
107
*----------------------------------------------------------------------------*/
108
109
fvm_nodal_t *
110
fvm_nodal_copy
(
const
fvm_nodal_t *this_nodal);
111
112
/*----------------------------------------------------------------------------
113
* Reduction of a nodal mesh representation structure: only the associations
114
* (numberings) necessary to redistribution of fields for output are
115
* conserved, the full connectivity being in many cases no longer useful
116
* once it has been output. If the del_vertex_num value is set
117
* to true, vertex-based values may not be output in parallel mode
118
* after this function is called.
119
*
120
* parameters:
121
* this_nodal <-> pointer to structure that should be reduced
122
* del_vertex_num <-- indicates if vertex parent indirection and
123
* I/O numbering are destroyed (1) or not (0)
124
*----------------------------------------------------------------------------*/
125
126
void
127
fvm_nodal_reduce
(fvm_nodal_t *this_nodal,
128
int
del_vertex_num);
129
130
/*----------------------------------------------------------------------------
131
* Change entity parent numbering; this is useful when entities of the
132
* parent mesh have been renumbered after a nodal mesh representation
133
* structure's creation.
134
*
135
* parameters:
136
* this_nodal <-- nodal mesh structure
137
* new_parent_num <-- pointer to local parent renumbering array
138
* ({1, ..., n} <-- {1, ..., n})
139
* entity_dim <-- 3 for cells, 2 for faces, 1 for edges,
140
* and 0 for vertices
141
*----------------------------------------------------------------------------*/
142
143
void
144
fvm_nodal_change_parent_num
(fvm_nodal_t *this_nodal,
145
const
cs_lnum_t
new_parent_num[],
146
int
entity_dim);
147
148
/*----------------------------------------------------------------------------
149
* Remove entity parent numbering; this is useful for example when we
150
* want to assign coordinates or fields to an extracted mesh using
151
* arrays relative to the mesh, and not to its parent.
152
*
153
* This is equivalent to calling fvm_nodal_change_parent_num(), with
154
* 'trivial' (1 o n) new_parent_num[] values.
155
*
156
* parameters:
157
* this_nodal <-- nodal mesh structure
158
* entity_dim <-- 3 for cells, 2 for faces, 1 for edges,
159
* and 0 for vertices
160
*----------------------------------------------------------------------------*/
161
162
void
163
fvm_nodal_remove_parent_num
(fvm_nodal_t *this_nodal,
164
int
entity_dim);
165
166
/*----------------------------------------------------------------------------
167
* Build external numbering for entities based on global numbers.
168
*
169
* parameters:
170
* this_nodal <-- nodal mesh structure
171
* parent_global_number <-- pointer to list of global (i.e. domain splitting
172
* independent) parent entity numbers
173
* entity_dim <-- 3 for cells, 2 for faces, 1 for edges,
174
* and 0 for vertices
175
*----------------------------------------------------------------------------*/
176
177
void
178
fvm_nodal_init_io_num
(fvm_nodal_t *this_nodal,
179
const
cs_gnum_t
parent_global_numbers[],
180
int
entity_dim);
181
182
/*----------------------------------------------------------------------------
183
* Preset number and list of vertices to assign to a nodal mesh.
184
*
185
* If the parent_vertex_num argument is NULL, the list is assumed to
186
* be {1, 2, ..., n}. If parent_vertex_num is given, it specifies a
187
* list of n vertices from a larger set (1 to n numbering).
188
*
189
* Ownership of the given parent vertex numbering array is
190
* transferred to the nodal mesh representation structure.
191
*
192
* This function should be called before fvm_nodal_set_shared_vertices()
193
* or fvm_nodal_transfer_vertices() if we want to force certain
194
* vertices to appear in the mesh (especially if we want to define
195
* a mesh containing only vertices).
196
*
197
* parameters:
198
* this_nodal <-> nodal mesh structure
199
* n_vertices <-- number of vertices to assign
200
* parent_vertex_num <-- parent numbers of vertices to assign
201
*----------------------------------------------------------------------------*/
202
203
void
204
fvm_nodal_define_vertex_list
(fvm_nodal_t *this_nodal,
205
cs_lnum_t
n_vertices
,
206
cs_lnum_t
parent_vertex_num
[]);
207
208
/*----------------------------------------------------------------------------
209
* Assign shared vertex coordinates to an extracted nodal mesh,
210
* renumbering vertex numbers based on those really referenced,
211
* and updating connectivity arrays in accordance.
212
*
213
* This function should be called once all element sections have
214
* been added to a nodal mesh representation.
215
*
216
* parameters:
217
* this_nodal <-> nodal mesh structure
218
* vertex_coords <-- coordinates of parent vertices (interlaced)
219
*----------------------------------------------------------------------------*/
220
221
void
222
fvm_nodal_set_shared_vertices
(fvm_nodal_t *this_nodal,
223
const
cs_coord_t
vertex_coords
[]);
224
225
/*----------------------------------------------------------------------------
226
* Assign private vertex coordinates to a nodal mesh,
227
* renumbering vertex numbers based on those really referenced,
228
* and updating connectivity arrays in accordance.
229
*
230
* Ownership of the given coordinates array is transferred to
231
* the nodal mesh representation structure.
232
*
233
* This function should only be called once all element sections
234
* have been added to a nodal mesh representation.
235
*
236
* parameters:
237
* this_nodal <-> nodal mesh structure
238
* vertex_coords <-- coordinates of parent vertices (interlaced)
239
*
240
* returns:
241
* updated pointer to vertex_coords (may be different from initial
242
* argument if vertices were renumbered).
243
*----------------------------------------------------------------------------*/
244
245
cs_coord_t
*
246
fvm_nodal_transfer_vertices
(fvm_nodal_t *this_nodal,
247
cs_coord_t
vertex_coords
[]);
248
249
/*----------------------------------------------------------------------------
250
* Make vertex coordinates of a nodal mesh private.
251
*
252
* If vertex coordinates were previously shared, those coordinates that
253
* are actually refernces are copied, and the relation to parent vertices
254
* is discarded.
255
*
256
* If vertices were already private, the mesh is not modified.
257
*
258
* parameters:
259
* this_nodal <-> nodal mesh structure
260
*----------------------------------------------------------------------------*/
261
262
void
263
fvm_nodal_make_vertices_private
(fvm_nodal_t *this_nodal);
264
265
/*----------------------------------------------------------------------------
266
* Assign group class set descriptions to a nodal mesh.
267
*
268
* The structure builds its own copy of the group class sets,
269
* renumbering them so as to discard those not referenced.
270
* Empty group classes are also renumbered to zero.
271
*
272
* This function should only be called once all element sections
273
* have been added to a nodal mesh representation.
274
*
275
* parameters:
276
* this_nodal <-> nodal mesh structure
277
* gc_set <-- group class set descriptions
278
*----------------------------------------------------------------------------*/
279
280
void
281
fvm_nodal_set_group_class_set
(fvm_nodal_t *this_nodal,
282
const
fvm_group_class_set_t *
gc_set
);
283
284
/*----------------------------------------------------------------------------
285
* Obtain the name of a nodal mesh.
286
*
287
* parameters:
288
* this_nodal <-- pointer to nodal mesh structure
289
*
290
* returns:
291
* pointer to constant string containing the mesh name
292
*----------------------------------------------------------------------------*/
293
294
const
char
*
295
fvm_nodal_get_name
(
const
fvm_nodal_t *this_nodal);
296
297
/*----------------------------------------------------------------------------
298
* Return spatial dimension of the nodal mesh.
299
*
300
* parameters:
301
* this_nodal <-- pointer to nodal mesh structure
302
*
303
* returns:
304
* spatial dimension
305
*----------------------------------------------------------------------------*/
306
307
int
308
fvm_nodal_get_dim
(
const
fvm_nodal_t *this_nodal);
309
310
/*----------------------------------------------------------------------------
311
* Return maximum dimension of entities in a nodal mesh.
312
*
313
* parameters:
314
* this_nodal <-- pointer to nodal mesh structure
315
*
316
* returns:
317
* maximum dimension of entities in mesh (0 to 3)
318
*----------------------------------------------------------------------------*/
319
320
int
321
fvm_nodal_get_max_entity_dim
(
const
fvm_nodal_t *this_nodal);
322
323
/*----------------------------------------------------------------------------
324
* Return number of entities of a given dimension in a nodal mesh.
325
*
326
* parameters:
327
* this_nodal <-- pointer to nodal mesh structure
328
* entity_dim <-- dimension of entities we want to count (0 to 3)
329
*
330
* returns:
331
* number of entities of given dimension in mesh
332
*----------------------------------------------------------------------------*/
333
334
cs_lnum_t
335
fvm_nodal_get_n_entities
(
const
fvm_nodal_t *this_nodal,
336
int
entity_dim);
337
338
/*----------------------------------------------------------------------------
339
* Return global number of vertices associated with nodal mesh.
340
*
341
* parameters:
342
* this_nodal <-- pointer to nodal mesh structure
343
*
344
* returns:
345
* global number of vertices associated with nodal mesh
346
*----------------------------------------------------------------------------*/
347
348
cs_gnum_t
349
fvm_nodal_get_n_g_vertices
(
const
fvm_nodal_t *this_nodal);
350
351
/*----------------------------------------------------------------------------
352
* Return global number of elements of a given type associated with nodal mesh.
353
*
354
* parameters:
355
* this_nodal <-- pointer to nodal mesh structure
356
* element_type <-- type of elements for query
357
*
358
* returns:
359
* global number of elements of the given type associated with nodal mesh
360
*----------------------------------------------------------------------------*/
361
362
cs_gnum_t
363
fvm_nodal_get_n_g_elements
(
const
fvm_nodal_t *this_nodal,
364
fvm_element_t
element_type);
365
366
/*----------------------------------------------------------------------------
367
* Return local number of elements of a given type associated with nodal mesh.
368
*
369
* parameters:
370
* this_nodal <-- pointer to nodal mesh structure
371
* element_type <-- type of elements for query
372
*
373
* returns:
374
* local number of elements of the given type associated with nodal mesh
375
*----------------------------------------------------------------------------*/
376
377
cs_lnum_t
378
fvm_nodal_get_n_elements
(
const
fvm_nodal_t *this_nodal,
379
fvm_element_t
element_type);
380
381
/*----------------------------------------------------------------------------
382
* Return local parent numbering array for all entities of a given
383
* dimension in a nodal mesh.
384
*
385
* The number of entities of the given dimension may be obtained
386
* through fvm_nodal_get_n_entities(), the parent_num[] array is populated
387
* with the parent entity numbers of those entities, in order (i.e. in
388
* local section order, section by section).
389
*
390
* parameters:
391
* this_nodal <-- pointer to nodal mesh structure
392
* entity_dim <-- dimension of entities we are interested in (0 to 3)
393
* parent_num --> entity parent numbering (array must be pre-allocated)
394
*----------------------------------------------------------------------------*/
395
396
void
397
fvm_nodal_get_parent_num
(
const
fvm_nodal_t *this_nodal,
398
int
entity_dim,
399
cs_lnum_t
parent_num[]);
400
401
/*----------------------------------------------------------------------------
402
* Compute tesselation a a nodal mesh's sections of a given type, and add the
403
* corresponding structure to the mesh representation.
404
*
405
* If global element numbers are used (i.e. in parallel mode), this function
406
* should be only be used after calling fvm_nodal_init_io_num().
407
*
408
* If some mesh sections have already been tesselated, their tesselation
409
* is unchanged.
410
*
411
* parameters:
412
* this_nodal <-> pointer to nodal mesh structure
413
* type <-> element type that should be tesselated
414
* error_count --> number of elements with a tesselation error
415
* counter (optional)
416
*----------------------------------------------------------------------------*/
417
418
void
419
fvm_nodal_tesselate
(fvm_nodal_t *this_nodal,
420
fvm_element_t
type,
421
cs_lnum_t
*error_count);
422
423
/*----------------------------------------------------------------------------
424
* Build a nodal representation structure based on extraction of a
425
* mesh's edges.
426
*
427
* parameters:
428
* name <-- name to assign to extracted mesh
429
* this_nodal <-> pointer to nodal mesh structure
430
*----------------------------------------------------------------------------*/
431
432
fvm_nodal_t *
433
fvm_nodal_copy_edges
(
const
char
*
name
,
434
const
fvm_nodal_t *this_nodal);
435
436
/*----------------------------------------------------------------------------
437
* Dump printout of a nodal representation structure.
438
*
439
* parameters:
440
* this_nodal <-- pointer to structure that should be dumped
441
*----------------------------------------------------------------------------*/
442
443
void
444
fvm_nodal_dump
(
const
fvm_nodal_t *this_nodal);
445
446
/*----------------------------------------------------------------------------*/
447
448
END_C_DECLS
449
450
#endif
/* __FVM_NODAL_H__ */
Generated on Thu Feb 27 2014 19:21:34 by
1.8.3.1