Reference documentation for deal.II version 9.5.0
\(\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// Copyright (C) 2023 by the deal.II authors
4//
5// This file is part of the deal.II library.
6//
7// The deal.II library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
9// Public License as published by the Free Software Foundation; either
10// version 2.1 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.md at
12// the top level directory of deal.II.
13//
14// ---------------------------------------------------------------------
15
16#ifndef dealii_petsc_communication_pattern_h
17#define dealii_petsc_communication_pattern_h
18
19#include <deal.II/base/config.h>
20
21#ifdef DEAL_II_WITH_PETSC
22
26
28
29# include <petscsf.h>
30
31# include <vector>
32
34
39namespace PETScWrappers
40{
50 {
51 public:
56
60 virtual ~CommunicationPattern() override;
61
62 virtual void
63 reinit(const IndexSet &locally_owned_indices,
64 const IndexSet &ghost_indices,
65 const MPI_Comm communicator) override;
66
80 void
81 reinit(const std::vector<types::global_dof_index> &indices_locally_owned,
82 const std::vector<types::global_dof_index> &indices_want,
83 const MPI_Comm communicator);
84
98 void
99 reinit(const types::global_dof_index local_size,
100 const IndexSet & ghost_indices,
101 const MPI_Comm communicator);
102
107 template <typename Number>
108 void
109 export_to_ghosted_array(const ArrayView<const Number> &locally_owned_array,
110 const ArrayView<Number> & ghost_array) const;
111
117 template <typename Number>
118 void
120 const ArrayView<const Number> &locally_owned_array,
121 const ArrayView<Number> & ghost_array) const;
122
128 template <typename Number>
129 void
131 const ArrayView<const Number> &locally_owned_array,
132 const ArrayView<Number> & ghost_array) const;
133
138 template <typename Number>
139 void
142 const ArrayView<const Number> &ghost_array,
143 const ArrayView<Number> & locally_owned_array) const;
144
151 template <typename Number>
152 void
155 const ArrayView<const Number> &ghost_array,
156 const ArrayView<Number> & locally_owned_array) const;
157
164 template <typename Number>
165 void
168 const ArrayView<const Number> &ghost_array,
169 const ArrayView<Number> & locally_owned_array) const;
170
175 get_mpi_communicator() const override;
176
180 operator const PetscSF &() const
181 {
182 return sf;
183 }
184
188 void
189 clear();
190
191 protected:
195 PetscSF sf;
196
200 void
201 do_reinit(const std::vector<PetscInt> &inidx,
202 const std::vector<PetscInt> &inloc,
203 const std::vector<PetscInt> &outidx,
204 const std::vector<PetscInt> &outloc,
205 const MPI_Comm communicator);
206 };
207
221 {
222 public:
226 Partitioner();
227
231 virtual ~Partitioner() override = default;
232
238 virtual void
239 reinit(const IndexSet &locally_owned_indices,
240 const IndexSet &ghost_indices,
241 const MPI_Comm communicator) override;
242
250 void
251 reinit(const IndexSet &locally_owned_indices,
252 const IndexSet &ghost_indices,
253 const IndexSet &larger_ghost_indices,
254 const MPI_Comm communicator);
255
259 unsigned int
261 {
263 }
264
268 const IndexSet &
270 {
271 return ghost_indices_data;
272 }
273
278 template <typename Number>
279 void
280 export_to_ghosted_array(const ArrayView<const Number> &locally_owned_array,
281 const ArrayView<Number> & ghost_array) const;
282
291 template <typename Number>
292 void
294 const ArrayView<const Number> &locally_owned_array,
295 const ArrayView<Number> & ghost_array) const;
296
305 template <typename Number>
306 void
308 const ArrayView<const Number> &locally_owned_array,
309 const ArrayView<Number> & ghost_array) const;
310
315 template <typename Number>
316 void
319 const ArrayView<const Number> &ghost_array,
320 const ArrayView<Number> & locally_owned_array) const;
321
331 template <typename Number>
332 void
335 const ArrayView<const Number> &ghost_array,
336 const ArrayView<Number> & locally_owned_array) const;
337
347 template <typename Number>
348 void
351 const ArrayView<const Number> &ghost_array,
352 const ArrayView<Number> & locally_owned_array) const;
353
358 get_mpi_communicator() const override;
359
360 protected:
365 };
366
367} // namespace PETScWrappers
368
372
373#endif
374
375#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
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
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
virtual void reinit(const IndexSet &locally_owned_indices, const IndexSet &ghost_indices, const MPI_Comm communicator) override
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:472
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473