22 template <
int dim,
typename VectorType>
28 transfer_matrices.resize(0, dof_handlers_.size());
29 dof_handlers.resize(dof_handlers_.size());
31 for (
unsigned int l = transfer_matrices_.
min_level();
36 transfer_matrices[
l] = transfer_matrices_[
l];
37 dof_handlers[
l] = dof_handlers_[
l];
43 template <
int dim,
typename VectorType>
49 transfer_matrices.resize(0, dof_handlers_.size());
50 dof_handlers.resize(dof_handlers_.size());
52 for (
unsigned int l = transfer_matrices_.
min_level();
57 transfer_matrices[
l] =
58 const_cast<dealii::TrilinosWrappers::SparseMatrix *
>(
59 &transfer_matrices_[
l]);
60 dof_handlers[
l] = dof_handlers_[
l];
66 template <
int dim,
typename VectorType>
69 const unsigned int to_level,
71 const VectorType &src)
const
73 dst =
typename VectorType::value_type(0.0);
74 prolongate_and_add(to_level, dst, src);
79 template <
int dim,
typename VectorType>
82 const unsigned int to_level,
84 const VectorType &src)
const
86 Assert(transfer_matrices[to_level - 1] !=
nullptr,
87 ExcMessage(
"Transfer matrix has not been initialized."));
88 transfer_matrices[to_level - 1]->vmult_add(dst, src);
93 template <
int dim,
typename VectorType>
96 const unsigned int from_level,
98 const VectorType &src)
const
105 Assert(transfer_matrices[from_level - 1] !=
nullptr,
106 ExcMessage(
"Matrix has not been initialized."));
107 transfer_matrices[from_level - 1]->Tvmult_add(dst, src);
112 template <
int dim,
typename VectorType>
117 const VectorType &src)
const
125 dst[
level].reinit(dof_handlers[
level]->locally_owned_dofs(),
126 dof_handlers[
level]->get_communicator());
129 if constexpr (std::is_same_v<VectorType, TrilinosWrappers::MPI::Vector>)
131 else if constexpr (std::is_same_v<
134 dst[dst.
max_level()].copy_locally_owned_data_from(src);
141 template <
int dim,
typename VectorType>
149 if constexpr (std::is_same_v<VectorType, TrilinosWrappers::MPI::Vector>)
151 else if constexpr (std::is_same_v<
154 dst.copy_locally_owned_data_from(src[src.
max_level()]);
unsigned int max_level() const
unsigned int min_level() const
unsigned int n_levels() const
void prolongate(const unsigned int to_level, VectorType &dst, const VectorType &src) const override
void copy_from_mg(const DoFHandler< dim > &dof_handler, VectorType &dst, const MGLevelObject< VectorType > &src) const
MGTransferAgglomeration(const MGLevelObject< TrilinosWrappers::SparseMatrix * > &transfer_matrices, const std::vector< DoFHandler< dim > * > &dof_handlers)
void restrict_and_add(const unsigned int from_level, VectorType &dst, const VectorType &src) const override
void prolongate_and_add(const unsigned int to_level, VectorType &dst, const VectorType &src) const override
void copy_to_mg(const DoFHandler< dim > &dof_handler, MGLevelObject< VectorType > &dst, const VectorType &src) const
#define Assert(cond, exc)
#define DEAL_II_NOT_IMPLEMENTED()
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)