Code_Saturne
CFD tool
cs_numbering.h
Go to the documentation of this file.
1 #ifndef __CS_NUMBERING_H__
2 #define __CS_NUMBERING_H__
3 
4 /*============================================================================
5  * Numbering information for vectorization or multithreading
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2012 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  * FVM library headers
32  *----------------------------------------------------------------------------*/
33 
34 #include <fvm_defs.h>
35 
36 /*----------------------------------------------------------------------------
37  * Local headers
38  *----------------------------------------------------------------------------*/
39 
40 #include "cs_base.h"
41 
42 /*----------------------------------------------------------------------------*/
43 
45 
46 /*============================================================================
47  * Macro definitions
48  *============================================================================*/
49 
50 /*============================================================================
51  * Type definitions
52  *============================================================================*/
53 
54 /* Renumbering types */
55 
56 typedef enum {
57 
58  CS_NUMBERING_DEFAULT, /* Default numbering */
59  CS_NUMBERING_VECTORIZE, /* Numbered for vectorization */
60  CS_NUMBERING_THREADS /* Numbered for threads */
61 
63 
64 /* Renumbering structure */
65 
66 typedef struct {
67 
68  cs_numbering_type_t type; /* Numbering type */
69 
70  int vector_size; /* Vector size if vectorized, 1 otherwise */
71 
72  int n_threads; /* Number of threads */
73  int n_groups; /* Number of associated groups */
74 
75  cs_lnum_t *group_index; /* For thread t and group g, the start and end
76  ids for entities in a given group and thread
77  are group_index[t*n_groups*2 + g] and
78  group_index[t*n_groups*2 + g + 1] respectively.
79  (size: n_groups * n_threads * 2) */
80 
82 
83 /*=============================================================================
84  * Global variable definitions
85  *============================================================================*/
86 
87 /* Names for numbering types */
88 
89 extern const char *cs_numbering_type_name[];
90 
91 /*============================================================================
92  * Public function prototypes for Fortran API
93  *============================================================================*/
94 
95 /*=============================================================================
96  * Public function prototypes
97  *============================================================================*/
98 
99 /*----------------------------------------------------------------------------
100  * Create a default numbering information structure.
101  *
102  * parameters:
103  * n_faces <-- number of associated faces
104  *
105  * returns:
106  * pointer to created cs_numbering_t structure
107  *---------------------------------------------------------------------------*/
108 
111 
112 /*----------------------------------------------------------------------------
113  * Create a numbering information structure in case of vectorization.
114  *
115  * parameters:
116  * n_faces <-- number of associated faces
117  * vector_size <-- vector size used for this vectorization
118  *
119  * returns:
120  * pointer to created cs_numbering_t structure
121  *---------------------------------------------------------------------------*/
122 
125  int vector_size);
126 
127 /*----------------------------------------------------------------------------
128  * Create a numbering information structure in case of threading.
129  *
130  * parameters:
131  * n_threads <-- number of threads
132  * n_groups <-- number of groups
133  * group_index <-- group_index[thread_id*group_id*2 + group_id*2] and
134  * group_index[thread_id*group_id*2 + group_id*2 +1] define
135  * the start and end ids for entities in a given group and
136  * thread; (size: n_groups *2 * n_threads)
137  *
138  * returns:
139  * pointer to created cs_numbering_t structure
140  *---------------------------------------------------------------------------*/
141 
143 cs_numbering_create_threaded(int n_threads,
144  int n_groups,
145  cs_lnum_t group_index[]);
146 
147 /*----------------------------------------------------------------------------
148  * Destroy a numbering information structure.
149  *
150  * parameters:
151  * numbering <-> pointer to cs_numbering_t structure pointer (or NULL)
152  *---------------------------------------------------------------------------*/
153 
154 void
156 
157 /*----------------------------------------------------------------------------
158  * Dump a cs_numbering_t structure.
159  *
160  * parameters:
161  * numbering <-- pointer to cs_numbering_t structure (or NULL)
162  *---------------------------------------------------------------------------*/
163 
164 void
165 cs_numbering_dump(const cs_numbering_t *numbering);
166 
167 /*----------------------------------------------------------------------------*/
168 
170 
171 #endif /* __CS_NUMBERING_H__ */
cs_numbering_type_t type
Definition: cs_numbering.h:68
const char * cs_numbering_type_name[]
Definition: cs_numbering.c:73
cs_numbering_t * cs_numbering_create_vectorized(cs_lnum_t n_faces, int vector_size)
Definition: cs_numbering.c:128
void cs_numbering_destroy(cs_numbering_t **numbering)
Definition: cs_numbering.c:197
#define BEGIN_C_DECLS
Definition: cs_defs.h:365
Definition: cs_numbering.h:60
int cs_lnum_t
Definition: cs_defs.h:260
cs_numbering_t * cs_numbering_create_threaded(int n_threads, int n_groups, cs_lnum_t group_index[])
Definition: cs_numbering.c:165
Definition: cs_numbering.h:59
cs_lnum_t * group_index
Definition: cs_numbering.h:75
int vector_size
Definition: cs_numbering.h:70
Definition: cs_numbering.h:58
int n_groups
Definition: cs_numbering.h:73
void cs_numbering_dump(const cs_numbering_t *numbering)
Definition: cs_numbering.c:217
#define END_C_DECLS
Definition: cs_defs.h:366
int n_threads
Definition: cs_numbering.h:72
cs_numbering_type_t
Definition: cs_numbering.h:56
Definition: cs_numbering.h:66
cs_numbering_t * cs_numbering_create_default(cs_lnum_t n_faces)
Definition: cs_numbering.c:96