From: Marc Fehling Date: Tue, 21 May 2024 14:48:20 +0000 (+0200) Subject: Move exchange_refinement_flags into internal namespace. X-Git-Tag: v9.6.0-rc1~233^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=760edce62b8cbbb0712e873b136632376dbd8a2f;p=dealii.git Move exchange_refinement_flags into internal namespace. --- diff --git a/include/deal.II/distributed/tria.h b/include/deal.II/distributed/tria.h index fd9e5c5825..f9640b3b98 100644 --- a/include/deal.II/distributed/tria.h +++ b/include/deal.II/distributed/tria.h @@ -48,10 +48,8 @@ DEAL_II_NAMESPACE_OPEN -#ifdef DEAL_II_WITH_P4EST - // Forward declarations -# ifndef DOXYGEN +#ifndef DOXYGEN namespace FETools { @@ -77,7 +75,28 @@ namespace parallel class TemporarilyMatchRefineFlags; } } // namespace parallel -# endif + +namespace internal +{ + namespace parallel + { + namespace distributed + { + namespace TriangulationImplementation + { + template + void + exchange_refinement_flags( + dealii::parallel::distributed::Triangulation &); + } + } // namespace distributed + } // namespace parallel +} // namespace internal +#endif + + + +#ifdef DEAL_II_WITH_P4EST namespace parallel { @@ -1096,6 +1115,7 @@ namespace parallel #endif + namespace parallel { namespace distributed diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index e645050a93..6f87521425 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -36,6 +36,59 @@ DEAL_II_NAMESPACE_OPEN +namespace internal +{ + namespace parallel + { + namespace distributed + { + namespace TriangulationImplementation + { + /** + * Communicate refinement flags on ghost cells from the owner of the + * cell. + * + * This is necessary to get consistent refinement, as mesh smoothing + * would undo some of the requested coarsening/refinement. + */ + template + void + exchange_refinement_flags( + dealii::parallel::distributed::Triangulation &tria) + { + auto pack = + [](const typename Triangulation::active_cell_iterator + &cell) -> std::uint8_t { + if (cell->refine_flag_set()) + return 1; + if (cell->coarsen_flag_set()) + return 2; + return 0; + }; + + auto unpack = + [](const typename Triangulation::active_cell_iterator + &cell, + const std::uint8_t &flag) -> void { + cell->clear_coarsen_flag(); + cell->clear_refine_flag(); + if (flag == 1) + cell->set_refine_flag(); + else if (flag == 2) + cell->set_coarsen_flag(); + }; + + GridTools::exchange_cell_data_to_ghosts(tria, + pack, + unpack); + } + } // namespace TriangulationImplementation + } // namespace distributed + } // namespace parallel +} // namespace internal + + + #ifdef DEAL_II_WITH_P4EST namespace @@ -563,40 +616,6 @@ namespace cell->set_subdomain_id(ghost_owner); } } - template - void - exchange_refinement_flags(Triangulation &tria) - { - // Communicate refinement flags on ghost cells from the owner of the - // cell. This is necessary to get consistent refinement, as mesh - // smoothing would undo some of the requested coarsening/refinement. - - auto pack = - []( - const typename Triangulation::active_cell_iterator &cell) - -> std::uint8_t { - if (cell->refine_flag_set()) - return 1; - if (cell->coarsen_flag_set()) - return 2; - return 0; - }; - auto unpack = - []( - const typename Triangulation::active_cell_iterator &cell, - const std::uint8_t &flag) -> void { - cell->clear_coarsen_flag(); - cell->clear_refine_flag(); - if (flag == 1) - cell->set_refine_flag(); - else if (flag == 2) - cell->set_coarsen_flag(); - }; - - GridTools::exchange_cell_data_to_ghosts>( - tria, pack, unpack); - } # ifdef P4EST_SEARCH_LOCAL template @@ -2776,7 +2795,8 @@ namespace parallel // First exchange coarsen/refinement flags on ghost cells. After this // collective communication call all flags on ghost cells match the // flags set by the user on the owning rank. - exchange_refinement_flags(*this); + dealii::internal::parallel::distributed::TriangulationImplementation:: + exchange_refinement_flags(*this); // Now we can call the sequential version to apply mesh smoothing and // other modifications: diff --git a/source/distributed/tria.inst.in b/source/distributed/tria.inst.in index d79045601f..d41f5b0283 100644 --- a/source/distributed/tria.inst.in +++ b/source/distributed/tria.inst.in @@ -29,4 +29,23 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) #endif \} \} + + namespace internal + \{ + namespace parallel + \{ + namespace distributed + \{ + namespace TriangulationImplementation + \{ +#if deal_II_dimension <= deal_II_space_dimension + template void + exchange_refinement_flags( + dealii::parallel::distributed:: + Triangulation &); +#endif + \} + \} + \} + \} }