My Project
programmer's 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-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 
49 /*============================================================================
50  * Type definitions
51  *============================================================================*/
52 
53 /* Exchange algorithm choice */
54 
55 typedef enum {
56 
60 
62 
63 #if defined(HAVE_MPI)
64 
65 /* Rank neighbors structure */
66 
67 typedef struct {
68 
69  int size;
70  int *rank;
73 
74 #endif
75 
76 /*=============================================================================
77  * Global variables
78  *============================================================================*/
79 
80 extern const char *cs_rank_neighbors_exchange_name[];
81 
82 /*=============================================================================
83  * Public function prototypes
84  *============================================================================*/
85 
86 #if defined(HAVE_MPI)
87 
88 /*----------------------------------------------------------------------------*/
97 /*----------------------------------------------------------------------------*/
98 
100 cs_rank_neighbors_create(size_t n_elts,
101  const int elt_rank[]);
102 
103 /*----------------------------------------------------------------------------*/
109 /*----------------------------------------------------------------------------*/
110 
111 void
113 
114 /*----------------------------------------------------------------------------*/
128 /*----------------------------------------------------------------------------*/
129 
130 void
132  size_t n_elts,
133  int *elt_rank,
134  int *elt_rank_index);
135 
136 /*----------------------------------------------------------------------------*/
146 /*----------------------------------------------------------------------------*/
147 
148 void
150  MPI_Comm comm);
151 
152 /*----------------------------------------------------------------------------*/
164 /*----------------------------------------------------------------------------*/
165 
166 void
168  size_t n_elts,
169  const int *elt_rank_index,
170  cs_lnum_t *elt_rank_count);
171 
172 /*----------------------------------------------------------------------------*/
185 /*----------------------------------------------------------------------------*/
186 
187 void
189  cs_rank_neighbors_t **n_recv,
190  const cs_lnum_t *send_count,
191  cs_lnum_t **recv_count,
192  MPI_Comm comm);
193 
194 #endif /* defined(HAVE_MPI) */
195 
196 /*----------------------------------------------------------------------------*/
202 /*----------------------------------------------------------------------------*/
203 
206 
207 /*----------------------------------------------------------------------------*/
213 /*----------------------------------------------------------------------------*/
214 
215 void
217 
218 /*----------------------------------------------------------------------------*/
219 
221 
222 #endif /* __CS_RANK_NEIGHBORS_H__ */
cs_defs.h
cs_rank_neighbors_get_exchange_type
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.c:953
cs_rank_neighbors_sync_count
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.c:759
CS_RANK_NEIGHBORS_PEX
Definition: cs_rank_neighbors.h:57
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
cs_rank_neighbors_t::size
int size
Definition: cs_rank_neighbors.h:69
CS_RANK_NEIGHBORS_NBX
Definition: cs_rank_neighbors.h:58
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_rank_neighbors_set_exchange_type
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.c:967
cs_rank_neighbors_symmetrize
void cs_rank_neighbors_symmetrize(cs_rank_neighbors_t *n, MPI_Comm comm)
Symmetrize a rank neighborhood structure.
Definition: cs_rank_neighbors.c:512
cs_rank_neighbors_destroy
void cs_rank_neighbors_destroy(cs_rank_neighbors_t **n)
Destroy a rank neighborhood structure.
Definition: cs_rank_neighbors.c:390
cs_rank_neighbors_t::rank
int * rank
Definition: cs_rank_neighbors.h:70
cs_rank_neighbors_create
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.c:345
cs_rank_neighbors_t
Definition: cs_rank_neighbors.h:67
cs_rank_neighbors_exchange_t
cs_rank_neighbors_exchange_t
Definition: cs_rank_neighbors.h:55
cs_rank_neighbors_exchange_name
const char * cs_rank_neighbors_exchange_name[]
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
t
Definition: cs_field_pointer.h:98
CS_RANK_NEIGHBORS_CRYSTAL_ROUTER
Definition: cs_rank_neighbors.h:59
cs_rank_neighbors_count
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.c:716
cs_rank_neighbors_to_index
void cs_rank_neighbors_to_index(const cs_rank_neighbors_t *n, size_t n_elts, 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.c:426
cs_block_dist.h