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-2018 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;
72 } cs_rank_neighbors_t;
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 
99 cs_rank_neighbors_t *
100 cs_rank_neighbors_create(size_t n_elts,
101  const int elt_rank[]);
102 
103 /*----------------------------------------------------------------------------*/
109 /*----------------------------------------------------------------------------*/
110 
111 void
112 cs_rank_neighbors_destroy(cs_rank_neighbors_t **n);
113 
114 /*----------------------------------------------------------------------------*/
128 /*----------------------------------------------------------------------------*/
129 
130 void
131 cs_rank_neighbors_to_index(const cs_rank_neighbors_t *n,
132  size_t n_elts,
133  int *elt_rank,
134  int *elt_rank_index);
135 
136 /*----------------------------------------------------------------------------*/
146 /*----------------------------------------------------------------------------*/
147 
148 void
149 cs_rank_neighbors_symmetrize(cs_rank_neighbors_t *n,
150  MPI_Comm comm);
151 
152 /*----------------------------------------------------------------------------*/
164 /*----------------------------------------------------------------------------*/
165 
166 void
167 cs_rank_neighbors_count(const cs_rank_neighbors_t *n,
168  size_t n_elts,
169  const int *elt_rank_index,
170  cs_lnum_t *elt_rank_count);
171 
172 /*----------------------------------------------------------------------------*/
185 /*----------------------------------------------------------------------------*/
186 
187 void
188 cs_rank_neighbors_sync_count(const cs_rank_neighbors_t *n_send,
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__ */
Definition: cs_rank_neighbors.h:57
#define BEGIN_C_DECLS
Definition: cs_defs.h:462
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_exchange_t
Definition: cs_rank_neighbors.h:55
Definition: cs_rank_neighbors.h:59
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:293
const char * cs_rank_neighbors_exchange_name[]
#define END_C_DECLS
Definition: cs_defs.h:463
Definition: cs_field_pointer.h:96
Definition: cs_rank_neighbors.h:58
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