From: Peter Munch Date: Sat, 6 Mar 2021 08:39:40 +0000 (+0100) Subject: Make active_cell_index_partitioner to std::shared_ptr X-Git-Tag: v9.3.0-rc1~357^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=838313846b9e07ff2600fc9dcf5f538ef5a4d611;p=dealii.git Make active_cell_index_partitioner to std::shared_ptr --- diff --git a/include/deal.II/distributed/tria_base.h b/include/deal.II/distributed/tria_base.h index e11f58764f..b9849799ac 100644 --- a/include/deal.II/distributed/tria_base.h +++ b/include/deal.II/distributed/tria_base.h @@ -206,14 +206,14 @@ namespace parallel * Return partitioner for the global indices of the cells on the active * level of the triangulation. */ - const Utilities::MPI::Partitioner & + const std::weak_ptr global_active_cell_index_partitioner() const; /** * Return partitioner for the global indices of the cells on the given @p * level of the triangulation. */ - const Utilities::MPI::Partitioner & + const std::weak_ptr global_level_cell_index_partitioner(const unsigned int level) const; /** @@ -356,12 +356,14 @@ namespace parallel /** * Partitioner for the global active cell indices. */ - Utilities::MPI::Partitioner active_cell_index_partitioner; + std::shared_ptr + active_cell_index_partitioner; /** * Partitioner for the global level cell indices for each level. */ - std::vector level_cell_index_partitioners; + std::vector> + level_cell_index_partitioners; NumberCache(); }; diff --git a/source/distributed/tria_base.cc b/source/distributed/tria_base.cc index b379bb8ffa..affa9847ae 100644 --- a/source/distributed/tria_base.cc +++ b/source/distributed/tria_base.cc @@ -443,7 +443,8 @@ namespace parallel 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); + std::make_shared( + is_local, is_ghost, this->mpi_communicator); // 6) proceed with multigrid levels if requested if (this->is_multilevel_hierarchy_constructed() == true) @@ -536,9 +537,8 @@ namespace parallel is_ghost_vector.end()); number_cache.level_cell_index_partitioners[l] = - Utilities::MPI::Partitioner(is_local, - is_ghost, - this->mpi_communicator); + std::make_shared( + is_local, is_ghost, this->mpi_communicator); } } @@ -598,14 +598,14 @@ namespace parallel template - const Utilities::MPI::Partitioner & + const std::weak_ptr TriangulationBase::global_active_cell_index_partitioner() const { return number_cache.active_cell_index_partitioner; } template - const Utilities::MPI::Partitioner & + const std::weak_ptr TriangulationBase::global_level_cell_index_partitioner( const unsigned int level) const { diff --git a/tests/grid/global_ids_01.cc b/tests/grid/global_ids_01.cc index a522b0674c..c02308510d 100644 --- a/tests/grid/global_ids_01.cc +++ b/tests/grid/global_ids_01.cc @@ -45,7 +45,8 @@ test(int n_refinements, MPI_Comm comm) deallog << cell->id() << " -> " << cell->subdomain_id() << " " << cell->global_active_cell_index() << std::endl; - const auto &part = tria.global_active_cell_index_partitioner(); + const Utilities::MPI::Partitioner &part = + *tria.global_active_cell_index_partitioner().lock(); part.locally_owned_range().print(deallog); part.ghost_indices().print(deallog); diff --git a/tests/grid/global_ids_03.cc b/tests/grid/global_ids_03.cc index 33b380d212..c7b7ddd9f9 100644 --- a/tests/grid/global_ids_03.cc +++ b/tests/grid/global_ids_03.cc @@ -52,7 +52,8 @@ test(int n_refinements, MPI_Comm comm) deallog << cell->id() << " -> " << cell->level_subdomain_id() << " " << cell->global_level_cell_index() << std::endl; - const auto &part = tria.global_level_cell_index_partitioner(l); + const Utilities::MPI::Partitioner &part = + *tria.global_level_cell_index_partitioner(l).lock(); part.locally_owned_range().print(deallog); part.ghost_indices().print(deallog);