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_vector.h> 22 #include <deal.II/lac/petsc_block_vector.h> 23 #include <deal.II/lac/trilinos_vector.h> 24 #include <deal.II/lac/trilinos_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(0, typeid(*this).name())
68 template <
typename number>
71 if (memory != 0) memory = 0;
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),
217 template <
typename number>
222 template <
typename number>
224 const unsigned int to_level,
228 Assert ((to_level >= 1) && (to_level<=prolongation_matrices.size()),
229 ExcIndexRange (to_level, 1, prolongation_matrices.size()+1));
231 prolongation_matrices[to_level-1]->block(mg_target_component[mg_selected_component],
232 mg_target_component[mg_selected_component])
238 template <
typename number>
240 const unsigned int from_level,
244 Assert ((from_level >= 1) && (from_level<=prolongation_matrices.size()),
245 ExcIndexRange (from_level, 1, prolongation_matrices.size()+1));
247 prolongation_matrices[from_level-1]->block(mg_target_component[mg_selected_component],
248 mg_target_component[mg_selected_component])
249 .Tvmult_add (dst, src);
255 template <
typename number>
263 template <
typename number>
272 template <
typename number>
282 template <
typename number>
288 template <
typename number>
294 Assert ((to_level >= 1) && (to_level<=prolongation_matrices.size()),
295 ExcIndexRange (to_level, 1, prolongation_matrices.size()+1));
297 prolongation_matrices[to_level-1]->block(selected_block,
303 template <
typename number>
309 Assert ((from_level >= 1) && (from_level<=prolongation_matrices.size()),
310 ExcIndexRange (from_level, 1, prolongation_matrices.size()+1));
312 prolongation_matrices[from_level-1]->block(selected_block,
314 .Tvmult_add (dst, src);
321 #include "multigrid.inst" 331 DEAL_II_NAMESPACE_CLOSE
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
std::vector< std_cxx11::shared_ptr< BlockSparseMatrix< double > > > prolongation_matrices
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_cxx11::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_cxx11::enable_if< std_cxx11::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
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 ~MGTransferSelect()
virtual ~MGTransferBlockSelect()
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::vector< std::vector< types::global_dof_index > > sizes
virtual void prolongate(const unsigned int to_level, Vector< number > &dst, const Vector< number > &src) const