]> https://gitweb.dealii.org/ - dealii.git/commitdiff
reset ghost state in MG transfer global coarsening interpolate
authorRichard Schussnig <richard.schussnig@uni-a.de>
Wed, 9 Aug 2023 14:26:44 +0000 (16:26 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Mon, 4 Sep 2023 19:37:00 +0000 (21:37 +0200)
doc/news/changes/minor/20230904Schussnig [new file with mode: 0644]
include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h

diff --git a/doc/news/changes/minor/20230904Schussnig b/doc/news/changes/minor/20230904Schussnig
new file mode 100644 (file)
index 0000000..3526b07
--- /dev/null
@@ -0,0 +1,4 @@
+Improved: MGTwoLevelTransferBase does not clear the
+ghost state of the source vector anymore.
+<br>
+(Richard Schussnig, Martin Kronbichler, Peter Munch, 2023/09/04)
index 3369e456f6587afcd38c2a740d9a18e1ed463349..55d81d247c30732a438cd1aa606311876cb2b455 100644 (file)
@@ -3195,10 +3195,13 @@ MGTwoLevelTransferBase<LinearAlgebra::distributed::Vector<Number>>::
            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<LinearAlgebra::distributed::Vector<Number>>::
   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<LinearAlgebra::distributed::Vector<Number>>::
            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<LinearAlgebra::distributed::Vector<Number>>::
     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<dim, LinearAlgebra::distributed::Vector<Number>>::
            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<dim, LinearAlgebra::distributed::Vector<Number>>::
   // 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)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.