deal.II version GIT relicensing-6960-g70e9c5b7be 2026-10-22 20:10:01+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
portable_mg_transfer_global_coarsening.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR 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// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_portable_mg_transfer_global_coarsening_h
14#define dealii_portable_mg_transfer_global_coarsening_h
15
18
20
23
27
30
32
33namespace Portable
34{
35
36 // Forward declarations
37#ifndef DOXYGEN
38 namespace internal
39 {
40 template <typename Number>
41 struct MGTransferSharedData;
42
43 } // namespace internal
44
45#endif
46
67 template <int dim, typename VectorType>
69 : public ::internal::MGTwoLevelTransferCore<dim, VectorType>
70 {
71 public:
72 static_assert(
73 std::is_same_v<
74 VectorType,
75 LinearAlgebra::distributed::Vector<typename VectorType::value_type,
77 "This class is currently only implemented for vectors of "
78 "type LinearAlgebra::distributed::Vector.");
79
83 using Number = typename VectorType::value_type;
84
93 void
96 const DoFHandler<dim> &dof_handler_coarse,
97 const AffineConstraints<Number> &constraint_fine =
99 const AffineConstraints<Number> &constraint_coarse =
101 const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
102 const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
103
107 void
108 interpolate(VectorType &dst, const VectorType &src) const override;
109
114 std::pair<bool, bool>
116 const std::shared_ptr<const Utilities::MPI::Partitioner>
118 const std::shared_ptr<const Utilities::MPI::Partitioner>
119 &partitioner_fine) override;
120
124 std::size_t
125 memory_consumption() const override;
126
130 std::pair<const DoFHandler<dim> *, unsigned int>
131 get_dof_handler_fine() const override;
132
140 {
144 unsigned int n_coarse_cells;
145
153
161
165 unsigned int degree_coarse;
166
173 unsigned int degree_fine;
174
180 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
182
193 bool use_constraint_crs = false;
194
200 Kokkos::View<unsigned int *, MemorySpace::Default::kokkos_space>
202
214 Kokkos::View<unsigned int *, MemorySpace::Default::kokkos_space>
216
222 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
224
228 Kokkos::View<unsigned int **, MemorySpace::Default::kokkos_space>
230
234 Kokkos::View<Number **, MemorySpace::Default::kokkos_space> weights;
235
244 };
245
252 {
253 using TeamHandle = Kokkos::TeamPolicy<
254 MemorySpace::Default::kokkos_space::execution_space>::member_type;
255
257 Kokkos::View<Number *,
258 MemorySpace::Default::kokkos_space::execution_space::
259 scratch_memory_space,
260 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
261
266
271
276
281
286 };
287
288 protected:
289 void
291 const VectorType &src) const override;
292
293 void
295 const VectorType &src) const override;
296
297 private:
301 std::vector<MGTransferScheme> schemes;
302
306 unsigned int n_components;
307
312
316 unsigned int mg_level_fine;
317
322 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
324
326 dim,
329
331 };
332
335} // namespace Portable
336
338
339#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
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > hanging_node_constraint_weights
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:228
::Kokkos::DefaultExecutionSpace::memory_space kokkos_space
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > prolongation_matrix
Kokkos::View< unsigned int **, MemorySpace::Default::kokkos_space > dof_indices_fine
Kokkos::View<::internal::MatrixFreeFunctions::ConstraintKinds *, MemorySpace::Default::kokkos_space > hanging_node_masks
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > coarse_constraint_weights
Kokkos::View< unsigned int *, MemorySpace::Default::kokkos_space > coarse_constraint_indices
Kokkos::View< unsigned int *, MemorySpace::Default::kokkos_space > coarse_constraint_offsets
Kokkos::View< Number **, MemorySpace::Default::kokkos_space > weights
Kokkos::View< Number *, MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > SharedViewScratchPad
Kokkos::TeamPolicy< MemorySpace::Default::kokkos_space::execution_space >::member_type TeamHandle