9.2
general documentation
cs_rank_neighbors.h
Go to the documentation of this file.
1#ifndef CS_RANK_NEIGHBORS_H
2#define CS_RANK_NEIGHBORS_H
3
4/*============================================================================
5 * Management of parallel rank neighbors.
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
45/*============================================================================
46 * Type definitions
47 *============================================================================*/
48
49/* Exchange algorithm choice */
50
51typedef enum {
52
56
58
59#if defined(HAVE_MPI)
60
61/* Rank neighbors structure */
62
63typedef struct {
64
65 int size;
66 int *rank;
69
70#endif
71
72/*=============================================================================
73 * Global variables
74 *============================================================================*/
75
76extern const char *cs_rank_neighbors_exchange_name[];
77
78/*=============================================================================
79 * Public function prototypes
80 *============================================================================*/
81
82#if defined(HAVE_MPI)
83
84/*----------------------------------------------------------------------------*/
93/*----------------------------------------------------------------------------*/
94
96cs_rank_neighbors_create(size_t n_elts,
97 const int elt_rank[]);
98
99/*----------------------------------------------------------------------------*/
105/*----------------------------------------------------------------------------*/
106
107void
109
110/*----------------------------------------------------------------------------*/
124/*----------------------------------------------------------------------------*/
125
126void
128 size_t n_elts,
129 const int elt_rank[],
130 int *elt_rank_index);
131
132/*----------------------------------------------------------------------------*/
142/*----------------------------------------------------------------------------*/
143
144void
146 MPI_Comm comm);
147
148/*----------------------------------------------------------------------------*/
160/*----------------------------------------------------------------------------*/
161
162void
164 size_t n_elts,
165 const int *elt_rank_index,
166 cs_lnum_t *elt_rank_count);
167
168/*----------------------------------------------------------------------------*/
181/*----------------------------------------------------------------------------*/
182
183void
185 cs_rank_neighbors_t **n_recv,
186 const cs_lnum_t *send_count,
187 cs_lnum_t **recv_count,
188 MPI_Comm comm);
189
190/*----------------------------------------------------------------------------*/
205/*----------------------------------------------------------------------------*/
206
207void
209 cs_rank_neighbors_t **n_recv,
210 const cs_lnum_t *send_count,
211 cs_lnum_t **recv_count,
212 cs_rank_neighbors_exchange_t exchange_type,
213 MPI_Comm comm);
214
215#endif /* defined(HAVE_MPI) */
216
217/*----------------------------------------------------------------------------*/
223/*----------------------------------------------------------------------------*/
224
227
228/*----------------------------------------------------------------------------*/
234/*----------------------------------------------------------------------------*/
235
236void
238
239/*----------------------------------------------------------------------------*/
240
241#endif /* CS_RANK_NEIGHBORS_H */
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
@ t
Definition: cs_field_pointer.h:91
void cs_rank_neighbors_set_exchange_type(cs_rank_neighbors_exchange_t t)
Set current type of rank neighbors collective algorithm choice.
Definition: cs_rank_neighbors.cpp:1030
void cs_rank_neighbors_destroy(cs_rank_neighbors_t **n)
Destroy a rank neighborhood structure.
Definition: cs_rank_neighbors.cpp:394
void cs_rank_neighbors_to_index(const cs_rank_neighbors_t *n, size_t n_elts, const int elt_rank[], int *elt_rank_index)
Given a list of element ranks, determine the associated element rank indexes in a rank neighborhood s...
Definition: cs_rank_neighbors.cpp:430
void cs_rank_neighbors_sync_count_m(const cs_rank_neighbors_t *n_send, cs_rank_neighbors_t **n_recv, const cs_lnum_t *send_count, cs_lnum_t **recv_count, cs_rank_neighbors_exchange_t exchange_type, MPI_Comm comm)
Exchange send and receive counts for rank neighborhoods, using a given method.
Definition: cs_rank_neighbors.cpp:797
cs_rank_neighbors_t * cs_rank_neighbors_create(size_t n_elts, const int elt_rank[])
Create a rank neighbors structure base on a list of element ranks.
Definition: cs_rank_neighbors.cpp:349
void cs_rank_neighbors_symmetrize(cs_rank_neighbors_t *n, MPI_Comm comm)
Symmetrize a rank neighborhood structure.
Definition: cs_rank_neighbors.cpp:516
void cs_rank_neighbors_count(const cs_rank_neighbors_t *n, size_t n_elts, const int *elt_rank_index, cs_lnum_t *elt_rank_count)
Given a list of element rank indexes, count occurences for a rank neighborhood structure.
Definition: cs_rank_neighbors.cpp:722
const char * cs_rank_neighbors_exchange_name[]
cs_rank_neighbors_exchange_t cs_rank_neighbors_get_exchange_type(void)
Get current type of rank neighbors collective algorithm choice.
Definition: cs_rank_neighbors.cpp:1016
cs_rank_neighbors_exchange_t
Definition: cs_rank_neighbors.h:51
@ CS_RANK_NEIGHBORS_PEX
Definition: cs_rank_neighbors.h:53
@ CS_RANK_NEIGHBORS_NBX
Definition: cs_rank_neighbors.h:54
@ CS_RANK_NEIGHBORS_CRYSTAL_ROUTER
Definition: cs_rank_neighbors.h:55
void cs_rank_neighbors_sync_count(const cs_rank_neighbors_t *n_send, cs_rank_neighbors_t **n_recv, const cs_lnum_t *send_count, cs_lnum_t **recv_count, MPI_Comm comm)
Exchange send and receive counts for rank neighborhoods.
Definition: cs_rank_neighbors.cpp:765
Definition: cs_rank_neighbors.h:63
int size
Definition: cs_rank_neighbors.h:65
int * rank
Definition: cs_rank_neighbors.h:66