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-2015 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 #define CS_CRYSTAL_ROUTER_ADD_SRC_ID (1 << 1)
55 #define CS_CRYSTAL_ROUTER_ADD_SRC_RANK (1 << 2)
56 
57 /*============================================================================
58  * Type definitions
59  *============================================================================*/
60 
61 /* Opaque crystal router structure */
62 
63 #if defined(HAVE_MPI)
64 
65 typedef struct _cs_crystal_router_t cs_crystal_router_t;
66 
67 #endif
68 
69 /*=============================================================================
70  * Public function prototypes
71  *============================================================================*/
72 
73 #if defined(HAVE_MPI)
74 
75 /*----------------------------------------------------------------------------*/
100 /*----------------------------------------------------------------------------*/
101 
103 cs_crystal_router_create_s(size_t n_elts,
104  int stride,
105  cs_datatype_t datatype,
106  int flags,
107  const void *elt,
108  const cs_lnum_t *dest_id,
109  const int dest_rank[],
110  MPI_Comm comm);
111 
112 /*----------------------------------------------------------------------------*/
118 /*----------------------------------------------------------------------------*/
119 
120 void
122 
123 /*----------------------------------------------------------------------------*/
131 /*----------------------------------------------------------------------------*/
132 
133 void
135 
136 /*----------------------------------------------------------------------------*/
142 /*----------------------------------------------------------------------------*/
143 
144 void
146 
147 /*----------------------------------------------------------------------------*/
157 /*----------------------------------------------------------------------------*/
158 
159 cs_lnum_t
161 
162 /*----------------------------------------------------------------------------*/
192 /*----------------------------------------------------------------------------*/
193 
194 void
196  int **src_rank,
197  cs_lnum_t **dest_id,
198  cs_lnum_t **src_id,
199  cs_lnum_t **dest_index,
200  void **dest_data);
201 
202 #endif /* defined(HAVE_MPI) */
203 
204 /*----------------------------------------------------------------------------*/
211 /*----------------------------------------------------------------------------*/
212 
213 void
215 
216 /*----------------------------------------------------------------------------*/
217 
219 
220 #endif /* __CS_CRYSTAL_ROUTER_H__ */
cs_datatype_t
Definition: cs_defs.h:255
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 **dest_index, void **dest_data)
Get data elements associated with a Crystal Router.
Definition: cs_crystal_router.c:949
#define BEGIN_C_DECLS
Definition: cs_defs.h:429
void cs_crystal_router_sort_by_source_rank(cs_crystal_router_t *cr)
Sort stride crystal router data by source rank.
Definition: cs_crystal_router.c:879
void cs_crystal_router_log_finalize(void)
Log performance information relative to Crystal Router exchange.
Definition: cs_crystal_router.c:1041
struct _cs_crystal_router_t cs_crystal_router_t
Definition: cs_crystal_router.h:65
void cs_crystal_router_destroy(cs_crystal_router_t **cr)
Destroy a Crystal Router.
Definition: cs_crystal_router.c:825
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:292
#define END_C_DECLS
Definition: cs_defs.h:430
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:740
void cs_crystal_router_exchange(cs_crystal_router_t *cr)
Exchange data with a Crystal Router.
Definition: cs_crystal_router.c:856
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:906