From: Martin Kronbichler Date: Mon, 30 May 2022 15:06:11 +0000 (+0200) Subject: Fix bug for global coarsening: Must allow invalid proc id X-Git-Tag: v9.4.0-rc1~114^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=841b136045a494c1ad5c84ccac29145861b8103e;p=dealii.git Fix bug for global coarsening: Must allow invalid proc id --- diff --git a/include/deal.II/base/mpi_compute_index_owner_internal.h b/include/deal.II/base/mpi_compute_index_owner_internal.h index 88ea9c88bd..195b19e155 100644 --- a/include/deal.II/base/mpi_compute_index_owner_internal.h +++ b/include/deal.II/base/mpi_compute_index_owner_internal.h @@ -45,7 +45,9 @@ namespace Utilities FlexibleIndexStorage(const bool use_vector = true); void - reinit(const bool use_vector, const std::size_t size); + reinit(const bool use_vector, + const bool index_range_contiguous, + const std::size_t size); void fill(const std::size_t start, diff --git a/source/base/mpi_compute_index_owner_internal.cc b/source/base/mpi_compute_index_owner_internal.cc index 53ad820a52..c70898afa8 100644 --- a/source/base/mpi_compute_index_owner_internal.cc +++ b/source/base/mpi_compute_index_owner_internal.cc @@ -44,6 +44,7 @@ namespace Utilities void FlexibleIndexStorage::reinit(const bool use_vector, + const bool index_range_contiguous, const std::size_t size) { this->use_vector = use_vector; @@ -52,8 +53,10 @@ namespace Utilities data = {}; data_map.clear(); - // do not initialize the vector but only upon first request in - // `fill` + // in case we have contiguous indices, only fill the vector upon + // first request in `fill` + if (!index_range_contiguous) + data.resize(size, invalid_index_value); } @@ -263,6 +266,8 @@ namespace Utilities actually_owning_ranks.reinit((owned_indices_size_actual * sparsity_factor) > owned_indices.size(), + owned_indices_size_actual == + owned_indices.size(), locally_owned_size); // 2) collect relevant processes and process local dict entries