From: Peter Munch Date: Tue, 1 Jun 2021 20:34:57 +0000 (+0200) Subject: Simplify workflow of repartitioning X-Git-Tag: v9.4.0-rc1~1275^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2176b198ee7aed8f9fe08bd5b14ccf73ece40b4;p=dealii.git Simplify workflow of repartitioning Conflicts: source/grid/tria_description.cc --- diff --git a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h index a035af2fba..58ef8e9192 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -2357,26 +2357,13 @@ namespace MGTransferGlobalCoarseningTools else { // create triangulation description - TriangulationDescription::Description 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< diff --git a/source/distributed/repartitioning_policy_tools.cc b/source/distributed/repartitioning_policy_tools.cc index 264bfb6b26..d13b788d90 100644 --- a/source/distributed/repartitioning_policy_tools.cc +++ b/source/distributed/repartitioning_policy_tools.cc @@ -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; } diff --git a/source/grid/tria_description.cc b/source/grid/tria_description.cc index 6a86c6ecfb..31dd65a40b 100644 --- a/source/grid/tria_description.cc +++ b/source/grid/tria_description.cc @@ -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 relevant_processes = [&]() { std::set relevant_processes;