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
base
cs_order.h
Go to the documentation of this file.
1
#ifndef __CS_ORDER_H__
2
#define __CS_ORDER_H__
3
4
/*============================================================================
5
* Functions related to the ordering of local arrays.
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
/*----------------------------------------------------------------------------
31
* Local headers
32
*----------------------------------------------------------------------------*/
33
34
#include "
cs_defs.h
"
35
36
/*----------------------------------------------------------------------------*/
37
38
BEGIN_C_DECLS
39
40
/*=============================================================================
41
* Macro definitions
42
*============================================================================*/
43
44
/*============================================================================
45
* Type definitions
46
*============================================================================*/
47
48
/*=============================================================================
49
* Static global variables
50
*============================================================================*/
51
52
/*=============================================================================
53
* Public function prototypes
54
*============================================================================*/
55
56
/*----------------------------------------------------------------------------
57
* Test if an array of global numbers is ordered.
58
*
59
* parameters:
60
* list <-- optional list (1 to n numbering) of selected entities
61
* (or NULL if all nb_ent are selected). This list may
62
* contain element numbers in any order
63
* number <-- array of all entity numbers (number of entity i
64
* given by number[i] or number[list[i] - 1]) if list exists
65
* (if NULL, a default 1 to n numbering is considered)
66
* nb_ent <-- number of entities considered
67
*
68
* returns:
69
* 1 if ordered, 0 otherwise.
70
*----------------------------------------------------------------------------*/
71
72
int
73
cs_order_gnum_test
(
const
cs_lnum_t
list[],
74
const
cs_gnum_t
number[],
75
size_t
nb_ent);
76
77
/*----------------------------------------------------------------------------
78
* Test if an array of global numbers is lexicographically ordered.
79
*
80
* parameters:
81
* list <-- optional list (1 to n numbering) of selected entities
82
* (or NULL if all nb_ent are selected). This list may
83
* contain element numbers in any order
84
* number <-- array of all entity numbers (number of entity i
85
* given by number[i] or number[list[i] - 1]) if list exists
86
* (if NULL, a default 1 to n numbering is considered)
87
* stride <-- stride of number array (number of values to compare)
88
* nb_ent <-- number of entities considered
89
*
90
* returns:
91
* 1 if ordered, 0 otherwise.
92
*----------------------------------------------------------------------------*/
93
94
int
95
cs_order_gnum_test_s
(
const
cs_lnum_t
list[],
96
const
cs_gnum_t
number[],
97
size_t
stride,
98
size_t
nb_ent);
99
100
/*----------------------------------------------------------------------------
101
* Return an ordering table associated with an array of global numbers.
102
*
103
* parameters:
104
* list <-- optional list (1 to n numbering) of selected entities
105
* (or NULL if all nb_ent are selected). This list may
106
* contain element numbers in any order
107
* number <-- array of all entity numbers (number of entity i
108
* given by number[i] or number[list[i] - 1]) if list exists
109
* (if NULL, a default 1 to n numbering is considered)
110
* nb_ent <-- number of entities considered
111
*
112
* returns:
113
* pointer to list of nb_ent entities (0 to n-1 numbering) ordered by
114
* increasing associated number. The calling code is responsible for
115
* freeing this array when it is not needed anymore
116
*----------------------------------------------------------------------------*/
117
118
cs_lnum_t
*
119
cs_order_gnum
(
const
cs_lnum_t
list[],
120
const
cs_gnum_t
number[],
121
size_t
nb_ent);
122
123
/*----------------------------------------------------------------------------
124
* Return a lexicographical ordering table associated with a strided array
125
* of global numbers.
126
*
127
* parameters:
128
* list <-- optional list (1 to n numbering) of selected entities
129
* (or NULL if all nb_ent are selected). This list may
130
* contain element numbers in any order
131
* number <-- array of all entity numbers (number of entity i
132
* given by number[i] or number[list[i] - 1]) if list exists
133
* (if NULL, a default 1 to n numbering is considered)
134
* stride <-- stride of number array (number of values to compare)
135
* nb_ent <-- number of entities considered
136
*
137
* returns:
138
* pointer to list of nb_ent entities (0 to n-1 numbering) ordered by
139
* increasing associated number. The calling code is responsible for
140
* freeing this array when it is not needed anymore.
141
*----------------------------------------------------------------------------*/
142
143
cs_lnum_t
*
144
cs_order_gnum_s
(
const
cs_lnum_t
list[],
145
const
cs_gnum_t
number[],
146
size_t
stride,
147
size_t
nb_ent);
148
149
/*----------------------------------------------------------------------------
150
* Return a lexicographical ordering table associated with an indexed array
151
* of global numbers.
152
*
153
* parameters:
154
* list <-- optional list (1 to n numbering) of selected entities
155
* (or NULL if all nb_ent are selected). This list may
156
* contain element numbers in any order
157
* number <-- array of all entity numbers (numbers of entity i start
158
* at index[i] or _index[i] (reduced index) if list exists).
159
* If list = NULL, a default 1 to n numbering is considered)
160
* index <-- number of values to compare for each entity
161
* nb_ent <-- number of entities considered
162
*
163
* returns:
164
* pointer to list of nb_ent entities (0 to n-1 numbering) ordered by
165
* increasing associated number. The calling code is responsible for
166
* freeing this array when it is not needed anymore.
167
*----------------------------------------------------------------------------*/
168
169
cs_lnum_t
*
170
cs_order_gnum_i
(
const
cs_lnum_t
list[],
171
const
cs_gnum_t
number[],
172
const
cs_lnum_t
index[],
173
size_t
nb_ent);
174
175
/*----------------------------------------------------------------------------
176
* Compute an ordering table associated with an array of global numbers.
177
*
178
* parameters:
179
* list <-- optional list (1 to n numbering) of selected entities
180
* (or NULL if all nb_ent are selected). This list may
181
* contain element numbers in any order
182
* number <-- array of all entity numbers (number of entity i
183
* given by number[i] or number[list[i] - 1]) if list exists
184
* (if NULL, a default 1 to n numbering is considered)
185
* order --> pointer to pre-allocated ordering table
186
* nb_ent <-- number of entities considered
187
*----------------------------------------------------------------------------*/
188
189
void
190
cs_order_gnum_allocated
(
const
cs_lnum_t
list[],
191
const
cs_gnum_t
number[],
192
cs_lnum_t
order[],
193
size_t
nb_ent);
194
195
/*----------------------------------------------------------------------------
196
* Compute a lexicographical ordering table associated with an array of
197
* strided global numbers.
198
*
199
* parameters:
200
* list <-- optional list (1 to n numbering) of selected entities
201
* (or NULL if all nb_ent are selected). This list may
202
* contain element numbers in any order
203
* number <-- array of all entity numbers (numbers of entity i start
204
* at number[i*stride] or number[(list[i] - 1)*stride]) if
205
* list exists (if NULL, a default 1 to n numbering is
206
* considered)
207
* stride <-- stride of number array (number of values to compare)
208
* order --> pointer to pre-allocated ordering table
209
* nb_ent <-- number of entities considered
210
*----------------------------------------------------------------------------*/
211
212
void
213
cs_order_gnum_allocated_s
(
const
cs_lnum_t
list[],
214
const
cs_gnum_t
number[],
215
size_t
stride,
216
cs_lnum_t
order[],
217
size_t
nb_ent);
218
219
/*----------------------------------------------------------------------------
220
* Compute a lexicographical ordering table associated with an indexed array
221
* of global numbers.
222
*
223
* parameters:
224
* list <-- optional list (1 to n numbering) of selected entities
225
* (or NULL if all nb_ent are selected). This list may
226
* contain element numbers in any order
227
* number <-- array of all entity numbers (numbers of entity i start
228
* at index[i] or _index[i] (reduced index) if list exists).
229
* If list = NULL, a default 1 to n numbering is considered)
230
* index <-- number of values to compare for each entity (from 0)
231
* order --> pointer to pre-allocated ordering table
232
* nb_ent <-- number of entities considered
233
*----------------------------------------------------------------------------*/
234
235
void
236
cs_order_gnum_allocated_i
(
const
cs_lnum_t
list[],
237
const
cs_gnum_t
number[],
238
const
cs_lnum_t
index[],
239
cs_lnum_t
order[],
240
size_t
nb_ent);
241
242
/*----------------------------------------------------------------------------
243
* Compute an ordering table associated with an array of local numbers.
244
*
245
* parameters:
246
* list <-- optional list (1 to n numbering) of selected entities
247
* (or NULL if all nb_ent are selected). This list may
248
* contain element numbers in any order
249
* number <-- array of all entity numbers (number of entity i
250
* given by number[i] or number[list[i] - 1]) if list exists
251
* (if NULL, a default 1 to n numbering is considered)
252
* order --> pointer to pre-allocated ordering table
253
* nb_ent <-- number of entities considered
254
*----------------------------------------------------------------------------*/
255
256
void
257
cs_order_lnum_allocated
(
const
cs_lnum_t
list[],
258
const
cs_lnum_t
number[],
259
cs_lnum_t
order[],
260
size_t
nb_ent);
261
262
/*----------------------------------------------------------------------------
263
* Compute a lexicographical ordering table associated with an array of
264
* strided local numbers.
265
*
266
* parameters:
267
* list <-- optional list (1 to n numbering) of selected entities
268
* (or NULL if all nb_ent are selected). This list may
269
* contain element numbers in any order
270
* number <-- array of all entity numbers (numbers of entity i start
271
* at number[i*stride] or number[(list[i] - 1)*stride]) if
272
* list exists (if NULL, a default 1 to n numbering is
273
* considered)
274
* stride <-- stride of number array (number of values to compare)
275
* order --> pointer to pre-allocated ordering table
276
* nb_ent <-- number of entities considered
277
*----------------------------------------------------------------------------*/
278
279
void
280
cs_order_lnum_allocated_s
(
const
cs_lnum_t
list[],
281
const
cs_lnum_t
number[],
282
size_t
stride,
283
cs_lnum_t
order[],
284
size_t
nb_ent);
285
286
/*----------------------------------------------------------------------------
287
* Build local renumbering array based on ordering of entities.
288
*
289
* parameters:
290
* order <-- 0 to n-1 ordering of entities by increasing attribute
291
* nb_ent <-- number of entities considered
292
*
293
* returns:
294
* pointer to renumbering array (0 to n-1 numbering) indicating the new
295
* index of renumbered entities; The calling code is responsible for
296
* freeing this array when it is not needed anymore
297
*----------------------------------------------------------------------------*/
298
299
cs_lnum_t
*
300
cs_order_renumbering
(
const
cs_lnum_t
order[],
301
size_t
nb_ent);
302
303
/*----------------------------------------------------------------------------*/
304
305
END_C_DECLS
306
307
#endif
/* __CS_ORDER_H__ */
Generated on Thu Feb 27 2014 19:21:34 by
1.8.3.1