]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify workflow of repartitioning 12377/head
authorPeter Munch <peterrmuench@gmail.com>
Tue, 1 Jun 2021 20:34:57 +0000 (22:34 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Sat, 5 Jun 2021 03:56:20 +0000 (05:56 +0200)
Conflicts:
source/grid/tria_description.cc

include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h
source/distributed/repartitioning_policy_tools.cc
source/grid/tria_description.cc

index a035af2fbab76efc6f152457baf9bb0cc71bc5fa..58ef8e919215fff183e8bf51223e0f1f245a7a32 100644 (file)
@@ -2357,26 +2357,13 @@ namespace MGTransferGlobalCoarseningTools
     else
       {
         // create triangulation description
-        TriangulationDescription::Description<dim, spacedim> construction_data;
-
-        if (repartition_fine_triangulation == true)
-          {
-            const auto partition = policy.partition(*fine_triangulation);
-
-            construction_data =
-              (partition.size() == 0) ?
-                TriangulationDescription::Utilities::
-                  create_description_from_triangulation(*fine_triangulation,
-                                                        comm) :
-                construction_data = TriangulationDescription::Utilities::
-                  create_description_from_triangulation(*fine_triangulation,
-                                                        partition);
-          }
-        else
-          {
-            construction_data = TriangulationDescription::Utilities::
+        const auto construction_data =
+          repartition_fine_triangulation ?
+            TriangulationDescription::Utilities::
+              create_description_from_triangulation(
+                *fine_triangulation, policy.partition(*fine_triangulation)) :
+            TriangulationDescription::Utilities::
               create_description_from_triangulation(*fine_triangulation, comm);
-          }
 
         // create new triangulation
         const auto new_fine_triangulation = std::make_shared<
@@ -2411,19 +2398,10 @@ namespace MGTransferGlobalCoarseningTools
         // coarsen mesh
         temp_triangulation_ptr->coarsen_global();
 
-        // perform partition
-        const auto partition = policy.partition(*temp_triangulation_ptr);
-        partition.update_ghost_values();
-
         // create triangulation description
-        const auto construction_data =
-          partition.size() == 0 ?
-            TriangulationDescription::Utilities::
-              create_description_from_triangulation(*temp_triangulation_ptr,
-                                                    comm) :
-            TriangulationDescription::Utilities::
-              create_description_from_triangulation(*temp_triangulation_ptr,
-                                                    partition);
+        const auto construction_data = TriangulationDescription::Utilities::
+          create_description_from_triangulation(
+            *temp_triangulation_ptr, policy.partition(*temp_triangulation_ptr));
 
         // create new triangulation
         const auto level_triangulation = std::make_shared<
index 264bfb6b26f01e2320cdca86d88f274f9bb2a1f9..d13b788d9043555f49dd9a2b1e052ae6104f02cb 100644 (file)
@@ -152,8 +152,6 @@ namespace RepartitioningPolicyTools
           owning_ranks_of_coarse_cells[is_coarse.index_within_set(
             cell_id_translator.translate(cell))];
 
-    partition.update_ghost_values();
-
     return partition;
   }
 
@@ -219,8 +217,6 @@ namespace RepartitioningPolicyTools
     for (const auto i : partition.locally_owned_elements())
       partition[i] = convert(i);
 
-    partition.update_ghost_values();
-
     return partition;
   }
 
index 6a86c6ecfb68702b8c27e3265ca017a15ffbc0e6..31dd65a40b316e629e293cda449c8593e90227f7 100644 (file)
@@ -750,6 +750,12 @@ namespace TriangulationDescription
         AssertDimension(partition.local_size(), 0);
 #endif
 
+      if (partition.size() == 0)
+        return create_description_from_triangulation(tria,
+                                                     tria.get_communicator());
+
+      partition.update_ghost_values();
+
       // 1) determine processes owning locally owned cells
       const std::vector<unsigned int> relevant_processes = [&]() {
         std::set<unsigned int> relevant_processes;

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.