9.2
general 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-2026 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 "base/cs_defs.h"
39#include "base/cs_block_dist.h"
40
41/*=============================================================================
42 * Macro definitions
43 *============================================================================*/
44
49#define CS_CRYSTAL_ROUTER_USE_DEST_ID (1 << 0)
50
51#define CS_CRYSTAL_ROUTER_ADD_SRC_ID (1 << 1)
52#define CS_CRYSTAL_ROUTER_ADD_SRC_RANK (1 << 2)
53
54/*============================================================================
55 * Type definitions
56 *============================================================================*/
57
58/* Opaque crystal router structure */
59
60#if defined(HAVE_MPI)
61
62typedef struct _cs_crystal_router_t cs_crystal_router_t;
63
64#endif
65
66/*=============================================================================
67 * Public function prototypes
68 *============================================================================*/
69
70#if defined(HAVE_MPI)
71
72/*----------------------------------------------------------------------------*/
99/*----------------------------------------------------------------------------*/
100
102cs_crystal_router_create_s(size_t n_elts,
103 int stride,
104 cs_datatype_t datatype,
105 int flags,
106 const void *elt,
107 const cs_lnum_t *src_id,
108 const cs_lnum_t *dest_id,
109 const int dest_rank[],
110 MPI_Comm comm);
111
112/*----------------------------------------------------------------------------*/
139/*----------------------------------------------------------------------------*/
140
142cs_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 *src_id,
148 const cs_lnum_t *dest_id,
149 const int dest_rank[],
150 MPI_Comm comm);
151
152/*----------------------------------------------------------------------------*/
158/*----------------------------------------------------------------------------*/
159
160void
162
163/*----------------------------------------------------------------------------*/
171/*----------------------------------------------------------------------------*/
172
173void
175
176/*----------------------------------------------------------------------------*/
186/*----------------------------------------------------------------------------*/
187
190
191/*----------------------------------------------------------------------------*/
206/*----------------------------------------------------------------------------*/
207
210
211/*----------------------------------------------------------------------------*/
255/*----------------------------------------------------------------------------*/
256
257void
259 int **src_rank,
260 cs_lnum_t **dest_id,
261 cs_lnum_t **src_id,
262 cs_lnum_t **data_index,
263 void **data);
264
265/*----------------------------------------------------------------------------*/
277/*----------------------------------------------------------------------------*/
278
279size_t
281 size_t *max_sizes);
282
283#endif /* defined(HAVE_MPI) */
284
285/*----------------------------------------------------------------------------*/
292/*----------------------------------------------------------------------------*/
293
294void
296
297/*----------------------------------------------------------------------------*/
298
299#endif /* CS_CRYSTAL_ROUTER_H */
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 *src_id, const cs_lnum_t *dest_id, const int dest_rank[], MPI_Comm comm)
Create a Crystal Router for indexed data.
Definition: cs_crystal_router.cpp:1641
size_t cs_crystal_router_get_max_sizes(cs_crystal_router_t *cr, size_t *max_sizes)
Query maximum buffer sizes reached by a Crystal Router.
Definition: cs_crystal_router.cpp:2180
void cs_crystal_router_exchange(cs_crystal_router_t *cr)
Exchange data with a Crystal Router.
Definition: cs_crystal_router.cpp:1827
void cs_crystal_router_destroy(cs_crystal_router_t **cr)
Destroy a Crystal Router.
Definition: cs_crystal_router.cpp:1796
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 *src_id, const cs_lnum_t *dest_id, const int dest_rank[], MPI_Comm comm)
Create a Crystal Router for strided data.
Definition: cs_crystal_router.cpp:1531
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.cpp:1925
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.cpp:2051
void cs_crystal_router_log_finalize(void)
Log performance information relative to Crystal Router exchange.
Definition: cs_crystal_router.cpp:2205
cs_lnum_t cs_crystal_router_n_recv_elts(const cs_crystal_router_t *cr)
Get number of elements received with Crystal Router.
Definition: cs_crystal_router.cpp:1994
struct _cs_crystal_router_t cs_crystal_router_t
Definition: cs_crystal_router.h:62
cs_datatype_t
Definition: cs_defs.h:290
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325