My Project
programmer's documentation
cs_renumber.h
Go to the documentation of this file.
1 #ifndef __CS_RENUMBER_H__
2 #define __CS_RENUMBER_H__
3 
4 /*============================================================================
5  * Optional mesh renumbering
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2019 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_base.h"
35 #include "cs_mesh.h"
36 
37 /*----------------------------------------------------------------------------*/
38 
40 
41 /*============================================================================
42  * Macro definitions
43  *============================================================================*/
44 
45 /*============================================================================
46  * Type definitions
47  *============================================================================*/
48 
49 /* Renumbering algorithms */
50 
51 typedef enum {
52 
53  CS_RENUMBER_CELLS_SCOTCH_PART, /* SCOTCH partitioning */
54  CS_RENUMBER_CELLS_SCOTCH_ORDER, /* SCOTCH ordering */
55  CS_RENUMBER_CELLS_METIS_PART, /* METIS partitioning */
56  CS_RENUMBER_CELLS_METIS_ORDER, /* METIS ordering */
57  CS_RENUMBER_CELLS_MORTON, /* Morton space filling curve */
58  CS_RENUMBER_CELLS_HILBERT, /* Hilbert space filling curve */
59  CS_RENUMBER_CELLS_RCM, /* Reverse Cuthill-McKee */
60  CS_RENUMBER_CELLS_NONE /* No cells renumbering */
61 
63 
64 typedef enum {
65 
66  CS_RENUMBER_I_FACES_BLOCK, /* No shared cell in block */
67  CS_RENUMBER_I_FACES_MULTIPASS, /* Use multipass face numbering */
68  CS_RENUMBER_I_FACES_SIMD, /* Renumber for vector (SIMD) operations */
69  CS_RENUMBER_I_FACES_NONE /* No interior face numbering */
70 
72 
73 typedef enum {
74 
75  CS_RENUMBER_B_FACES_THREAD, /* No cell shared between threads */
76  CS_RENUMBER_B_FACES_SIMD, /* Renumber for vector (SIMD) operations */
77  CS_RENUMBER_B_FACES_NONE /* No boundary face numbering */
78 
80 
81 typedef enum {
82 
83  CS_RENUMBER_VERTICES_BY_CELL_ADJ, /* Renumbering based on cell adjacency */
84  CS_RENUMBER_VERTICES_BY_FACE_ADJ, /* Renumbering based on face adjacency */
85  CS_RENUMBER_VERTICES_NONE /* No vertex numbering */
86 
88 
89 /* Ordering options for adjacency arrays */
90 
91 typedef enum {
92 
93  CS_RENUMBER_ADJACENT_LOW, /* Lowest adjacent id first */
94  CS_RENUMBER_ADJACENT_HIGH /* Highest adjacent id first */
95 
97 
98 /*=============================================================================
99  * Public function prototypes
100  *============================================================================*/
101 
102 /*----------------------------------------------------------------------------
103  * Set the target number of threads for mesh renumbering.
104  *
105  * By default, the target number of threads is set to cs_glob_n_threads,
106  * but the value may be forced using this function. This is mainly useful
107  * for testing purposes.
108  *
109  * parameters:
110  * n_threads <-- target number of threads for mesh numbering
111  *----------------------------------------------------------------------------*/
112 
113 void
114 cs_renumber_set_n_threads(int n_threads);
115 
116 /*----------------------------------------------------------------------------
117  * Return the target number of threads for mesh renumbering.
118  *
119  * returns:
120  * the target number of threads for mesh numbering
121  *----------------------------------------------------------------------------*/
122 
123 int
125 
126 /*----------------------------------------------------------------------------
127  * Set the minimum sunset sizes when renumbering for threads.
128  *
129  * parameters:
130  * min_i_subset_size <-- minimum number of interior faces per
131  * thread per group
132  * min_b_subset_size <-- minimum number of boundary faces per
133  * thread per group
134  *----------------------------------------------------------------------------*/
135 
136 void
138  cs_lnum_t min_b_subset_size);
139 
140 /*----------------------------------------------------------------------------
141  * Get the minimum sunset sizes when renumbering for threads.
142  *
143  * min_i_subset_size --> minimum number of interior faces per
144  * thread per group, or NULL
145  * min_b_subset_size --> minimum number of boundary faces per
146  * thread per group, or NULL
147  *----------------------------------------------------------------------------*/
148 
149 void
150 cs_renumber_get_min_subset_size(cs_lnum_t *min_i_subset_size,
151  cs_lnum_t *min_b_subset_size);
152 
153 /*----------------------------------------------------------------------------*/
171 /*----------------------------------------------------------------------------*/
172 
173 void
174 cs_renumber_set_algorithm(bool halo_adjacent_cells_last,
175  bool halo_adjacent_faces_last,
176  cs_renumber_ordering_t i_faces_base_ordering,
177  cs_renumber_cells_type_t cells_pre_numbering,
178  cs_renumber_cells_type_t cells_numbering,
179  cs_renumber_i_faces_type_t i_faces_numbering,
180  cs_renumber_b_faces_type_t b_faces_numbering,
181  cs_renumber_vertices_type_t vertices_numbering);
182 
183 /*----------------------------------------------------------------------------*/
203 /*----------------------------------------------------------------------------*/
204 
205 void
206 cs_renumber_get_algorithm(bool *halo_adjacent_cells_last,
207  bool *halo_adjacent_faces_last,
208  cs_renumber_ordering_t *i_faces_base_ordering,
209  cs_renumber_cells_type_t *cells_pre_numbering,
210  cs_renumber_cells_type_t *cells_numbering,
211  cs_renumber_i_faces_type_t *i_faces_numbering,
212  cs_renumber_b_faces_type_t *b_faces_numbering,
213  cs_renumber_vertices_type_t *vertices_numbering);
214 
215 /*----------------------------------------------------------------------------
216  * Renumber mesh elements for vectorization or threading depending on code
217  * options and target machine.
218  *
219  * Renumbering cells may also allow improving locality (and favor faces
220  * renumbering).
221  * It is also possible to place cells connected to ghost cells last,
222  * which may be useful to enable computation/communication overlap.
223  *
224  * parameters:
225  * mesh <-> pointer to global mesh structure
226  *----------------------------------------------------------------------------*/
227 
228 void
230 
231 /*----------------------------------------------------------------------------*/
240 /*----------------------------------------------------------------------------*/
241 
242 void
244 
245 /*----------------------------------------------------------------------------
246  * Renumber interior faces for vectorization or threading depending on code
247  * options and target machine.
248  *
249  * parameters:
250  * mesh <-> pointer to global mesh structure
251  *----------------------------------------------------------------------------*/
252 
253 void
255 
256 /*----------------------------------------------------------------------------
257  * Renumber interior faces by global number.
258  *
259  * This effectively resets the interior faces to their initial numbering.
260  *
261  * parameters:
262  * mesh <-> pointer to global mesh structure
263  *----------------------------------------------------------------------------*/
264 
265 void
267 
268 /*----------------------------------------------------------------------------
269  * Renumber boundary faces for vectorization or threading depending on code
270  * options and target machine.
271  *
272  * parameters:
273  * mesh <-> pointer to global mesh structure
274  *----------------------------------------------------------------------------*/
275 
276 void
278 
279 /*----------------------------------------------------------------------------
280  * Renumber boundary faces by global number.
281  *
282  * This effectively resets the boundary faces to their initial numbering.
283  *
284  * parameters:
285  * mesh <-> pointer to global mesh structure
286  *----------------------------------------------------------------------------*/
287 
288 void
290 
291 /*----------------------------------------------------------------------------*/
300 /*----------------------------------------------------------------------------*/
301 
302 void
304 
305 /*----------------------------------------------------------------------------*/
306 
308 
309 #endif /* __CS_RENUMBER_H__ */
CS_RENUMBER_CELLS_METIS_PART
Definition: cs_renumber.h:55
cs_renumber_b_faces_by_gnum
void cs_renumber_b_faces_by_gnum(cs_mesh_t *mesh)
Definition: cs_renumber.c:6066
CS_RENUMBER_I_FACES_MULTIPASS
Definition: cs_renumber.h:67
CS_RENUMBER_B_FACES_NONE
Definition: cs_renumber.h:77
cs_renumber_get_min_subset_size
void cs_renumber_get_min_subset_size(cs_lnum_t *min_i_subset_size, cs_lnum_t *min_b_subset_size)
Get the minimum sunset sizes when renumbering for threads.
Definition: cs_renumber.c:5734
CS_RENUMBER_ADJACENT_HIGH
Definition: cs_renumber.h:94
cs_renumber_set_min_subset_size
void cs_renumber_set_min_subset_size(cs_lnum_t min_i_subset_size, cs_lnum_t min_b_subset_size)
Set the minimum sunset sizes when renumbering for threads.
Definition: cs_renumber.c:5715
CS_RENUMBER_B_FACES_SIMD
Definition: cs_renumber.h:76
CS_RENUMBER_B_FACES_THREAD
Definition: cs_renumber.h:75
cs_renumber_i_faces
void cs_renumber_i_faces(cs_mesh_t *mesh)
Renumber interior faces for vectorization or threading depending on code options and target machine.
Definition: cs_renumber.c:5938
cs_renumber_cells
void cs_renumber_cells(cs_mesh_t *mesh)
Renumber cells depending on code options and target machine.
Definition: cs_renumber.c:5888
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
CS_RENUMBER_VERTICES_BY_FACE_ADJ
Definition: cs_renumber.h:84
CS_RENUMBER_I_FACES_SIMD
Definition: cs_renumber.h:68
cs_renumber_vertices_type_t
cs_renumber_vertices_type_t
Vertices renumbering algorithm types.
Definition: cs_renumber.h:81
cs_renumber_ordering_t
cs_renumber_ordering_t
Ordering options for adjacency arrays.
Definition: cs_renumber.h:91
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
CS_RENUMBER_CELLS_MORTON
Definition: cs_renumber.h:57
cs_renumber_vertices
void cs_renumber_vertices(cs_mesh_t *mesh)
Renumber vertices depending on code options and target machine.
Definition: cs_renumber.c:6102
CS_RENUMBER_CELLS_SCOTCH_PART
Definition: cs_renumber.h:53
cs_renumber_mesh
void cs_renumber_mesh(cs_mesh_t *mesh)
Renumber mesh elements for vectorization or threading depending on code options and target machine.
Definition: cs_renumber.c:5853
mesh
Definition: mesh.f90:26
CS_RENUMBER_CELLS_NONE
Definition: cs_renumber.h:60
cs_mesh.h
cs_renumber_i_faces_by_gnum
void cs_renumber_i_faces_by_gnum(cs_mesh_t *mesh)
Definition: cs_renumber.c:5984
cs_renumber_get_algorithm
void cs_renumber_get_algorithm(bool *halo_adjacent_cells_last, bool *halo_adjacent_faces_last, cs_renumber_ordering_t *i_faces_base_ordering, cs_renumber_cells_type_t *cells_pre_numbering, cs_renumber_cells_type_t *cells_numbering, cs_renumber_i_faces_type_t *i_faces_numbering, cs_renumber_b_faces_type_t *b_faces_numbering, cs_renumber_vertices_type_t *vertices_numbering)
Return the algorithms for mesh renumbering.
Definition: cs_renumber.c:5807
cs_renumber_cells_type_t
cs_renumber_cells_type_t
Cell renumbering algorithm types.
Definition: cs_renumber.h:51
CS_RENUMBER_I_FACES_BLOCK
Definition: cs_renumber.h:66
CS_RENUMBER_I_FACES_NONE
Definition: cs_renumber.h:69
CS_RENUMBER_VERTICES_NONE
Definition: cs_renumber.h:85
cs_renumber_get_n_threads
int cs_renumber_get_n_threads(void)
Return the target number of threads for mesh renumbering.
Definition: cs_renumber.c:5695
cs_renumber_set_n_threads
void cs_renumber_set_n_threads(int n_threads)
Set the target number of threads for mesh renumbering.
Definition: cs_renumber.c:5674
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
CS_RENUMBER_ADJACENT_LOW
Definition: cs_renumber.h:93
cs_renumber_b_faces_type_t
cs_renumber_b_faces_type_t
Boundary faces renumbering algorithm types.
Definition: cs_renumber.h:73
CS_RENUMBER_CELLS_HILBERT
Definition: cs_renumber.h:58
CS_RENUMBER_VERTICES_BY_CELL_ADJ
Definition: cs_renumber.h:83
CS_RENUMBER_CELLS_METIS_ORDER
Definition: cs_renumber.h:56
cs_renumber_set_algorithm
void cs_renumber_set_algorithm(bool halo_adjacent_cells_last, bool halo_adjacent_faces_last, cs_renumber_ordering_t i_faces_base_ordering, cs_renumber_cells_type_t cells_pre_numbering, cs_renumber_cells_type_t cells_numbering, cs_renumber_i_faces_type_t i_faces_numbering, cs_renumber_b_faces_type_t b_faces_numbering, cs_renumber_vertices_type_t vertices_numbering)
Select the algorithm for mesh renumbering.
Definition: cs_renumber.c:5764
CS_RENUMBER_CELLS_SCOTCH_ORDER
Definition: cs_renumber.h:54
CS_RENUMBER_CELLS_RCM
Definition: cs_renumber.h:59
cs_renumber_b_faces
void cs_renumber_b_faces(cs_mesh_t *mesh)
Renumber boundary faces for vectorization or threading depending on code options and target machine.
Definition: cs_renumber.c:6020
cs_renumber_i_faces_type_t
cs_renumber_i_faces_type_t
Interior faces renumbering algorithm types.
Definition: cs_renumber.h:64
cs_mesh_t
Definition: cs_mesh.h:63
cs_base.h