programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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-2014 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 #include "cs_base.h"
36 
37 /*----------------------------------------------------------------------------*/
38 
40 
41 /*============================================================================
42  * Macro definitions
43  *============================================================================*/
44 
45 /*============================================================================
46  * Type definitions
47  *============================================================================*/
48 
49 /* Renumbering types */
50 
51 typedef enum {
52 
53  CS_NUMBERING_DEFAULT, /* Default numbering */
54  CS_NUMBERING_VECTORIZE, /* Numbered for vectorization */
55  CS_NUMBERING_THREADS /* Numbered for threads */
56 
58 
59 /* Renumbering structure */
60 
61 typedef struct {
62 
63  cs_numbering_type_t type; /* Numbering type */
64 
65  int vector_size; /* Vector size if vectorized, 1 otherwise */
66 
67  int n_threads; /* Number of threads */
68  int n_groups; /* Number of associated groups */
69 
70  cs_lnum_t *group_index; /* For thread t and group g, the start and end
71  ids for entities in a given group and thread
72  are group_index[t*n_groups*2 + g] and
73  group_index[t*n_groups*2 + g + 1] respectively.
74  (size: n_groups * n_threads * 2) */
75 
77 
78 /*=============================================================================
79  * Global variable definitions
80  *============================================================================*/
81 
82 /* Names for numbering types */
83 
84 extern const char *cs_numbering_type_name[];
85 
86 /*============================================================================
87  * Public function prototypes for Fortran API
88  *============================================================================*/
89 
90 /*=============================================================================
91  * Public function prototypes
92  *============================================================================*/
93 
94 /*----------------------------------------------------------------------------
95  * Create a default numbering information structure.
96  *
97  * parameters:
98  * n_faces <-- number of associated faces
99  *
100  * returns:
101  * pointer to created cs_numbering_t structure
102  *---------------------------------------------------------------------------*/
103 
106 
107 /*----------------------------------------------------------------------------
108  * Create a numbering information structure in case of vectorization.
109  *
110  * parameters:
111  * n_faces <-- number of associated faces
112  * vector_size <-- vector size used for this vectorization
113  *
114  * returns:
115  * pointer to created cs_numbering_t structure
116  *---------------------------------------------------------------------------*/
117 
120  int vector_size);
121 
122 /*----------------------------------------------------------------------------
123  * Create a numbering information structure in case of threading.
124  *
125  * parameters:
126  * n_threads <-- number of threads
127  * n_groups <-- number of groups
128  * group_index <-- group_index[thread_id*group_id*2 + group_id*2] and
129  * group_index[thread_id*group_id*2 + group_id*2 +1] define
130  * the start and end ids for entities in a given group and
131  * thread; (size: n_groups *2 * n_threads)
132  *
133  * returns:
134  * pointer to created cs_numbering_t structure
135  *---------------------------------------------------------------------------*/
136 
138 cs_numbering_create_threaded(int n_threads,
139  int n_groups,
140  cs_lnum_t group_index[]);
141 
142 /*----------------------------------------------------------------------------
143  * Destroy a numbering information structure.
144  *
145  * parameters:
146  * numbering <-> pointer to cs_numbering_t structure pointer (or NULL)
147  *---------------------------------------------------------------------------*/
148 
149 void
151 
152 /*----------------------------------------------------------------------------
153  * Dump a cs_numbering_t structure.
154  *
155  * parameters:
156  * numbering <-- pointer to cs_numbering_t structure (or NULL)
157  *---------------------------------------------------------------------------*/
158 
159 void
160 cs_numbering_dump(const cs_numbering_t *numbering);
161 
162 /*----------------------------------------------------------------------------*/
163 
165 
166 #endif /* __CS_NUMBERING_H__ */
cs_numbering_type_t type
Definition: cs_numbering.h:63
const char * cs_numbering_type_name[]
cs_numbering_t * cs_numbering_create_vectorized(cs_lnum_t n_faces, int vector_size)
Definition: cs_numbering.c:120
void cs_numbering_destroy(cs_numbering_t **numbering)
Definition: cs_numbering.c:189
#define BEGIN_C_DECLS
Definition: cs_defs.h:405
Definition: cs_numbering.h:55
cs_numbering_t * cs_numbering_create_threaded(int n_threads, int n_groups, cs_lnum_t group_index[])
Definition: cs_numbering.c:157
Definition: cs_numbering.h:54
cs_lnum_t * group_index
Definition: cs_numbering.h:70
int vector_size
Definition: cs_numbering.h:65
Definition: cs_numbering.h:53
int n_groups
Definition: cs_numbering.h:68
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:292
void cs_numbering_dump(const cs_numbering_t *numbering)
Definition: cs_numbering.c:209
#define END_C_DECLS
Definition: cs_defs.h:406
int n_threads
Definition: cs_numbering.h:67
cs_numbering_type_t
Definition: cs_numbering.h:51
Definition: cs_numbering.h:61
cs_numbering_t * cs_numbering_create_default(cs_lnum_t n_faces)
Definition: cs_numbering.c:88