From: Martin Kronbichler Date: Tue, 23 Jul 2024 16:19:37 +0000 (+0200) Subject: MGTwoLevelTransfer with MatrixFree option: Skip fine constraints X-Git-Tag: v9.6.0-rc1~13^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da57b3ee8a029ffc0eb8471ad5a3ec76223df63e;p=dealii.git MGTwoLevelTransfer with MatrixFree option: Skip fine constraints --- 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 67c0ee009c..f400fd03fb 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -3036,6 +3036,57 @@ MGTwoLevelTransferBase::prolongate_and_add( +namespace internal +{ + namespace + { + + // Helper class to compute correct weights, which works by simply using + // the degrees of freedom stored in MatrixFree, bypassing the hanging node + // interpolation matrices. + template + class FEEvaluationNoConstraints : public FEEvaluation + { + public: + FEEvaluationNoConstraints(const MatrixFree &data, + const unsigned int dof_index, + const unsigned int component = 0) + : FEEvaluation(data, dof_index, 0, component) + {} + + template + void + read_dof_values_unconstrained(VectorType &src) + { + std::array src_vector{{&src}}; + internal::VectorReader> reader; + this->template read_write_operation( + reader, + src_vector, + {}, + std::bitset::size()>().flip(), + false); + } + + template + void + distribute_local_to_global_unconstrained(VectorType &dst) + { + std::array dst_vector{{&dst}}; + internal::VectorDistributorLocalToGlobal> + writer; + this->template read_write_operation( + writer, + dst_vector, + {}, + std::bitset::size()>().flip(), + false); + } + }; + } // namespace +} // namespace internal + template void MGTwoLevelTransfer::prolongate_and_add_internal( @@ -3051,8 +3102,8 @@ MGTwoLevelTransfer::prolongate_and_add_internal( const std::pair &range) { for (unsigned int comp = 0; comp < n_components; ++comp) { - FEEvaluation eval_fine( - data, matrix_free_data->dof_handler_index_fine, 0, comp); + internal::FEEvaluationNoConstraints eval_fine( + data, matrix_free_data->dof_handler_index_fine, comp); FEEvaluation eval_coarse( *matrix_free_data->matrix_free_coarse, matrix_free_data->dof_handler_index_coarse, @@ -3297,8 +3348,8 @@ MGTwoLevelTransfer::restrict_and_add_internal( const std::pair &range) { for (unsigned int comp = 0; comp < n_components; ++comp) { - FEEvaluation eval_fine( - data, matrix_free_data->dof_handler_index_fine, 0, comp); + internal::FEEvaluationNoConstraints eval_fine( + data, matrix_free_data->dof_handler_index_fine, comp); FEEvaluation eval_coarse( *matrix_free_data->matrix_free_coarse, matrix_free_data->dof_handler_index_coarse, @@ -3488,10 +3539,9 @@ MGTwoLevelTransfer::interpolate(VectorType &dst, src.update_ghost_values(); for (unsigned int comp = 0; comp < n_components; ++comp) { - FEEvaluation eval_fine( + internal::FEEvaluationNoConstraints eval_fine( *matrix_free_data->matrix_free_fine, matrix_free_data->dof_handler_index_fine, - 0, comp); FEEvaluation eval_coarse( *matrix_free_data->matrix_free_coarse, @@ -3715,49 +3765,6 @@ namespace internal return embedded_partitioner; } - - // Helper class to compute correct weights, which works by simply using - // the degrees of freedom stored in MatrixFree, bypassing the hanging node - // interpolation matrices. - template - class FEEvaluationNoConstraints : public FEEvaluation - { - public: - FEEvaluationNoConstraints(const MatrixFree &data, - const unsigned int dof_index) - : FEEvaluation(data, dof_index) - {} - - template - void - read_dof_values_unconstrained(VectorType &src) - { - std::array src_vector{{&src}}; - internal::VectorReader> reader; - this->template read_write_operation( - reader, - src_vector, - {}, - std::bitset::size()>().flip(), - false); - } - - template - void - distribute_local_to_global_unconstrained(VectorType &dst) - { - std::array dst_vector{{&dst}}; - internal::VectorDistributorLocalToGlobal> - writer; - this->template read_write_operation( - writer, - dst_vector, - {}, - std::bitset::size()>().flip(), - false); - } - }; } // namespace } // namespace internal