]> https://gitweb.dealii.org/ - dealii.git/commitdiff
MatrixFree::reinit: Fix case with MPI and threading 16340/head
authorMartin Kronbichler <martin.kronbichler@rub.de>
Mon, 11 Dec 2023 10:17:03 +0000 (11:17 +0100)
committerMartin Kronbichler <martin.kronbichler@rub.de>
Mon, 11 Dec 2023 10:17:03 +0000 (11:17 +0100)
include/deal.II/matrix_free/matrix_free.templates.h

index c7bf9a972ee6740e4b84259b4ede41108c87183e..32446a43adfa8efab220ea2361693adf76531fcb 100644 (file)
@@ -1044,6 +1044,7 @@ namespace internal
                                         > &map,
     DynamicSparsityPattern                &connectivity_direct)
   {
+    const unsigned int locally_owned_size = connectivity_direct.n_rows();
     std::vector<types::global_dof_index> new_indices;
     for (unsigned int cell = begin; cell < end; ++cell)
       {
@@ -1064,7 +1065,8 @@ namespace internal
                 if (it != map.end())
                   {
                     const unsigned int neighbor_cell = it->second;
-                    if (neighbor_cell != cell)
+                    if (neighbor_cell != cell &&
+                        neighbor_cell < locally_owned_size)
                       new_indices.push_back(neighbor_cell);
                   }
               }

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.