16#ifndef dealii_mg_transfer_global_coarsening_h
17#define dealii_mg_transfer_global_coarsening_h
34 class MGTwoLevelTransferImplementation;
77 const unsigned int degree,
85 std::vector<unsigned int>
87 const unsigned int max_degree,
98 template <
int dim,
int spacedim>
99 std::vector<std::shared_ptr<const Triangulation<dim, spacedim>>>
110template <
int dim,
typename VectorType>
142template <
int dim,
typename Number>
180 const unsigned int fe_degree_coarse);
214 struct MGTransferScheme
364 friend class internal::MGTwoLevelTransferImplementation;
379template <
int dim,
typename VectorType>
386 using Number =
typename VectorType::value_type;
397 const std::function<
void(
const unsigned int, VectorType &)>
406 const VectorType & src)
const override;
414 const VectorType & src)
const override;
422 template <
class InVector,
int spacedim>
426 const InVector & src)
const;
434 template <
class OutVector,
int spacedim>
454 template <
class InVector,
int spacedim>
458 const InVector & src)
const;
469 const std::function<void(
const unsigned int, VectorType &)>
481template <
int dim,
typename VectorType>
484 const std::function<
void(
const unsigned int, VectorType &)>
485 &initialize_dof_vector)
487 , initialize_dof_vector(initialize_dof_vector)
492template <
int dim,
typename VectorType>
495 const unsigned int to_level,
497 const VectorType & src)
const
499 this->transfer[to_level].prolongate(dst, src);
504template <
int dim,
typename VectorType>
507 const unsigned int from_level,
509 const VectorType & src)
const
511 this->transfer[from_level].restrict_and_add(dst, src);
516template <
int dim,
typename VectorType>
517template <
class InVector,
int spacedim>
522 const InVector & src)
const
527 initialize_dof_vector,
529 "To be able to use this function, a function to initialize an internal "
530 "DoF vector has to be provided in the constructor of "
531 "MGTransferGlobalCoarsening."));
536 dst[dst.
max_level()].copy_locally_owned_data_from(src);
541template <
int dim,
typename VectorType>
542template <
class OutVector,
int spacedim>
551 dst.copy_locally_owned_data_from(src[src.
max_level()]);
556template <
int dim,
typename VectorType>
557template <
class InVector,
int spacedim>
562 const InVector & src)
const
567 initialize_dof_vector,
569 "To be able to use this function, a function to initialize an internal "
570 "DoF vector has to be provided in the constructor of "
571 "MGTransferGlobalCoarsening."));
573 const unsigned int min_level = transfer.min_level();
574 const unsigned int max_level = transfer.max_level();
582 dst[transfer.max_level()].copy_locally_owned_data_from(src);
584 for (
unsigned int l = max_level;
l > min_level; --
l)
unsigned int max_level() const
unsigned int min_level() const
const MGLevelObject< MGTwoLevelTransfer< dim, VectorType > > & transfer
MGTransferGlobalCoarsening(const MGLevelObject< MGTwoLevelTransfer< dim, VectorType > > &transfer, const std::function< void(const unsigned int, VectorType &)> &initialize_dof_vector={})
void copy_from_mg(const DoFHandler< dim, spacedim > &dof_handler, OutVector &dst, const MGLevelObject< VectorType > &src) const
void interpolate_to_mg(const DoFHandler< dim, spacedim > &dof_handler, MGLevelObject< VectorType > &dst, const InVector &src) const
void prolongate(const unsigned int to_level, VectorType &dst, const VectorType &src) const override
typename VectorType::value_type Number
void copy_to_mg(const DoFHandler< dim, spacedim > &dof_handler, MGLevelObject< VectorType > &dst, const InVector &src) const
const std::function< void(const unsigned int, VectorType &)> initialize_dof_vector
virtual void restrict_and_add(const unsigned int from_level, VectorType &dst, const VectorType &src) const override
std::vector< Number > constraint_coarse_distribute_values
std::vector< unsigned int > distribute_local_to_global_ptr
LinearAlgebra::distributed::Vector< Number > vec_fine
void reinit_geometric_transfer(const DoFHandler< dim > &dof_handler_fine, const DoFHandler< dim > &dof_handler_coarse, const AffineConstraints< Number > &constraint_fine, const AffineConstraints< Number > &constraint_coarse)
void prolongate(LinearAlgebra::distributed::Vector< Number > &dst, const LinearAlgebra::distributed::Vector< Number > &src) const
LinearAlgebra::distributed::Vector< Number > vec_coarse
static bool fast_polynomial_transfer_supported(const unsigned int fe_degree_fine, const unsigned int fe_degree_coarse)
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner_coarse
void reinit_polynomial_transfer(const DoFHandler< dim > &dof_handler_fine, const DoFHandler< dim > &dof_handler_coarse, const AffineConstraints< Number > &constraint_fine, const AffineConstraints< Number > &constraint_coarse)
unsigned int n_components
void interpolate(LinearAlgebra::distributed::Vector< Number > &dst, const LinearAlgebra::distributed::Vector< Number > &src) const
std::vector< unsigned int > distribute_local_to_global_indices
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner_fine
std::vector< unsigned int > constraint_coarse_distribute_ptr
std::vector< Number > distribute_local_to_global_values
void restrict_and_add(LinearAlgebra::distributed::Vector< Number > &dst, const LinearAlgebra::distributed::Vector< Number > &src) const
bool fine_element_is_continuous
std::vector< unsigned int > constraint_coarse_distribute_indices
LinearAlgebra::distributed::Vector< Number > vec_coarse_constraints
std::vector< MGTransferScheme > schemes
void restrict_and_add(VectorType &dst, const VectorType &src) const
void interpolate(VectorType &dst, const VectorType &src) const
void prolongate(VectorType &dst, const VectorType &src) const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcMessage(std::string arg1)
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
unsigned int dofs_per_cell_fine
unsigned int n_coarse_cells
unsigned int dofs_per_cell_coarse
AlignedVector< VectorizedArray< Number > > prolongation_matrix_1d
AlignedVector< VectorizedArray< Number > > prolongation_matrix
std::vector< unsigned int > level_dof_indices_fine
std::vector< Number > weights
unsigned int degree_coarse
std::vector< unsigned int > level_dof_indices_coarse
AlignedVector< VectorizedArray< Number > > restriction_matrix_1d
AlignedVector< VectorizedArray< Number > > restriction_matrix