From: Marc Fehling Date: Sat, 20 Mar 2021 21:33:16 +0000 (-0600) Subject: Copy triangulation in MGTransferGlobalCoarsening. X-Git-Tag: v9.3.0-rc1~288^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11948%2Fhead;p=dealii.git Copy triangulation in MGTransferGlobalCoarsening. --- 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 9baebafd6e..35113b1462 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -1914,30 +1914,6 @@ namespace MGTransferGlobalCoarseningTools } - namespace internal - { - template - void - load_forest(const parallel::distributed::Triangulation &in, - parallel::distributed::Triangulation & out) - { -#ifndef DEAL_II_WITH_P4EST - (void)in; - (void)out; -#else - out.load(in.get_p4est()); -#endif - } - - template - void - load_forest(const parallel::distributed::Triangulation<1, spacedim> &in, - parallel::distributed::Triangulation<1, spacedim> & out) - { - (void)in; - (void)out; - } - } // namespace internal template std::vector>> @@ -1967,33 +1943,16 @@ namespace MGTransferGlobalCoarseningTools const unsigned int max_level = fine_triangulation->n_global_levels() - 1; - const auto coarse_mesh_description = - GridTools::get_coarse_mesh_description(*fine_triangulation); - // create coarse meshes for (unsigned int l = max_level; l > 0; --l) { - // create empty triangulation + // copy triangulation auto new_tria = std::make_shared>( fine_triangulation->get_communicator(), fine_triangulation->get_mesh_smoothing()); - // create coarse grid - new_tria->create_triangulation(std::get<0>(coarse_mesh_description), - std::get<1>(coarse_mesh_description), - std::get<2>(coarse_mesh_description)); - - for (const auto i : fine_triangulation->get_manifold_ids()) - if (i != numbers::flat_manifold_id) - new_tria->set_manifold(i, fine_triangulation->get_manifold(i)); - - // create refinement hierarchy (by loading stored mesh) - internal::load_forest( - *dynamic_cast< - const parallel::distributed::Triangulation *>( - coarse_grid_triangulations[l].get()), - *new_tria); + new_tria->copy_triangulation(*coarse_grid_triangulations[l]); // coarsen mesh new_tria->coarsen_global();