deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20: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: 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
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
95 void
98 const DoFHandler<dim> &dof_handler_coarse,
99 const AffineConstraints<Number> &constraint_fine =
101 const AffineConstraints<Number> &constraint_coarse =
103 const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
104 const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
105
109 void
110 interpolate(VectorType &dst, const VectorType &src) const override;
111
116 std::pair<bool, bool>
118 const std::shared_ptr<const Utilities::MPI::Partitioner>
120 const std::shared_ptr<const Utilities::MPI::Partitioner>
121 &partitioner_fine) override;
122
126 std::size_t
127 memory_consumption() const override;
128
132 std::pair<const DoFHandler<dim> *, unsigned int>
133 get_dof_handler_fine() const override;
134
142 {
146 unsigned int n_coarse_cells;
147
155
163
167 unsigned int degree_coarse;
168
175 unsigned int degree_fine;
176
182 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
184
195 bool use_constraint_crs = false;
196
202 Kokkos::View<unsigned int *, MemorySpace::Default::kokkos_space>
204
216 Kokkos::View<unsigned int *, MemorySpace::Default::kokkos_space>
218
224 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
226
230 Kokkos::View<unsigned int **, MemorySpace::Default::kokkos_space>
232
236 Kokkos::View<Number **, MemorySpace::Default::kokkos_space> weights;
237
246 };
247
254 {
255 using TeamHandle = Kokkos::TeamPolicy<
256 MemorySpace::Default::kokkos_space::execution_space>::member_type;
257
259 Kokkos::View<Number *,
260 MemorySpace::Default::kokkos_space::execution_space::
261 scratch_memory_space,
262 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
263
268
273
278
283
288 };
289
290 protected:
291 void
293 const VectorType &src) const override;
294
295 void
297 const VectorType &src) const override;
298
299 private:
303 std::vector<MGTransferScheme> schemes;
304
308 unsigned int n_components;
309
314
318 unsigned int mg_level_fine;
319
324 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
326
328 dim,
331
333 };
334
337} // namespace Portable
338
340
341#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