]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make active_cell_index_partitioner to std::shared_ptr 11859/head
authorPeter Munch <peterrmuench@gmail.com>
Sat, 6 Mar 2021 08:39:40 +0000 (09:39 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Mon, 8 Mar 2021 21:42:58 +0000 (22:42 +0100)
include/deal.II/distributed/tria_base.h
source/distributed/tria_base.cc
tests/grid/global_ids_01.cc
tests/grid/global_ids_03.cc

index e11f58764fa19421514bb93fab26f2eb6710b1f7..b9849799acd67d733392ae9592002abb72b2188b 100644 (file)
@@ -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<const Utilities::MPI::Partitioner>
     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<const Utilities::MPI::Partitioner>
     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<const Utilities::MPI::Partitioner>
+        active_cell_index_partitioner;
 
       /**
        * Partitioner for the global level cell indices for each level.
        */
-      std::vector<Utilities::MPI::Partitioner> level_cell_index_partitioners;
+      std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
+        level_cell_index_partitioners;
 
       NumberCache();
     };
index b379bb8ffa27e5a6c68fcf4b685682c2a7793d3c..affa9847aea114764278eeb43f53861ac8a243ca 100644 (file)
@@ -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<const Utilities::MPI::Partitioner>(
+        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<const Utilities::MPI::Partitioner>(
+                is_local, is_ghost, this->mpi_communicator);
           }
       }
 
@@ -598,14 +598,14 @@ namespace parallel
 
 
   template <int dim, int spacedim>
-  const Utilities::MPI::Partitioner &
+  const std::weak_ptr<const Utilities::MPI::Partitioner>
   TriangulationBase<dim, spacedim>::global_active_cell_index_partitioner() const
   {
     return number_cache.active_cell_index_partitioner;
   }
 
   template <int dim, int spacedim>
-  const Utilities::MPI::Partitioner &
+  const std::weak_ptr<const Utilities::MPI::Partitioner>
   TriangulationBase<dim, spacedim>::global_level_cell_index_partitioner(
     const unsigned int level) const
   {
index a522b0674c95d74e1e34564386112ac8d246d13d..c02308510dd9d30a8a5fdb2bfb2c25af9e7feed6 100644 (file)
@@ -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);
index 33b380d21227293f9308e2a571f5f85cbdc62af7..c7b7ddd9f9b094879f7dd65f641bbfbbd10aeb72 100644 (file)
@@ -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);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.