47template <
typename VectorType>
56template <
typename VectorType>
66template <
typename VectorType>
78template <
typename VectorType>
82 const VectorType &src)
const
92 VectorType copy_src(src);
94 .distribute(copy_src);
105template <
typename VectorType>
109 const VectorType &src)
const
126 const unsigned int level,
127 std::vector<types::global_dof_index> &dof_indices)
129 if (mg_constrained_dofs !=
nullptr &&
131 for (
auto &ind : dof_indices)
147template <
typename VectorType>
148template <
int dim,
int spacedim>
155 "The underlying DoFHandler object has not had its "
156 "distribute_mg_dofs() function called, but this is a prerequisite "
157 "for multigrid transfers. You will need to call this function, "
158 "probably close to where you already call distribute_dofs()."));
160 const unsigned int n_levels =
164 this->
sizes.resize(n_levels);
165 for (
unsigned int l = 0; l < n_levels; ++l)
183 for (
unsigned int i = 0; i < n_levels - 1; ++i)
194 std::vector<types::global_dof_index> dof_indices_parent(dofs_per_cell);
195 std::vector<types::global_dof_index> dof_indices_child(dofs_per_cell);
196 std::vector<types::global_dof_index> entries(dofs_per_cell);
203 for (
unsigned int level = 0; level < n_levels - 1; ++level)
212 const IndexSet level_p1_relevant_dofs =
216 level_p1_relevant_dofs);
218 if (cell->has_children() && cell->is_locally_owned_on_level())
220 cell->get_mg_dof_indices(dof_indices_parent);
222 replace(this->mg_constrained_dofs, level, dof_indices_parent);
224 Assert(cell->n_children() ==
227 for (
unsigned int child = 0; child < cell->n_children(); ++child)
232 child, cell->refinement_case());
236 cell->child(child)->get_mg_dof_indices(dof_indices_child);
238 replace(this->mg_constrained_dofs,
245 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
248 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
249 if (prolongation(i, j) != 0)
250 entries.push_back(dof_indices_parent[j]);
258#ifdef DEAL_II_WITH_MPI
260 VectorType>::requires_distributed_sparsity_pattern)
295 if (cell->has_children() && cell->is_locally_owned_on_level())
297 cell->get_mg_dof_indices(dof_indices_parent);
299 replace(this->mg_constrained_dofs, level, dof_indices_parent);
301 Assert(cell->n_children() ==
304 for (
unsigned int child = 0; child < cell->n_children(); ++child)
308 child, cell->refinement_case());
310 if (this->mg_constrained_dofs !=
nullptr &&
312 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
314 level, dof_indices_parent[j]))
315 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
316 prolongation(i, j) = 0.;
318 cell->child(child)->get_mg_dof_indices(dof_indices_child);
320 replace(this->mg_constrained_dofs,
325 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
328 dof_indices_parent.data(),
341template <
typename VectorType>
347 os <<
"Level " << level << std::endl;
355template <
typename VectorType>
369#include "multigrid/mg_transfer_prebuilt.inst"
const std::vector< std::pair< size_type, number > > * get_constraint_entries(const size_type line_n) const
bool is_identity_constrained(const size_type line_n) const
size_type n_constraints() const
const FiniteElement< dim, spacedim > & get_fe(const types::fe_index index=0) const
const IndexSet & locally_owned_mg_dofs(const unsigned int level) const
const Triangulation< dim, spacedim > & get_triangulation() const
types::global_dof_index n_dofs() const
MPI_Comm get_mpi_communicator() const
bool has_level_dofs() const
void add_entries(const size_type row, ForwardIterator begin, ForwardIterator end, const bool indices_are_unique_and_sorted=false)
const IndexSet & row_index_set() const
void reinit(const size_type m, const size_type n, const IndexSet &rowset=IndexSet())
unsigned int n_dofs_per_cell() const
virtual const FullMatrix< double > & get_prolongation_matrix(const unsigned int child, const RefinementCase< dim > &refinement_case=RefinementCase< dim >::isotropic_refinement) const
bool is_boundary_index(const unsigned int level, const types::global_dof_index index) const
bool have_boundary_indices() const
const AffineConstraints< double > & get_level_constraints(const unsigned int level) const
std::size_t memory_consumption() const
ObserverPointer< const MGConstrainedDoFs > mg_constrained_dofs
void fill_and_communicate_copy_indices(const DoFHandler< dim, spacedim > &dof_handler)
std::vector< types::global_dof_index > sizes
std::vector< std::vector< bool > > interface_dofs
virtual void restrict_and_add(const unsigned int from_level, VectorType &dst, const VectorType &src) const override
void build(const DoFHandler< dim, spacedim > &dof_handler)
std::vector< std::shared_ptr< typename internal::MatrixSelector< VectorType >::Sparsity > > prolongation_sparsities
std::size_t memory_consumption() const
MGTransferPrebuilt()=default
virtual void prolongate(const unsigned int to_level, VectorType &dst, const VectorType &src) const override
std::vector< std::shared_ptr< typename internal::MatrixSelector< VectorType >::Matrix > > prolongation_matrices
void print_matrices(std::ostream &os) const
void initialize_constraints(const MGConstrainedDoFs &mg_constrained_dofs)
virtual unsigned int n_global_levels() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
IteratorRange< cell_iterator > cell_iterators_on_level(const unsigned int level) const
static ::ExceptionBase & ExcNoProlongation()
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcIndexRange(std::size_t arg1, std::size_t arg2, std::size_t arg3)
static ::ExceptionBase & ExcMessage(std::string arg1)
static constexpr unsigned int max_children_per_cell
static void reinit(Matrix &matrix, Sparsity &sparsity, int level, const SparsityPatternType &sp, const DoFHandler< dim, spacedim > &)
::SparseMatrix< typename VectorType::value_type > Matrix
::SparsityPattern Sparsity