My Project
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-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 #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 /*----------------------------------------------------------------------------*/
138 /*----------------------------------------------------------------------------*/
139 
141 cs_crystal_router_create_i(size_t n_elts,
142  cs_datatype_t datatype,
143  int flags,
144  const cs_lnum_t *eld_idx,
145  const void *elt,
146  const cs_lnum_t *dest_id,
147  const int dest_rank[],
148  MPI_Comm comm);
149 
150 /*----------------------------------------------------------------------------*/
156 /*----------------------------------------------------------------------------*/
157 
158 void
160 
161 /*----------------------------------------------------------------------------*/
169 /*----------------------------------------------------------------------------*/
170 
171 void
173 
174 /*----------------------------------------------------------------------------*/
184 /*----------------------------------------------------------------------------*/
185 
186 cs_lnum_t
188 
189 /*----------------------------------------------------------------------------*/
222 /*----------------------------------------------------------------------------*/
223 
224 void
226  int **src_rank,
227  cs_lnum_t **dest_id,
228  cs_lnum_t **src_id,
229  cs_lnum_t **data_index,
230  void **data);
231 
232 #endif /* defined(HAVE_MPI) */
233 
234 /*----------------------------------------------------------------------------*/
241 /*----------------------------------------------------------------------------*/
242 
243 void
245 
246 /*----------------------------------------------------------------------------*/
247 
249 
250 #endif /* __CS_CRYSTAL_ROUTER_H__ */
cs_defs.h
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_crystal_router_log_finalize
void cs_crystal_router_log_finalize(void)
Log performance information relative to Crystal Router exchange.
Definition: cs_crystal_router.c:1877
cs_datatype_t
cs_datatype_t
Definition: cs_defs.h:260
cs_crystal_router_destroy
void cs_crystal_router_destroy(cs_crystal_router_t **cr)
Destroy a Crystal Router.
Definition: cs_crystal_router.c:1542
stride
void const cs_int_t const cs_int_t const cs_int_t const cs_int_t * stride
Definition: cs_sat_coupling.h:325
cs_crystal_router_t
struct _cs_crystal_router_t cs_crystal_router_t
Definition: cs_crystal_router.h:66
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_crystal_router_get_data
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:1751
cs_crystal_router_create_i
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:1445
cs_crystal_router_exchange
void cs_crystal_router_exchange(cs_crystal_router_t *cr)
Exchange data with a Crystal Router.
Definition: cs_crystal_router.c:1573
cs_crystal_router_n_elts
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:1671
cs_crystal_router_create_s
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
cs_block_dist.h