29#include <deal.II/multigrid/mg_transfer_block.templates.h>
31#include <deal.II/multigrid/mg_transfer_component.templates.h>
32#include <deal.II/multigrid/multigrid.templates.h>
45 , mg_constrained_dofs(&mg_c)
50template <
typename number>
52 : memory(nullptr, typeid(*this).name())
56template <
typename number>
59 if (memory !=
nullptr)
64template <
typename number>
74template <
typename number>
80 Assert((to_level >= 1) && (to_level <= prolongation_matrices.size()),
81 ExcIndexRange(to_level, 1, prolongation_matrices.size() + 1));
88 if (this->mg_constrained_dofs !=
nullptr)
89 Assert(this->mg_constrained_dofs->get_user_constraint_matrix(to_level - 1)
98 for (
unsigned int b = 0; b < this->mg_block.size(); ++b)
100 if (this->selected[b])
101 prolongation_matrices[to_level - 1]->block(b, b).vmult(
102 dst.
block(this->mg_block[b]), src.
block(this->mg_block[b]));
107template <
typename number>
113 Assert((from_level >= 1) && (from_level <= prolongation_matrices.size()),
114 ExcIndexRange(from_level, 1, prolongation_matrices.size() + 1));
120 for (
unsigned int b = 0; b < this->mg_block.size(); ++b)
122 if (this->selected[b])
124 if (factors.size() != 0)
129 prolongation_matrices[from_level - 1]->block(b, b).Tvmult(
130 *aux, src.
block(this->mg_block[b]));
132 dst.
block(this->mg_block[b]).add(factors[b], *aux);
137 prolongation_matrices[from_level - 1]->block(b, b).Tvmult_add(
138 dst.
block(this->mg_block[b]), src.
block(this->mg_block[b]));
149 std::size_t result =
sizeof(*this);
174 std::size_t result =
sizeof(*this);
175 result +=
sizeof(
unsigned int) *
sizes.size();
195template <
typename number>
197 : selected_component(0)
198 , mg_selected_component(0)
202template <
typename number>
204 : selected_component(0)
205 , mg_selected_component(0)
211template <
typename number>
217 Assert((to_level >= 1) && (to_level <= prolongation_matrices.size()),
218 ExcIndexRange(to_level, 1, prolongation_matrices.size() + 1));
220 prolongation_matrices[to_level - 1]
221 ->block(mg_target_component[mg_selected_component],
222 mg_target_component[mg_selected_component])
228template <
typename number>
234 Assert((from_level >= 1) && (from_level <= prolongation_matrices.size()),
235 ExcIndexRange(from_level, 1, prolongation_matrices.size() + 1));
237 prolongation_matrices[from_level - 1]
238 ->block(mg_target_component[mg_selected_component],
239 mg_target_component[mg_selected_component])
240 .Tvmult_add(dst, src);
246template <
typename number>
253template <
typename number>
262template <
typename number>
268 Assert((to_level >= 1) && (to_level <= prolongation_matrices.size()),
269 ExcIndexRange(to_level, 1, prolongation_matrices.size() + 1));
272 if (this->mg_constrained_dofs !=
nullptr)
273 Assert(this->mg_constrained_dofs->get_user_constraint_matrix(to_level - 1)
279 prolongation_matrices[to_level - 1]
280 ->block(selected_block, selected_block)
285template <
typename number>
291 Assert((from_level >= 1) && (from_level <= prolongation_matrices.size()),
292 ExcIndexRange(from_level, 1, prolongation_matrices.size() + 1));
294 prolongation_matrices[from_level - 1]
295 ->block(selected_block, selected_block)
296 .Tvmult_add(dst, src);
303#include "multigrid.inst"
unsigned int n_blocks() const
BlockType & block(const unsigned int i)
std::vector< unsigned int > mg_block
std::vector< std::vector< types::global_dof_index > > sizes
std::vector< bool > selected
std::vector< types::global_dof_index > block_start
std::vector< std::shared_ptr< BlockSparseMatrix< double > > > prolongation_matrices
std::vector< std::shared_ptr< BlockSparsityPattern > > prolongation_sparsities
std::vector< std::vector< types::global_dof_index > > mg_block_start
std::size_t memory_consumption() const
virtual void prolongate(const unsigned int to_level, Vector< number > &dst, const Vector< number > &src) const override
virtual void restrict_and_add(const unsigned int from_level, Vector< number > &dst, const Vector< number > &src) const override
virtual void prolongate(const unsigned int to_level, BlockVector< number > &dst, const BlockVector< number > &src) const override
virtual void restrict_and_add(const unsigned int from_level, BlockVector< number > &dst, const BlockVector< number > &src) const override
virtual ~MGTransferBlock() override
void initialize(const std::vector< number > &factors, VectorMemory< Vector< number > > &memory)
std::vector< unsigned int > mg_target_component
ComponentMask component_mask
std::vector< unsigned int > target_component
std::vector< types::global_dof_index > component_start
std::vector< std::shared_ptr< BlockSparseMatrix< double > > > prolongation_matrices
std::vector< std::vector< types::global_dof_index > > mg_component_start
std::vector< std::shared_ptr< BlockSparsityPattern > > prolongation_sparsities
std::vector< std::vector< types::global_dof_index > > sizes
std::size_t memory_consumption() const
virtual void prolongate(const unsigned int to_level, Vector< number > &dst, const Vector< number > &src) const override
virtual void restrict_and_add(const unsigned int from_level, Vector< number > &dst, const Vector< number > &src) const override
virtual void reinit(const size_type N, const bool omit_zeroing_entries=false)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcIndexRange(std::size_t arg1, std::size_t arg2, std::size_t arg3)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcNotInitialized()
std::enable_if_t< std::is_fundamental_v< T >, std::size_t > memory_consumption(const T &t)