17 #include <deal.II/lac/block_sparse_matrix.h> 18 #include <deal.II/lac/la_parallel_block_vector.h> 19 #include <deal.II/lac/la_parallel_vector.h> 20 #include <deal.II/lac/la_vector.h> 21 #include <deal.II/lac/petsc_block_vector.h> 22 #include <deal.II/lac/petsc_vector.h> 23 #include <deal.II/lac/sparse_matrix.h> 24 #include <deal.II/lac/trilinos_parallel_block_vector.h> 25 #include <deal.II/lac/trilinos_vector.h> 26 #include <deal.II/lac/vector.h> 28 #include <deal.II/multigrid/mg_smoother.h> 29 #include <deal.II/multigrid/mg_transfer.h> 30 #include <deal.II/multigrid/mg_transfer_block.h> 31 #include <deal.II/multigrid/mg_transfer_block.templates.h> 32 #include <deal.II/multigrid/mg_transfer_component.h> 33 #include <deal.II/multigrid/mg_transfer_component.templates.h> 34 #include <deal.II/multigrid/multigrid.templates.h> 36 DEAL_II_NAMESPACE_OPEN
47 , mg_constrained_dofs(&mg_c)
56 , mg_constrained_dofs(&mg_c)
60 template <
typename number>
62 : memory(nullptr, typeid(*this).name())
66 template <
typename number>
69 if (memory !=
nullptr)
74 template <
typename number>
84 template <
typename number>
90 Assert((to_level >= 1) && (to_level <= prolongation_matrices.size()),
91 ExcIndexRange(to_level, 1, prolongation_matrices.size() + 1));
100 for (
unsigned int b = 0; b < this->mg_block.size(); ++b)
102 if (this->selected[b])
103 prolongation_matrices[to_level - 1]->block(b, b).vmult(
104 dst.
block(this->mg_block[b]), src.
block(this->mg_block[b]));
109 template <
typename number>
115 Assert((from_level >= 1) && (from_level <= prolongation_matrices.size()),
116 ExcIndexRange(from_level, 1, prolongation_matrices.size() + 1));
122 for (
unsigned int b = 0; b < this->mg_block.size(); ++b)
124 if (this->selected[b])
126 if (factors.size() != 0)
131 prolongation_matrices[from_level - 1]->block(b, b).Tvmult(
132 *aux, src.
block(this->mg_block[b]));
134 dst.
block(this->mg_block[b]).add(factors[b], *aux);
139 prolongation_matrices[from_level - 1]->block(b, b).Tvmult_add(
140 dst.
block(this->mg_block[b]), src.
block(this->mg_block[b]));
151 std::size_t result =
sizeof(*this);
162 sizeof(prolongation_sparsities);
176 std::size_t result =
sizeof(*this);
177 result +=
sizeof(
unsigned int) *
sizes.size();
185 sizeof(prolongation_sparsities);
197 template <
typename number>
199 : selected_component(0)
200 , mg_selected_component(0)
204 template <
typename number>
206 : selected_component(0)
207 , mg_selected_component(0)
213 template <
typename number>
219 Assert((to_level >= 1) && (to_level <= prolongation_matrices.size()),
220 ExcIndexRange(to_level, 1, prolongation_matrices.size() + 1));
222 prolongation_matrices[to_level - 1]
223 ->block(mg_target_component[mg_selected_component],
224 mg_target_component[mg_selected_component])
230 template <
typename number>
236 Assert((from_level >= 1) && (from_level <= prolongation_matrices.size()),
237 ExcIndexRange(from_level, 1, prolongation_matrices.size() + 1));
239 prolongation_matrices[from_level - 1]
240 ->block(mg_target_component[mg_selected_component],
241 mg_target_component[mg_selected_component])
242 .Tvmult_add(dst, src);
248 template <
typename number>
255 template <
typename number>
264 template <
typename number>
274 template <
typename number>
280 Assert((to_level >= 1) && (to_level <= prolongation_matrices.size()),
281 ExcIndexRange(to_level, 1, prolongation_matrices.size() + 1));
283 prolongation_matrices[to_level - 1]
284 ->block(selected_block, selected_block)
289 template <
typename number>
295 Assert((from_level >= 1) && (from_level <= prolongation_matrices.size()),
296 ExcIndexRange(from_level, 1, prolongation_matrices.size() + 1));
298 prolongation_matrices[from_level - 1]
299 ->block(selected_block, selected_block)
300 .Tvmult_add(dst, src);
307 #include "multigrid.inst" 317 DEAL_II_NAMESPACE_CLOSE
std::vector< std::shared_ptr< BlockSparseMatrix< double > > > prolongation_matrices
std::size_t memory_consumption() const
virtual ~MGTransferBlock() override
std::vector< unsigned int > target_component
static ::ExceptionBase & ExcNotInitialized()
virtual void prolongate(const unsigned int to_level, Vector< number > &dst, const Vector< number > &src) const override
std::vector< types::global_dof_index > block_start
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
std::vector< std::vector< types::global_dof_index > > sizes
std::vector< std::shared_ptr< BlockSparseMatrix< double > > > prolongation_matrices
#define Assert(cond, exc)
std::size_t memory_consumption() const
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
std::vector< types::global_dof_index > component_start
virtual void restrict_and_add(const unsigned int from_level, Vector< number > &dst, const Vector< number > &src) const override
virtual void restrict_and_add(const unsigned int from_level, BlockVector< number > &dst, const BlockVector< 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, Vector< number > &dst, const Vector< number > &src) const override
std::vector< unsigned int > mg_block
std::vector< unsigned int > mg_target_component
std::vector< std::vector< types::global_dof_index > > mg_block_start
unsigned int n_blocks() const
ComponentMask component_mask
virtual void reinit(const size_type N, const bool omit_zeroing_entries=false)
std::vector< std::vector< types::global_dof_index > > mg_component_start
BlockType & block(const unsigned int i)
virtual void prolongate(const unsigned int to_level, BlockVector< number > &dst, const BlockVector< number > &src) const override
void initialize(const std::vector< number > &factors, VectorMemory< Vector< number >> &memory)
std::vector< bool > selected
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
std::vector< std::vector< types::global_dof_index > > sizes