From: Peter Munch <peterrmuench@gmail.com>
Date: Sat, 28 Aug 2021 19:39:34 +0000 (+0200)
Subject: Move a zero_out_ghost_values
X-Git-Tag: v9.4.0-rc1~1021^2
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5eaaf60ac7133604724f934eb04e1f78253c7215;p=dealii.git

Move a zero_out_ghost_values
---

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 9c20a074e7..87231c766e 100644
--- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h
+++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h
@@ -2608,9 +2608,6 @@ MGTwoLevelTransfer<dim, LinearAlgebra::distributed::Vector<Number>>::
         }
     }
 
-  this->vec_coarse.zero_out_ghost_values(); // clear ghost values; else compress
-                                            // in do_restrict_add does not work
-
   if (fine_element_is_continuous || use_dst_inplace == false)
     vec_fine_ptr->compress(VectorOperation::add);
 
@@ -2640,6 +2637,8 @@ MGTwoLevelTransfer<dim, LinearAlgebra::distributed::Vector<Number>>::
     vec_fine_ptr->update_ghost_values();
 
   this->vec_coarse.copy_locally_owned_data_from(dst);
+  this->vec_coarse.zero_out_ghost_values(); // since we might add into the
+                                            // ghost values and call compress
 
   AlignedVector<VectorizedArrayType> evaluation_data_fine;
   AlignedVector<VectorizedArrayType> evaluation_data_coarse;