From: Quang Hoang Date: Sat, 9 Dec 2023 04:19:41 +0000 (-0500) Subject: move exchange_refine_flags X-Git-Tag: relicensing~164^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3cfd89c5c778d9c40209456ce5c9d41813f7ea56;p=dealii.git move exchange_refine_flags --- diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index 3bf950faca..5bed5a4fd8 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -564,7 +564,39 @@ 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 @@ -3245,39 +3277,7 @@ namespace parallel } - 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); - } + template DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim))