9.2
general documentation
cs_part_to_block.h
Go to the documentation of this file.
1#ifndef CS_PART_TO_BLOCK_H
2#define CS_PART_TO_BLOCK_H
3
4/*============================================================================
5 * Convert between general domain partition and block distribution.
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/* Opaque general domain partitioning to block distribution structure */
50
51#if defined(HAVE_MPI)
52
53typedef struct _cs_part_to_block_t cs_part_to_block_t;
54
55#endif
56
57/*=============================================================================
58 * Public function prototypes
59 *============================================================================*/
60
61#if defined(HAVE_MPI)
62
63/*----------------------------------------------------------------------------
64 * Initialize partition to block distributor based on global entity numbers.
65 *
66 * arguments:
67 * comm <-- communicator
68 * bi <-- block size and range info
69 * n_ents <-- number of elements in partition
70 * global_ent_num <-- global entity numbers
71 *
72 * returns:
73 * initialized partition to block distributor
74 *----------------------------------------------------------------------------*/
75
79 cs_lnum_t n_ents,
80 const cs_gnum_t global_ent_num[]);
81
82/*----------------------------------------------------------------------------
83 * Destroy a partition to block distributor structure.
84 *
85 * arguments:
86 * d <-> pointer to partition to block distributor structure pointer
87 *----------------------------------------------------------------------------*/
88
89void
91
92/*----------------------------------------------------------------------------
93 * Transfer ownership of global entity numbers to a block distributor.
94 *
95 * The global_ent_num[] array should be the same as the one used
96 * for the creation of the block distributor.
97 *
98 * arguments:
99 * d <-- distributor helper
100 * global_ent_num <-> global entity numbers
101 *----------------------------------------------------------------------------*/
102
103void
105 cs_gnum_t global_ent_num[]);
106
107/*----------------------------------------------------------------------------
108 * Return number of entities associated with local partition
109 *
110 * arguments:
111 * d <-- distribtor helper
112 *
113 * returns:
114 * number of entities associated with distribution receive
115 *----------------------------------------------------------------------------*/
116
119
120/*----------------------------------------------------------------------------
121 * Copy array data from general domain partition to block distribution.
122 *
123 * arguments:
124 * d <-- partition to block distributor
125 * datatype <-- type of data considered
126 * stride <-- number of values per entity (interlaced)
127 * part_values <-- values in general domain partition
128 * block_values --> values in block distribution
129 *----------------------------------------------------------------------------*/
130
131void
133 cs_datatype_t datatype,
134 int stride,
135 const void *part_values,
136 void *block_values);
137
138/*----------------------------------------------------------------------------
139 * Copy local index from general domain partition to block distribution.
140 *
141 * This is useful for distribution of entity connectivity information.
142 *
143 * arguments:
144 * d <-- partition to block distributor
145 * part_index <-- local index in general partition distribution
146 * (size: n_part_entities + 1)
147 * block_index --> local index in block distribution
148 * (size: n_block_entities + 1)
149 *----------------------------------------------------------------------------*/
150
151void
153 const cs_lnum_t *part_index,
154 cs_lnum_t *block_index);
155
156/*----------------------------------------------------------------------------
157 * Copy indexed data from general domain partition to block distribution.
158 *
159 * This is useful for distribution of entity connectivity information.
160 *
161 * arguments:
162 * d <-- partition to block distributor
163 * datatype <-- type of data considered
164 * part_index <-- local index in general distribution
165 * part_val <-- numbers in general distribution
166 * (size: part_index[n_part_ents])
167 * block_index --> local index in block distribution
168 * block_val --> values in block distribution
169 * (size: block_index[n_block_ents])
170 *----------------------------------------------------------------------------*/
171
172void
174 cs_datatype_t datatype,
175 const cs_lnum_t *part_index,
176 const void *part_val,
177 const cs_lnum_t *block_index,
178 void *block_val);
179
180#endif /* defined(HAVE_MPI) */
181
182/*----------------------------------------------------------------------------*/
183
184#endif /* CS_PART_TO_BLOCK_H */
cs_datatype_t
Definition: cs_defs.h:290
unsigned cs_gnum_t
global mesh entity number
Definition: cs_defs.h:317
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
void cs_part_to_block_transfer_gnum(cs_part_to_block_t *d, cs_gnum_t global_ent_num[])
Definition: cs_part_to_block.cpp:619
void cs_part_to_block_copy_indexed(cs_part_to_block_t *d, cs_datatype_t datatype, const cs_lnum_t *part_index, const void *part_val, const cs_lnum_t *block_index, void *block_val)
Definition: cs_part_to_block.cpp:725
void cs_part_to_block_destroy(cs_part_to_block_t **d)
Definition: cs_part_to_block.cpp:587
cs_part_to_block_t * cs_part_to_block_create_by_gnum(MPI_Comm comm, cs_block_dist_info_t bi, cs_lnum_t n_ents, const cs_gnum_t global_ent_num[])
Definition: cs_part_to_block.cpp:549
void cs_part_to_block_copy_array(cs_part_to_block_t *d, cs_datatype_t datatype, int stride, const void *part_values, void *block_values)
Definition: cs_part_to_block.cpp:660
cs_lnum_t cs_part_to_block_get_n_part_ents(cs_part_to_block_t *d)
Definition: cs_part_to_block.cpp:638
void cs_part_to_block_copy_index(cs_part_to_block_t *d, const cs_lnum_t *part_index, cs_lnum_t *block_index)
Definition: cs_part_to_block.cpp:694
struct _cs_part_to_block_t cs_part_to_block_t
Definition: cs_part_to_block.h:53
Definition: cs_block_dist.h:46