Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MGTransferBlockMatrixFree: allow to copy form/to other type of block vector #14075

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 22 additions & 22 deletions include/deal.II/multigrid/mg_transfer_matrix_free.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ class MGTransferMatrixFree
*
* The use of this function is demonstrated in step-66.
*/
template <typename Number2, int spacedim>
template <typename BlockVectorType2, int spacedim>
void
interpolate_to_mg(
const DoFHandler<dim, spacedim> & dof_handler,
MGLevelObject<LinearAlgebra::distributed::Vector<Number>> &dst,
const LinearAlgebra::distributed::Vector<Number2> & src) const;
const BlockVectorType2 & src) const;

/**
* Finite element does not provide prolongation matrices.
Expand Down Expand Up @@ -385,42 +385,42 @@ class MGTransferBlockMatrixFreeBase
* This function will initialize @p dst accordingly if needed as required by
* the Multigrid class.
*/
template <typename Number2, int spacedim>
template <typename BlockVectorType2, int spacedim>
void
copy_to_mg(
const DoFHandler<dim, spacedim> & dof_handler,
MGLevelObject<LinearAlgebra::distributed::BlockVector<Number>> &dst,
const LinearAlgebra::distributed::BlockVector<Number2> & src) const;
const BlockVectorType2 & src) const;

/**
* Same as above for the case that each block has its own DoFHandler.
*/
template <typename Number2, int spacedim>
template <typename BlockVectorType2, int spacedim>
void
copy_to_mg(
const std::vector<const DoFHandler<dim, spacedim> *> & dof_handler,
MGLevelObject<LinearAlgebra::distributed::BlockVector<Number>> &dst,
const LinearAlgebra::distributed::BlockVector<Number2> & src) const;
const BlockVectorType2 & src) const;

/**
* Transfer from multi-level block-vector to normal vector.
*/
template <typename Number2, int spacedim>
template <typename BlockVectorType2, int spacedim>
void
copy_from_mg(
const DoFHandler<dim, spacedim> & dof_handler,
LinearAlgebra::distributed::BlockVector<Number2> &dst,
const DoFHandler<dim, spacedim> &dof_handler,
BlockVectorType2 & dst,
const MGLevelObject<LinearAlgebra::distributed::BlockVector<Number>> &src)
const;

/**
* Same as above for the case that each block has its own DoFHandler.
*/
template <typename Number2, int spacedim>
template <typename BlockVectorType2, int spacedim>
void
copy_from_mg(
const std::vector<const DoFHandler<dim, spacedim> *> &dof_handler,
LinearAlgebra::distributed::BlockVector<Number2> & dst,
BlockVectorType2 & dst,
const MGLevelObject<LinearAlgebra::distributed::BlockVector<Number>> &src)
const;

Expand Down Expand Up @@ -547,12 +547,12 @@ class MGTransferBlockMatrixFree


template <int dim, typename Number>
template <typename Number2, int spacedim>
template <typename BlockVectorType2, int spacedim>
void
MGTransferMatrixFree<dim, Number>::interpolate_to_mg(
const DoFHandler<dim, spacedim> & dof_handler,
MGLevelObject<LinearAlgebra::distributed::Vector<Number>> &dst,
const LinearAlgebra::distributed::Vector<Number2> & src) const
const BlockVectorType2 & src) const
{
const unsigned int min_level = dst.min_level();
const unsigned int max_level = dst.max_level();
Expand Down Expand Up @@ -640,12 +640,12 @@ MGTransferMatrixFree<dim, Number>::interpolate_to_mg(


template <int dim, typename Number, typename TransferType>
template <typename Number2, int spacedim>
template <typename BlockVectorType2, int spacedim>
void
MGTransferBlockMatrixFreeBase<dim, Number, TransferType>::copy_to_mg(
const DoFHandler<dim, spacedim> & dof_handler,
MGLevelObject<LinearAlgebra::distributed::BlockVector<Number>> &dst,
const LinearAlgebra::distributed::BlockVector<Number2> & src) const
const BlockVectorType2 & src) const
{
Assert(same_for_all,
ExcMessage(
Expand All @@ -661,12 +661,12 @@ MGTransferBlockMatrixFreeBase<dim, Number, TransferType>::copy_to_mg(


template <int dim, typename Number, typename TransferType>
template <typename Number2, int spacedim>
template <typename BlockVectorType2, int spacedim>
void
MGTransferBlockMatrixFreeBase<dim, Number, TransferType>::copy_to_mg(
const std::vector<const DoFHandler<dim, spacedim> *> & dof_handler,
MGLevelObject<LinearAlgebra::distributed::BlockVector<Number>> &dst,
const LinearAlgebra::distributed::BlockVector<Number2> & src) const
const BlockVectorType2 & src) const
{
const unsigned int n_blocks = src.n_blocks();
AssertDimension(dof_handler.size(), n_blocks);
Expand Down Expand Up @@ -700,11 +700,11 @@ MGTransferBlockMatrixFreeBase<dim, Number, TransferType>::copy_to_mg(
}

template <int dim, typename Number, typename TransferType>
template <typename Number2, int spacedim>
template <typename BlockVectorType2, int spacedim>
void
MGTransferBlockMatrixFreeBase<dim, Number, TransferType>::copy_from_mg(
const DoFHandler<dim, spacedim> & dof_handler,
LinearAlgebra::distributed::BlockVector<Number2> &dst,
const DoFHandler<dim, spacedim> &dof_handler,
BlockVectorType2 & dst,
const MGLevelObject<LinearAlgebra::distributed::BlockVector<Number>> &src)
const
{
Expand All @@ -720,11 +720,11 @@ MGTransferBlockMatrixFreeBase<dim, Number, TransferType>::copy_from_mg(
}

template <int dim, typename Number, typename TransferType>
template <typename Number2, int spacedim>
template <typename BlockVectorType2, int spacedim>
void
MGTransferBlockMatrixFreeBase<dim, Number, TransferType>::copy_from_mg(
const std::vector<const DoFHandler<dim, spacedim> *> &dof_handler,
LinearAlgebra::distributed::BlockVector<Number2> & dst,
BlockVectorType2 & dst,
const MGLevelObject<LinearAlgebra::distributed::BlockVector<Number>> &src)
const
{
Expand Down