1
#ifndef __FVM_IO_NUM_H__
2
#define __FVM_IO_NUM_H__
4
/*============================================================================
5
* Main structure for an I/O numbering scheme associated with mesh entities
6
* (such as cells, faces, and vertices);
8
* In parallel mode, such a scheme is important so as to redistribute
9
* locally numbered entities on n processes to files written by p
10
* processes, with p <= n.
12
* Only the case where p = 1 is presently implemented, so the numbering
13
* scheme is simply based on entity's global labels.
15
* For p > 1, it would probably be necessary to extend the numbering
16
* schemes so as to account for the fact that a given entity may have
17
* a main index on its main associated domain, but may be present
18
* as a ghost entity with another index on neighboring domains.
19
*============================================================================*/
22
This file is part of Code_Saturne, a general-purpose CFD tool.
24
Copyright (C) 1998-2011 EDF S.A.
26
This program is free software; you can redistribute it and/or modify it under
27
the terms of the GNU General Public License as published by the Free Software
28
Foundation; either version 2 of the License, or (at your option) any later
31
This program is distributed in the hope that it will be useful, but WITHOUT
32
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
33
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
36
You should have received a copy of the GNU General Public License along with
37
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
38
Street, Fifth Floor, Boston, MA 02110-1301, USA.
41
/*----------------------------------------------------------------------------*/
43
/*----------------------------------------------------------------------------
45
*----------------------------------------------------------------------------*/
49
/*----------------------------------------------------------------------------*/
54
} /* Fake brace to force back Emacs auto-indentation back to column 0 */
56
#endif /* __cplusplus */
58
/*=============================================================================
60
*============================================================================*/
62
/*============================================================================
64
*============================================================================*/
66
/*----------------------------------------------------------------------------
67
* Structure defining an I/O numbering scheme
68
*----------------------------------------------------------------------------*/
71
Pointer to an I/O numbering scheme structure. The structure
72
itself is private, and is defined in fvm_io_num.c
75
typedef struct _fvm_io_num_t fvm_io_num_t;
77
/* Space-filling curve types */
81
FVM_IO_NUM_SFC_MORTON_BOX, /* Morton (Z) curve in bounding box */
82
FVM_IO_NUM_SFC_MORTON_CUBE, /* Morton (Z) curve in bounding cube */
83
FVM_IO_NUM_SFC_HILBERT_BOX, /* Peano-Hilbert curve in bounding box */
84
FVM_IO_NUM_SFC_HILBERT_CUBE, /* Peano-Hilbert curve in bounding cube */
88
/*=============================================================================
89
* Static global variables
90
*============================================================================*/
92
/* Names of space-filling curve types */
94
extern const char *fvm_io_num_sfc_type_name[];
96
/*=============================================================================
97
* Public function prototypes
98
*============================================================================*/
100
/*----------------------------------------------------------------------------
101
* Creation of an I/O numbering structure.
103
* The corresponding entities must be locally ordered.
106
* parent_entity_number <-- pointer to list of selected entitie's parent's
107
* numbers, or NULL if all first nb_ent entities
109
* parent_global_number <-- pointer to list of global (i.e. domain splitting
110
* independent) parent entity numbers
111
* n_entities <-- number of entities considered
112
* share_parent_global <-- if non zero, try to share parent_global_number
113
* instead of using a local copy
116
* pointer to I/O numbering structure
117
*----------------------------------------------------------------------------*/
120
fvm_io_num_create(const fvm_lnum_t parent_entity_number[],
121
const fvm_gnum_t parent_global_number[],
122
const size_t n_entities,
123
const int share_parent_global);
125
/*----------------------------------------------------------------------------
126
* Creation of an I/O numbering structure,
127
* sharing a given global numbering array.
129
* The corresponding entities must be locally ordered.
132
* global_number <-- pointer to list of global (i.e. domain splitting
133
* independent) entity numbers
134
* global_count <-- global number of entities
135
* n_entities <-- number of local entities considered
138
* pointer to I/O numbering structure
139
*----------------------------------------------------------------------------*/
142
fvm_io_num_create_shared(const fvm_gnum_t global_number[],
143
fvm_gnum_t global_count,
146
/*----------------------------------------------------------------------------
147
* Creation of an I/O numbering structure based on an an initial
148
* I/O numbering and a number of new entities per base entity.
150
* This is useful for example to create an I/O numbering for
151
* triangles based on split polygons, whose I/O numbering is defined.
154
* base_io_num <-- pointer to base I/O numbering structure
155
* n_sub_entities <-- number of new entities per base entity
158
* pointer to I/O numbering structure
159
*----------------------------------------------------------------------------*/
162
fvm_io_num_create_from_sub(const fvm_io_num_t *base_io_num,
163
const fvm_lnum_t n_sub_entities[]);
165
/*----------------------------------------------------------------------------
166
* Creation of an I/O numbering structure based on a strided adjacency.
168
* The corresponding entities must be locally ordered.
171
* parent_entity_number <-- pointer to list of selected entitie's parent's
172
* numbers, or NULL if all first n_ent entities
174
* adjacency <-- entity adjacency (1 to n global numbering)
175
* n_entities <-- number of entities considered
176
* stride <-- values per entity
179
* pointer to I/O numbering structure
180
*----------------------------------------------------------------------------*/
183
fvm_io_num_create_from_adj_s(const fvm_lnum_t parent_entity_number[],
184
const fvm_gnum_t adjacency[],
188
/*----------------------------------------------------------------------------
189
* Creation of an I/O numbering structure based on an indexed adjacency.
191
* The corresponding entities do not need to be locally ordered.
194
* parent_entity_number <-- pointer to list of selected entitie's parent's
195
* numbers, or NULL if all first n_ent entities
197
* index <-- index on entities for adjacency
198
* adjacency <-- entity adjacency (1 to n global numbering)
199
* n_entities <-- number of entities considered
202
* pointer to I/O numbering structure
203
*----------------------------------------------------------------------------*/
206
fvm_io_num_create_from_adj_i(const fvm_lnum_t parent_entity_number[],
207
const fvm_lnum_t index[],
208
const fvm_gnum_t adjacency[],
209
fvm_lnum_t n_entities);
211
/*----------------------------------------------------------------------------
212
* Creation of an I/O numbering structure based on a space-filling curve.
214
* It is expected that entities are unique (i.e. not duplicated on 2 or
215
* more ranks). If 2 entities have a same Morton codeor Hilbert, their global
216
* number will be determined by lexicographical ordering of coordinates.
219
* coords <-- pointer to entity coordinates (interlaced)
220
* dim <-- spatial dimension
221
* n_entities <-- number of entities considered
222
* sfc_type <-- type of space-filling curve (Morton or Hilbert)
225
* pointer to I/O numbering structure
226
*----------------------------------------------------------------------------*/
229
fvm_io_num_create_from_sfc(const fvm_coord_t coords[],
232
fvm_io_num_sfc_t sfc_type);
234
/*----------------------------------------------------------------------------
235
* Creation of an I/O numbering structure based on a simple accumulation
236
* (i.e. scan) of counts on successive ranks.
239
* n_entities <-- number of entities considered
242
* pointer to I/O numbering structure
243
*----------------------------------------------------------------------------*/
246
fvm_io_num_create_from_scan(size_t n_entities);
248
/*----------------------------------------------------------------------------
249
* Destruction of a I/O numbering structure.
252
* this_io_num <-- pointer to structure that should be destroyed
256
*----------------------------------------------------------------------------*/
259
fvm_io_num_destroy(fvm_io_num_t * this_io_num);
261
/*----------------------------------------------------------------------------
262
* Return local number of entities associated with an I/O numbering
266
* this_io_num <-- pointer to I/O/ numbering structure
269
* local number of associated entities
270
*----------------------------------------------------------------------------*/
273
fvm_io_num_get_local_count(const fvm_io_num_t *const this_io_num);
275
/*----------------------------------------------------------------------------
276
* Return global number of entities associated with an I/O numbering
280
* this_io_num <-- pointer to I/O/ numbering structure
283
* global number of associated entities
284
*----------------------------------------------------------------------------*/
287
fvm_io_num_get_global_count(const fvm_io_num_t *const this_io_num);
289
/*----------------------------------------------------------------------------
290
* Return global numbering associated with an I/O numbering structure.
293
* this_io_num <-- pointer to I/O/ numbering structure
296
* pointer to array of global numbers associated with local entities
298
*----------------------------------------------------------------------------*/
301
fvm_io_num_get_global_num(const fvm_io_num_t *const this_io_num);
303
/*----------------------------------------------------------------------------
304
* Return the global number of sub-entities associated with an initial
305
* entity whose global numbering is known, given the number of
306
* sub-entities per initial entity.
309
* this_io_num <-- pointer to base io numbering
310
* n_sub_entities <-- number of sub-entities per initial entity
311
* comm <-- associated MPI communicator
314
* global number of sub-entities
315
*----------------------------------------------------------------------------*/
318
fvm_io_num_global_sub_size(const fvm_io_num_t *this_io_num,
319
const fvm_lnum_t n_sub_entities[]);
321
/*----------------------------------------------------------------------------
322
* Dump printout of a I/O numbering structure.
325
* this_io_num <-- pointer to structure that should be dumped
326
*----------------------------------------------------------------------------*/
329
fvm_io_num_dump(const fvm_io_num_t *const this_io_num);
331
/*----------------------------------------------------------------------------*/
335
#endif /* __cplusplus */
337
#endif /* __FVM_IO_NUM_H__ */