From 171c9f627c1acf7d4d4ae082e627c5f90c6b4765 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Mon, 15 Feb 2021 12:45:21 +0100 Subject: [PATCH] TriangulationBase::reset_global_cell_indices(): collect indices manually --- source/distributed/tria_base.cc | 35 +++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/source/distributed/tria_base.cc b/source/distributed/tria_base.cc index 9d3fa9eb94..a27a626cee 100644 --- a/source/distributed/tria_base.cc +++ b/source/distributed/tria_base.cc @@ -417,8 +417,8 @@ namespace parallel }); // 5) set up new partitioner - IndexSet is_local(this->n_global_active_cells()); - IndexSet is_ghost(this->n_global_active_cells()); + std::vector is_local_vector; + std::vector is_ghost_vector; for (const auto &cell : this->active_cell_iterators()) if (!cell->is_artificial()) @@ -429,11 +429,19 @@ namespace parallel continue; if (cell->is_locally_owned()) - is_local.add_index(index); + is_local_vector.push_back(index); else - is_ghost.add_index(index); + is_ghost_vector.push_back(index); } + std::sort(is_local_vector.begin(), is_local_vector.end()); + IndexSet is_local(this->n_global_active_cells()); + is_local.add_indices(is_local_vector.begin(), is_local_vector.end()); + + std::sort(is_ghost_vector.begin(), is_ghost_vector.end()); + IndexSet is_ghost(this->n_global_active_cells()); + is_ghost.add_indices(is_ghost_vector.begin(), is_ghost_vector.end()); + number_cache.active_cell_index_partitioner = Utilities::MPI::Partitioner(is_local, is_ghost, this->mpi_communicator); @@ -497,8 +505,8 @@ namespace parallel // 6) set up cell partitioners for each level for (unsigned int l = 0; l < this->n_global_levels(); ++l) { - IndexSet is_local(n_cells_level[l]); - IndexSet is_ghost(n_cells_level[l]); + std::vector is_local_vector; + std::vector is_ghost_vector; for (const auto &cell : this->cell_iterators_on_level(l)) if (cell->level_subdomain_id() != @@ -511,11 +519,22 @@ namespace parallel if (cell->level_subdomain_id() == this->locally_owned_subdomain()) - is_local.add_index(index); + is_local_vector.push_back(index); else - is_ghost.add_index(index); + is_ghost_vector.push_back(index); + ; } + IndexSet is_local(n_cells_level[l]); + std::sort(is_local_vector.begin(), is_local_vector.end()); + is_local.add_indices(is_local_vector.begin(), + is_local_vector.end()); + + IndexSet is_ghost(n_cells_level[l]); + std::sort(is_ghost_vector.begin(), is_ghost_vector.end()); + is_ghost.add_indices(is_ghost_vector.begin(), + is_ghost_vector.end()); + number_cache.level_cell_index_partitioners[l] = Utilities::MPI::Partitioner(is_local, is_ghost, -- 2.39.5