Skip to content

Commit

Permalink
Merge pull request dealii#13858 from kronbichler/fix_bug_global_coars…
Browse files Browse the repository at this point in the history
…ening

Fix bug for global coarsening: Must allow invalid proc id
  • Loading branch information
drwells committed May 30, 2022
2 parents 28ad21e + 7f0fb4a commit 1f0f308
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion include/deal.II/base/mpi_compute_index_owner_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 7 additions & 2 deletions source/base/mpi_compute_index_owner_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}


Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1f0f308

Please sign in to comment.