From: Martin Kronbichler Date: Mon, 11 Dec 2023 10:17:03 +0000 (+0100) Subject: MatrixFree::reinit: Fix case with MPI and threading X-Git-Tag: relicensing~256^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16340%2Fhead;p=dealii.git MatrixFree::reinit: Fix case with MPI and threading --- diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index c7bf9a972e..32446a43ad 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -1044,6 +1044,7 @@ namespace internal > &map, DynamicSparsityPattern &connectivity_direct) { + const unsigned int locally_owned_size = connectivity_direct.n_rows(); std::vector 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); } }