From f1ca0f9aee1db3f70d80b939252d1ca8dae4cf1d Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Mon, 20 Jun 2022 12:43:58 +0200 Subject: [PATCH] Do not locally owned dofs to ghost set during construction --- .../mg_transfer_global_coarsening.templates.h | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) 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 c068e3d97b..ce3c49bebc 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -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 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() : -- 2.39.5