programmer's documentation
cs_crystal_router.h
Go to the documentation of this file.
1 #ifndef __CS_CRYSTAL_ROUTER_H__
2 #define __CS_CRYSTAL_ROUTER_H__
3 
4 /*============================================================================
5  * Crystal Router parallel exchange algorithm based operations.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2018 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 #if defined(HAVE_MPI)
31 #include <mpi.h>
32 #endif
33 
34 /*----------------------------------------------------------------------------
35  * Local headers
36  *----------------------------------------------------------------------------*/
37 
38 #include "cs_defs.h"
39 #include "cs_block_dist.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*=============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
53 #define CS_CRYSTAL_ROUTER_USE_DEST_ID (1 << 0)
54 
55 #define CS_CRYSTAL_ROUTER_ADD_SRC_ID (1 << 1)
56 #define CS_CRYSTAL_ROUTER_ADD_SRC_RANK (1 << 2)
57 
58 /*============================================================================
59  * Type definitions
60  *============================================================================*/
61 
62 /* Opaque crystal router structure */
63 
64 #if defined(HAVE_MPI)
65 
66 typedef struct _cs_crystal_router_t cs_crystal_router_t;
67 
68 #endif
69 
70 /*=============================================================================
71  * Public function prototypes
72  *============================================================================*/
73 
74 #if defined(HAVE_MPI)
75 
76 /*----------------------------------------------------------------------------*/
101 /*----------------------------------------------------------------------------*/
102 
104 cs_crystal_router_create_s(size_t n_elts,
105  int stride,
106  cs_datatype_t datatype,
107  int flags,
108  const void *elt,
109  const cs_lnum_t *dest_id,
110  const int dest_rank[],
111  MPI_Comm comm);
112 
113 /*----------------------------------------------------------------------------*/
139 /*----------------------------------------------------------------------------*/
140 
142 cs_crystal_router_create_i(size_t n_elts,
143  cs_datatype_t datatype,
144  int flags,
145  const cs_lnum_t *eld_idx,
146  const void *elt,
147  const cs_lnum_t *dest_id,
148  const int dest_rank[],
149  MPI_Comm comm);
150 
151 /*----------------------------------------------------------------------------*/
157 /*----------------------------------------------------------------------------*/
158 
159 void
161 
162 /*----------------------------------------------------------------------------*/
170 /*----------------------------------------------------------------------------*/
171 
172 void
174 
175 /*----------------------------------------------------------------------------*/
185 /*----------------------------------------------------------------------------*/
186 
187 cs_lnum_t
189 
190 /*----------------------------------------------------------------------------*/
223 /*----------------------------------------------------------------------------*/
224 
225 void
227  int **src_rank,
228  cs_lnum_t **dest_id,
229  cs_lnum_t **src_id,
230  cs_lnum_t **data_index,
231  void **data);
232 
233 #endif /* defined(HAVE_MPI) */
234 
235 /*----------------------------------------------------------------------------*/
242 /*----------------------------------------------------------------------------*/
243 
244 void
246 
247 /*----------------------------------------------------------------------------*/
248 
250 
251 #endif /* __CS_CRYSTAL_ROUTER_H__ */
cs_datatype_t
Definition: cs_defs.h:255
#define BEGIN_C_DECLS
Definition: cs_defs.h:461
void cs_crystal_router_log_finalize(void)
Log performance information relative to Crystal Router exchange.
Definition: cs_crystal_router.c:1878
struct _cs_crystal_router_t cs_crystal_router_t
Definition: cs_crystal_router.h:66
void cs_crystal_router_destroy(cs_crystal_router_t **cr)
Destroy a Crystal Router.
Definition: cs_crystal_router.c:1543
cs_crystal_router_t * cs_crystal_router_create_i(size_t n_elts, cs_datatype_t datatype, int flags, const cs_lnum_t *eld_idx, const void *elt, const cs_lnum_t *dest_id, const int dest_rank[], MPI_Comm comm)
Create a Crystal Router for indexed data.
Definition: cs_crystal_router.c:1446
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:293
#define END_C_DECLS
Definition: cs_defs.h:462
cs_crystal_router_t * cs_crystal_router_create_s(size_t n_elts, int stride, cs_datatype_t datatype, int flags, const void *elt, const cs_lnum_t *dest_id, const int dest_rank[], MPI_Comm comm)
Create a Crystal Router for strided data.
Definition: cs_crystal_router.c:1341
void cs_crystal_router_get_data(cs_crystal_router_t *cr, int **src_rank, cs_lnum_t **dest_id, cs_lnum_t **src_id, cs_lnum_t **data_index, void **data)
Get data elements associated with a Crystal Router.
Definition: cs_crystal_router.c:1752
void cs_crystal_router_exchange(cs_crystal_router_t *cr)
Exchange data with a Crystal Router.
Definition: cs_crystal_router.c:1574
cs_lnum_t cs_crystal_router_n_elts(const cs_crystal_router_t *cr)
Get number of elements associated with Crystal Router.
Definition: cs_crystal_router.c:1672