From: Marco Feder Date: Thu, 27 Apr 2023 12:50:33 +0000 (+0200) Subject: review X-Git-Tag: v9.5.0-rc1~280^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a01d03214ce92dcbc719d39a74faeb383e00020;p=dealii.git review --- diff --git a/include/deal.II/multigrid/mg_transfer_global_coarsening.h b/include/deal.II/multigrid/mg_transfer_global_coarsening.h index d83ca0bafd..7fe96f979b 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.h @@ -153,7 +153,9 @@ namespace MGTransferGlobalCoarseningTools } // namespace MGTransferGlobalCoarseningTools - +/** + * Abstract base class for transfer operators between two multigrid levels. + */ template class MGTwoLevelTransferBase : public Subscriptor { @@ -198,7 +200,13 @@ public: }; - +/** + * Base class for transfer operators between two multigrid levels. + * Specialization for LinearAlgebra::distributed::Vector. The implementation of + * restriction and prolongation between levels is delegated to derived classes, + * which implement prolongate_and_add_internal() and restrict_and_add_internal() + * accordingly. + */ template class MGTwoLevelTransferBase> : public Subscriptor @@ -220,9 +228,7 @@ public: /** * Perform interpolation of a solution vector from the fine level to the - * coarse level. This function is different from restriction, where a - * weighted residual is transferred to a coarser level (transposition of - * prolongation matrix). + * coarse level. */ virtual void interpolate(VectorType &dst, const VectorType &src) const = 0; @@ -246,7 +252,7 @@ public: protected: /** - * Perform prolongation. + * Perform prolongation on vectors with correct ghosting. */ virtual void prolongate_and_add_internal( @@ -254,21 +260,36 @@ protected: const LinearAlgebra::distributed::Vector &src) const = 0; /** - * Perform restriction. + * Perform restriction on vectors with correct ghosting. */ virtual void restrict_and_add_internal( LinearAlgebra::distributed::Vector & dst, const LinearAlgebra::distributed::Vector &src) const = 0; + /** + * A wrapper around update_ghost_values() optimized in case the + * present vector has the same parallel layout of one of the external + * partitioners. + */ void update_ghost_values( const LinearAlgebra::distributed::Vector &vec) const; + /** + * A wrapper around compress() optimized in case the + * present vector has the same parallel layout of one of the external + * partitioners. + */ void compress(LinearAlgebra::distributed::Vector &vec, const VectorOperation::values op) const; + /** + * A wrapper around zero_out_ghost_values() optimized in case the + * present vector has the same parallel layout of one of the external + * partitioners. + */ void zero_out_ghost_values( const LinearAlgebra::distributed::Vector &vec) const; @@ -277,13 +298,14 @@ protected: * Enable inplace vector operations if external and internal vectors * are compatible. */ - template + template void internal_enable_inplace_operations_if_possible( const std::shared_ptr &partitioner_coarse, const std::shared_ptr &partitioner_fine, - ConstraintInfo & constraint_info); + internal::MatrixFreeFunctions:: + ConstraintInfo> &constraint_info); /** * Flag if the finite elements on the fine cells are continuous. If yes, @@ -373,9 +395,7 @@ public: /** * Perform interpolation of a solution vector from the fine level to the - * coarse level. This function is different from restriction, where a - * weighted residual is transferred to a coarser level (transposition of - * prolongation matrix). + * coarse level. */ void interpolate(VectorType &dst, const VectorType &src) const override; @@ -484,9 +504,7 @@ public: /** * Perform interpolation of a solution vector from the fine level to the - * coarse level. This function is different from restriction, where a - * weighted residual is transferred to a coarser level (transposition of - * prolongation matrix). + * coarse level. */ void interpolate( diff --git a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h index dd8f5648ce..1a53fe6e8f 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -3113,15 +3113,16 @@ namespace internal } // namespace internal template -template +template void MGTwoLevelTransferBase>:: internal_enable_inplace_operations_if_possible( const std::shared_ptr &external_partitioner_coarse, const std::shared_ptr - & external_partitioner_fine, - ConstraintInfo &constraint_info) + &external_partitioner_fine, + internal::MatrixFreeFunctions:: + ConstraintInfo> &constraint_info) { if (this->partitioner_coarse->is_globally_compatible( *external_partitioner_coarse))