deal.II version GIT relicensing-2225-g361923b506 2024-12-06 21: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
petsc_communication_pattern.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 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_petsc_communication_pattern_h
16#define dealii_petsc_communication_pattern_h
17
18#include <deal.II/base/config.h>
19
20#ifdef DEAL_II_WITH_PETSC
21
25
27
28# include <petscsf.h>
29
30# include <vector>
31
33
38namespace PETScWrappers
39{
49 {
50 public:
55
59 virtual ~CommunicationPattern() override;
60
61 virtual void
62 reinit(const IndexSet &locally_owned_indices,
63 const IndexSet &ghost_indices,
64 const MPI_Comm communicator) override;
65
79 void
80 reinit(const std::vector<types::global_dof_index> &indices_locally_owned,
81 const std::vector<types::global_dof_index> &indices_want,
82 const MPI_Comm communicator);
83
97 void
98 reinit(const types::global_dof_index local_size,
99 const IndexSet &ghost_indices,
100 const MPI_Comm communicator);
101
106 template <typename Number>
107 void
108 export_to_ghosted_array(const ArrayView<const Number> &locally_owned_array,
109 const ArrayView<Number> &ghost_array) const;
110
116 template <typename Number>
117 void
119 const ArrayView<const Number> &locally_owned_array,
120 const ArrayView<Number> &ghost_array) const;
121
127 template <typename Number>
128 void
130 const ArrayView<const Number> &locally_owned_array,
131 const ArrayView<Number> &ghost_array) const;
132
137 template <typename Number>
138 void
141 const ArrayView<const Number> &ghost_array,
142 const ArrayView<Number> &locally_owned_array) const;
143
150 template <typename Number>
151 void
154 const ArrayView<const Number> &ghost_array,
155 const ArrayView<Number> &locally_owned_array) const;
156
163 template <typename Number>
164 void
167 const ArrayView<const Number> &ghost_array,
168 const ArrayView<Number> &locally_owned_array) const;
169
174 get_mpi_communicator() const override;
175
179 operator const PetscSF &() const
180 {
181 return sf;
182 }
183
187 void
188 clear();
189
190 protected:
194 PetscSF sf;
195
199 void
200 do_reinit(const std::vector<PetscInt> &inidx,
201 const std::vector<PetscInt> &inloc,
202 const std::vector<PetscInt> &outidx,
203 const std::vector<PetscInt> &outloc,
204 const MPI_Comm communicator);
205 };
206
220 {
221 public:
226
230 virtual ~Partitioner() override = default;
231
237 virtual void
238 reinit(const IndexSet &locally_owned_indices,
239 const IndexSet &ghost_indices,
240 const MPI_Comm communicator) override;
241
249 void
250 reinit(const IndexSet &locally_owned_indices,
251 const IndexSet &ghost_indices,
252 const IndexSet &larger_ghost_indices,
253 const MPI_Comm communicator);
254
258 unsigned int
260 {
262 }
263
267 const IndexSet &
269 {
270 return ghost_indices_data;
271 }
272
277 template <typename Number>
278 void
280 const ArrayView<Number> &ghost_array) const;
281
290 template <typename Number>
291 void
293 const ArrayView<const Number> &locally_owned_array,
294 const ArrayView<Number> &ghost_array) const;
295
304 template <typename Number>
305 void
307 const ArrayView<const Number> &locally_owned_array,
308 const ArrayView<Number> &ghost_array) const;
309
314 template <typename Number>
315 void
318 const ArrayView<const Number> &ghost_array,
319 const ArrayView<Number> &locally_owned_array) const;
320
330 template <typename Number>
331 void
334 const ArrayView<const Number> &ghost_array,
335 const ArrayView<Number> &locally_owned_array) const;
336
346 template <typename Number>
347 void
350 const ArrayView<const Number> &ghost_array,
351 const ArrayView<Number> &locally_owned_array) const;
352
357 get_mpi_communicator() const override;
358
359 protected:
364 };
365
366} // namespace PETScWrappers
367
371
372#endif
373
374#endif
void import_from_ghosted_array(const VectorOperation::values op, const ArrayView< const Number > &ghost_array, const ArrayView< Number > &locally_owned_array) const
void export_to_ghosted_array_start(const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &ghost_array) const
void export_to_ghosted_array(const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &ghost_array) const
void export_to_ghosted_array_finish(const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &ghost_array) const
void import_from_ghosted_array_finish(const VectorOperation::values op, const ArrayView< const Number > &ghost_array, const ArrayView< Number > &locally_owned_array) const
void do_reinit(const std::vector< PetscInt > &inidx, const std::vector< PetscInt > &inloc, const std::vector< PetscInt > &outidx, const std::vector< PetscInt > &outloc, const MPI_Comm communicator)
virtual void reinit(const IndexSet &locally_owned_indices, const IndexSet &ghost_indices, const MPI_Comm communicator) override
void import_from_ghosted_array_start(const VectorOperation::values op, const ArrayView< const Number > &ghost_array, const ArrayView< Number > &locally_owned_array) const
types::global_dof_index n_ghost_indices_data
virtual void reinit(const IndexSet &locally_owned_indices, const IndexSet &ghost_indices, const MPI_Comm communicator) override
void import_from_ghosted_array(const VectorOperation::values op, const ArrayView< const Number > &ghost_array, const ArrayView< Number > &locally_owned_array) const
void export_to_ghosted_array_finish(const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &ghost_array) const
MPI_Comm get_mpi_communicator() const override
void reinit(const IndexSet &locally_owned_indices, const IndexSet &ghost_indices, const IndexSet &larger_ghost_indices, const MPI_Comm communicator)
virtual ~Partitioner() override=default
void export_to_ghosted_array(const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &ghost_array) const
void export_to_ghosted_array_start(const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &ghost_array) const
void import_from_ghosted_array_start(const VectorOperation::values op, const ArrayView< const Number > &ghost_array, const ArrayView< Number > &locally_owned_array) const
void import_from_ghosted_array_finish(const VectorOperation::values op, const ArrayView< const Number > &ghost_array, const ArrayView< Number > &locally_owned_array) const
types::global_dof_index n_ghost_indices_larger
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499