deal.II version 9.8.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
portable_mg_transfer_global_coarsening.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2026 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_portable_mg_transfer_global_coarsening_h
16#define dealii_portable_mg_transfer_global_coarsening_h
17
20
22
25
29
32
34
35namespace Portable
36{
37
38 // Forward declarations
39#ifndef DOXYGEN
40 namespace internal
41 {
42 template <typename Number>
43 struct MGTransferSharedData;
44
45 } // namespace internal
46
47#endif
48
53
69 template <int dim, typename VectorType>
71 : public ::internal::MGTwoLevelTransferCore<dim, VectorType>
72 {
73 public:
74 static_assert(
75 std::is_same_v<
76 VectorType,
77 LinearAlgebra::distributed::Vector<typename VectorType::value_type,
79 "This class is currently only implemented for vectors of "
80 "type LinearAlgebra::distributed::Vector.");
81
85 using Number = typename VectorType::value_type;
86
92 void
95 const DoFHandler<dim> &dof_handler_coarse,
96 const AffineConstraints<Number> &constraint_fine =
98 const AffineConstraints<Number> &constraint_coarse =
100 const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
101 const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
102
106 void
107 interpolate(VectorType &dst, const VectorType &src) const override;
108
113 std::pair<bool, bool>
115 const std::shared_ptr<const Utilities::MPI::Partitioner>
117 const std::shared_ptr<const Utilities::MPI::Partitioner>
118 &partitioner_fine) override;
119
123 std::size_t
124 memory_consumption() const override;
125
129 std::pair<const DoFHandler<dim> *, unsigned int>
130 get_dof_handler_fine() const override;
131
139 {
143 unsigned int n_coarse_cells;
144
152
160
164 unsigned int degree_coarse;
165
172 unsigned int degree_fine;
173
178 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
180
184 Kokkos::View<unsigned int **, MemorySpace::Default::kokkos_space>
186
190 Kokkos::View<unsigned int **, MemorySpace::Default::kokkos_space>
192
196 Kokkos::View<Number **, MemorySpace::Default::kokkos_space> weights;
197 };
198
205 {
206 using TeamHandle = Kokkos::TeamPolicy<
207 MemorySpace::Default::kokkos_space::execution_space>::member_type;
208
210 Kokkos::View<Number *,
211 MemorySpace::Default::kokkos_space::execution_space::
212 scratch_memory_space,
213 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
214
219
224
229
234
239 };
240
241 protected:
242 void
244 const VectorType &src) const override;
245
246 void
248 const VectorType &src) const override;
249
250 private:
254 std::vector<MGTransferScheme> schemes;
255
259 unsigned int n_components;
260
265
269 unsigned int mg_level_fine;
270
272 dim,
275
277 };
278
280
281} // namespace Portable
282
284
285#endif
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner_fine
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner_coarse
::MGTwoLevelTransfer< dim, LinearAlgebra::distributed::Vector< Number, MemorySpace::Host > > transfer_cpu
void prolongate_and_add_internal(VectorType &dst, const VectorType &src) const override
std::pair< bool, bool > enable_inplace_operations_if_possible(const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_coarse, const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_fine) override
std::pair< const DoFHandler< dim > *, unsigned int > get_dof_handler_fine() const override
void interpolate(VectorType &dst, const VectorType &src) const override
ObserverPointer< const DoFHandler< dim > > dof_handler_fine
void reinit_geometric_transfer(const DoFHandler< dim > &dof_handler_fine, const DoFHandler< dim > &dof_handler_coarse, const AffineConstraints< Number > &constraint_fine=AffineConstraints< Number >(), const AffineConstraints< Number > &constraint_coarse=AffineConstraints< Number >(), const unsigned int mg_level_fine=numbers::invalid_unsigned_int, const unsigned int mg_level_coarse=numbers::invalid_unsigned_int)
void restrict_and_add_internal(VectorType &dst, const VectorType &src) const override
std::size_t memory_consumption() const override
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
constexpr unsigned int invalid_unsigned_int
Definition types.h:236
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > prolongation_matrix
Kokkos::View< unsigned int **, MemorySpace::Default::kokkos_space > dof_indices_fine
Kokkos::View< unsigned int **, MemorySpace::Default::kokkos_space > dof_indices_coarse
Kokkos::View< Number **, MemorySpace::Default::kokkos_space > weights
Kokkos::TeamPolicy< MemorySpace::Default::kokkos_space::execution_space >::member_type TeamHandle
Kokkos::View< Number *, MemorySpace::Default::kokkos_space::execution_space:: scratch_memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > SharedViewScratchPad