From: Richard Schussnig Date: Wed, 9 Aug 2023 14:26:44 +0000 (+0200) Subject: reset ghost state in MG transfer global coarsening interpolate X-Git-Tag: relicensing~527^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbc686beb4b9c072017084d76a34eada58727539;p=dealii.git reset ghost state in MG transfer global coarsening interpolate --- diff --git a/doc/news/changes/minor/20230904Schussnig b/doc/news/changes/minor/20230904Schussnig new file mode 100644 index 0000000000..3526b07eef --- /dev/null +++ b/doc/news/changes/minor/20230904Schussnig @@ -0,0 +1,4 @@ +Improved: MGTwoLevelTransferBase does not clear the +ghost state of the source vector anymore. +
+(Richard Schussnig, Martin Kronbichler, Peter Munch, 2023/09/04) 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 3369e456f6..55d81d247c 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -3195,10 +3195,13 @@ MGTwoLevelTransferBase>:: this->partitioner_coarse.get(), ExcInternalError()); + const bool src_ghosts_have_been_set = src.has_ghost_elements(); + if (use_src_inplace == false) this->vec_coarse.copy_locally_owned_data_from(src); - this->update_ghost_values(*vec_coarse_ptr); + if ((use_src_inplace == false) || (src_ghosts_have_been_set == false)) + this->update_ghost_values(*vec_coarse_ptr); if (use_dst_inplace == false) *vec_fine_ptr = Number(0.); @@ -3211,7 +3214,7 @@ MGTwoLevelTransferBase>:: if (use_dst_inplace == false) dst += this->vec_fine; - if (use_src_inplace) + if (use_src_inplace && (src_ghosts_have_been_set == false)) this->zero_out_ghost_values(*vec_coarse_ptr); } @@ -3362,10 +3365,13 @@ MGTwoLevelTransferBase>:: this->partitioner_coarse.get(), ExcInternalError()); + const bool src_ghosts_have_been_set = src.has_ghost_elements(); + if (use_src_inplace == false) this->vec_fine.copy_locally_owned_data_from(src); - if (fine_element_is_continuous || use_src_inplace == false) + if ((use_src_inplace == false) || + (fine_element_is_continuous && (src_ghosts_have_been_set == false))) this->update_ghost_values(*vec_fine_ptr); if (use_dst_inplace == false) @@ -3382,7 +3388,7 @@ MGTwoLevelTransferBase>:: this->zero_out_ghost_values(*vec_fine_ptr); // internal vector (DG) else if (fine_element_is_continuous && use_src_inplace == false) vec_fine_ptr->set_ghost_state(false); // internal vector (CG) - else if (fine_element_is_continuous) + else if (fine_element_is_continuous && (src_ghosts_have_been_set == false)) this->zero_out_ghost_values(*vec_fine_ptr); // external vector this->compress(*vec_coarse_ptr, VectorOperation::add); @@ -3541,10 +3547,13 @@ MGTwoLevelTransfer>:: this->partitioner_coarse.get(), ExcInternalError()); + const bool src_ghosts_have_been_set = src.has_ghost_elements(); + if (use_src_inplace == false) this->vec_fine.copy_locally_owned_data_from(src); - if (this->fine_element_is_continuous || use_src_inplace == false) + if ((use_src_inplace == false) || + (this->fine_element_is_continuous && (src_ghosts_have_been_set == false))) this->update_ghost_values(*vec_fine_ptr); *vec_coarse_ptr = 0.0; @@ -3639,7 +3648,8 @@ MGTwoLevelTransfer>:: // clean up related to update_ghost_values() if (use_src_inplace == false) vec_fine_ptr->set_ghost_state(false); // internal vector - else if (this->fine_element_is_continuous) + else if (this->fine_element_is_continuous && + (src_ghosts_have_been_set == false)) this->zero_out_ghost_values(*vec_fine_ptr); // external vector if (use_dst_inplace == false)