]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Do not locally owned dofs to ghost set during construction
authorMartin Kronbichler <martin.kronbichler@uni-a.de>
Mon, 20 Jun 2022 10:43:58 +0000 (12:43 +0200)
committerMartin Kronbichler <martin.kronbichler@uni-a.de>
Mon, 20 Jun 2022 12:43:13 +0000 (14:43 +0200)
include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h

index c068e3d97beb957d37dd658cca7301bc51b02009..ce3c49bebcc8c369d7a580e2f23bd4531f1af054 100644 (file)
@@ -652,6 +652,11 @@ namespace internal
           }
       }
 
+      this->is_extended_locally_owned =
+        mg_level_fine == numbers::invalid_unsigned_int ?
+          dof_handler_fine.locally_owned_dofs() :
+          dof_handler_fine.locally_owned_mg_dofs(mg_level_fine);
+
       std::vector<types::global_dof_index> ghost_indices;
 
       // process local cells
@@ -674,9 +679,9 @@ namespace internal
             else
               cell_->get_mg_dof_indices(indices);
 
-            ghost_indices.insert(ghost_indices.end(),
-                                 indices.begin(),
-                                 indices.end());
+            for (const auto i : indices)
+              if (!is_extended_locally_owned.is_element(i))
+                ghost_indices.push_back(i);
           }
       }
 
@@ -728,13 +733,15 @@ namespace internal
               MPI_STATUS_IGNORE);
             AssertThrowMPI(ierr_3);
 
-            for (unsigned int i = 0; i < buffer.size();
-                 i += dof_handler_fine.get_fe(buffer[i]).n_dofs_per_cell() + 1)
-              ghost_indices.insert(
-                ghost_indices.end(),
-                buffer.begin() + i + 1,
-                buffer.begin() + i + 1 +
-                  dof_handler_fine.get_fe(buffer[i]).n_dofs_per_cell());
+            for (unsigned int i = 0; i < buffer.size();)
+              {
+                const unsigned int dofs_per_cell =
+                  dof_handler_fine.get_fe(buffer[i]).n_dofs_per_cell();
+                ++i;
+                for (unsigned int j = 0; j < dofs_per_cell; ++j, ++i)
+                  if (!is_extended_locally_owned.is_element(buffer[i]))
+                    ghost_indices.push_back(buffer[i]);
+              }
 
             const unsigned int rank = status.MPI_SOURCE;
 
@@ -765,11 +772,6 @@ namespace internal
                                       ghost_indices.end()),
                           ghost_indices.end());
 
-      this->is_extended_locally_owned =
-        mg_level_fine == numbers::invalid_unsigned_int ?
-          dof_handler_fine.locally_owned_dofs() :
-          dof_handler_fine.locally_owned_mg_dofs(mg_level_fine);
-
       this->is_extended_ghosts =
         IndexSet(mg_level_fine == numbers::invalid_unsigned_int ?
                    dof_handler_fine.n_dofs() :

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.