deal.II version GIT relicensing-2848-g5241f990fb 2025-03-16 19:30:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
mpi_noncontiguous_partitioner.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2020 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_mpi_noncontiguous_partitioner_h
16#define dealii_mpi_noncontiguous_partitioner_h
17
18#include <deal.II/base/config.h>
19
23#include <deal.II/base/types.h>
24
26
27
29
30namespace Utilities
31{
32 namespace MPI
33 {
49 {
50 public:
56
62 NoncontiguousPartitioner(const IndexSet &indexset_locally_owned,
63 const IndexSet &indexset_ghost,
65
76 const std::vector<types::global_dof_index> &indices_locally_owned,
77 const std::vector<types::global_dof_index> &indices_ghost,
79
104 template <typename Number, unsigned int n_components_templated = 1>
105 void
107 const ArrayView<const Number> &locally_owned_array,
108 const ArrayView<Number> &ghost_array,
109 const unsigned int n_components = 0) const;
110
125 template <typename Number, unsigned int n_components_templated = 1>
126 void
128 const unsigned int communication_channel,
129 const ArrayView<const Number> &locally_owned_array,
130 const ArrayView<Number> &temporary_storage,
131 const ArrayView<Number> &ghost_array,
132 std::vector<MPI_Request> &requests,
133 const unsigned int n_components = 0) const;
134
151 template <typename Number, unsigned int n_components_templated = 1>
152 void
154 const unsigned int communication_channel,
155 const ArrayView<const Number> &locally_owned_array,
156 const ArrayView<Number> &temporary_storage,
157 std::vector<MPI_Request> &requests,
158 const unsigned int n_components = 0) const;
159
174 template <typename Number, unsigned int n_components_templated = 1>
175 void
177 const ArrayView<const Number> &temporary_storage,
178 const ArrayView<Number> &ghost_array,
179 std::vector<MPI_Request> &requests,
180 const unsigned int n_components = 0) const;
181
190 template <typename Number>
191 void
193 const VectorOperation::values vector_operation,
194 const ArrayView<Number> &ghost_array,
195 const ArrayView<Number> &locally_owned_storage) const;
196
203 template <typename Number>
204 void
206 const unsigned int communication_channel,
207 const ArrayView<Number> &ghost_array,
208 const ArrayView<Number> &temporary_storage,
209 const ArrayView<Number> &locally_owned_storage,
210 std::vector<MPI_Request> &requests) const;
211
216 template <typename Number>
217 void
219 const VectorOperation::values vector_operation,
220 const unsigned int communication_channel,
221 const ArrayView<Number> &ghost_array,
222 const ArrayView<Number> &temporary_storage,
223 std::vector<MPI_Request> &requests) const;
224
231 template <typename Number>
232 void
234 const VectorOperation::values vector_operation,
235 const ArrayView<const Number> &temporary_storage,
236 const ArrayView<Number> &locally_owned_storage,
237 std::vector<MPI_Request> &requests) const;
238
243 std::pair<unsigned int, unsigned int>
244 n_targets() const;
245
251 unsigned int
253
259
264 get_mpi_communicator() const override;
265
266 void
267 reinit(const IndexSet &locally_owned_indices,
268 const IndexSet &ghost_indices,
269 const MPI_Comm communicator) override;
270
276 void
277 reinit(const std::vector<types::global_dof_index> &locally_owned_indices,
278 const std::vector<types::global_dof_index> &ghost_indices,
279 const MPI_Comm communicator);
280
281 private:
286
290 std::vector<unsigned int> send_ranks;
291
297 std::vector<types::global_dof_index> send_ptr;
298
305 std::vector<types::global_dof_index> send_indices;
306
310 std::vector<unsigned int> recv_ranks;
311
317 std::vector<types::global_dof_index> recv_ptr;
318
325 std::vector<types::global_dof_index> recv_indices;
326
336 mutable std::vector<std::uint8_t> buffers;
337
343 mutable std::vector<MPI_Request> requests;
344 };
345
346 } // namespace MPI
347} // namespace Utilities
348
350
351#endif
void reinit(const IndexSet &locally_owned_indices, const IndexSet &ghost_indices, const MPI_Comm communicator) override
void export_to_ghosted_array_start(const unsigned int communication_channel, const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &temporary_storage, std::vector< MPI_Request > &requests, const unsigned int n_components=0) const
void export_to_ghosted_array(const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &ghost_array, const unsigned int n_components=0) const
void import_from_ghosted_array(const VectorOperation::values vector_operation, const ArrayView< Number > &ghost_array, const ArrayView< Number > &locally_owned_storage) const
void import_from_ghosted_array_start(const VectorOperation::values vector_operation, const unsigned int communication_channel, const ArrayView< Number > &ghost_array, const ArrayView< Number > &temporary_storage, std::vector< MPI_Request > &requests) const
std::vector< types::global_dof_index > recv_ptr
std::vector< types::global_dof_index > send_ptr
void import_from_ghosted_array_finish(const VectorOperation::values vector_operation, const ArrayView< const Number > &temporary_storage, const ArrayView< Number > &locally_owned_storage, std::vector< MPI_Request > &requests) const
void export_to_ghosted_array(const unsigned int communication_channel, const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &temporary_storage, const ArrayView< Number > &ghost_array, std::vector< MPI_Request > &requests, const unsigned int n_components=0) const
std::vector< types::global_dof_index > recv_indices
std::pair< unsigned int, unsigned int > n_targets() const
std::vector< types::global_dof_index > send_indices
void export_to_ghosted_array_finish(const ArrayView< const Number > &temporary_storage, const ArrayView< Number > &ghost_array, std::vector< MPI_Request > &requests, const unsigned int n_components=0) const
void import_from_ghosted_array(const VectorOperation::values vector_operation, const unsigned int communication_channel, const ArrayView< Number > &ghost_array, const ArrayView< Number > &temporary_storage, const ArrayView< Number > &locally_owned_storage, std::vector< MPI_Request > &requests) const
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:40
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:41