17 #include <deal.II/lac/vector.h> 18 #include <deal.II/lac/la_vector.h> 19 #include <deal.II/lac/la_parallel_vector.h> 20 #include <deal.II/lac/la_parallel_block_vector.h> 21 #include <deal.II/lac/petsc_parallel_vector.h> 22 #include <deal.II/lac/petsc_parallel_block_vector.h> 23 #include <deal.II/lac/trilinos_vector.h> 24 #include <deal.II/lac/trilinos_parallel_block_vector.h> 25 #include <deal.II/lac/sparse_matrix.h> 26 #include <deal.II/lac/block_sparse_matrix.h> 27 #include <deal.II/multigrid/mg_transfer.h> 28 #include <deal.II/multigrid/mg_transfer_block.h> 29 #include <deal.II/multigrid/mg_transfer_component.h> 30 #include <deal.II/multigrid/mg_smoother.h> 31 #include <deal.II/multigrid/mg_transfer_block.templates.h> 32 #include <deal.II/multigrid/mg_transfer_component.templates.h> 33 #include <deal.II/multigrid/multigrid.templates.h> 35 DEAL_II_NAMESPACE_OPEN
48 mg_constrained_dofs(&mg_c)
57 mg_constrained_dofs(&mg_c)
61 template <
typename number>
64 memory(nullptr, typeid(*this).name())
68 template <
typename number>
71 if (memory !=
nullptr) memory =
nullptr;
75 template <
typename number>
85 template <
typename number>
87 const unsigned int to_level,
91 Assert ((to_level >= 1) && (to_level<=prolongation_matrices.size()),
101 for (
unsigned int b=0; b<this->mg_block.size(); ++b)
103 if (this->selected[b])
104 prolongation_matrices[to_level-1]->block(b,b).vmult (
105 dst.
block(this->mg_block[b]), src.
block(this->mg_block[b]));
110 template <
typename number>
112 const unsigned int from_level,
116 Assert ((from_level >= 1) && (from_level<=prolongation_matrices.size()),
117 ExcIndexRange (from_level, 1, prolongation_matrices.size()+1));
123 for (
unsigned int b=0; b<this->mg_block.size(); ++b)
125 if (this->selected[b])
127 if (factors.size() != 0)
132 prolongation_matrices[from_level-1]->block(b,b).Tvmult (
133 *aux, src.
block(this->mg_block[b]));
135 dst.
block(this->mg_block[b]).add(factors[b], *aux);
140 prolongation_matrices[from_level-1]->block(b,b).Tvmult_add (
141 dst.
block(this->mg_block[b]), src.
block(this->mg_block[b]));
152 std::size_t result =
sizeof(*this);
164 -
sizeof(prolongation_sparsities);
178 std::size_t result =
sizeof(*this);
179 result +=
sizeof(
unsigned int) *
sizes.size();
189 -
sizeof(prolongation_sparsities);
201 template <
typename number>
204 selected_component (0),
205 mg_selected_component (0)
209 template <
typename number>
212 selected_component (0),
213 mg_selected_component (0),
219 template <
typename number>
221 const unsigned int to_level,
225 Assert ((to_level >= 1) && (to_level<=prolongation_matrices.size()),
226 ExcIndexRange (to_level, 1, prolongation_matrices.size()+1));
228 prolongation_matrices[to_level-1]->block(mg_target_component[mg_selected_component],
229 mg_target_component[mg_selected_component])
235 template <
typename number>
237 const unsigned int from_level,
241 Assert ((from_level >= 1) && (from_level<=prolongation_matrices.size()),
242 ExcIndexRange (from_level, 1, prolongation_matrices.size()+1));
244 prolongation_matrices[from_level-1]->block(mg_target_component[mg_selected_component],
245 mg_target_component[mg_selected_component])
246 .Tvmult_add (dst, src);
252 template <
typename number>
260 template <
typename number>
269 template <
typename number>
279 template <
typename number>
285 Assert ((to_level >= 1) && (to_level<=prolongation_matrices.size()),
286 ExcIndexRange (to_level, 1, prolongation_matrices.size()+1));
288 prolongation_matrices[to_level-1]->block(selected_block,
294 template <
typename number>
300 Assert ((from_level >= 1) && (from_level<=prolongation_matrices.size()),
301 ExcIndexRange (from_level, 1, prolongation_matrices.size()+1));
303 prolongation_matrices[from_level-1]->block(selected_block,
305 .Tvmult_add (dst, src);
312 #include "multigrid.inst" 322 DEAL_II_NAMESPACE_CLOSE
std::vector< std::shared_ptr< BlockSparseMatrix< double > > > prolongation_matrices
std::size_t memory_consumption() const
virtual void prolongate(const unsigned int to_level, BlockVector< number > &dst, const BlockVector< number > &src) const
std::vector< unsigned int > target_component
static ::ExceptionBase & ExcNotInitialized()
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
virtual void restrict_and_add(const unsigned int from_level, BlockVector< number > &dst, const BlockVector< number > &src) const
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
std::vector< types::global_dof_index > component_start
virtual ~MGTransferBlock()
virtual void restrict_and_add(const unsigned int from_level, Vector< number > &dst, const Vector< number > &src) const
void initialize(const std::vector< number > &factors, VectorMemory< Vector< number > > &memory)
std::vector< unsigned int > mg_block
std::vector< unsigned int > mg_target_component
virtual void prolongate(const unsigned int to_level, Vector< number > &dst, const Vector< number > &src) const
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)
virtual void restrict_and_add(const unsigned int from_level, Vector< number > &dst, const Vector< number > &src) const
std::vector< std::vector< types::global_dof_index > > mg_component_start
BlockType & block(const unsigned int i)
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
virtual void prolongate(const unsigned int to_level, Vector< number > &dst, const Vector< number > &src) const