From 3cfd89c5c778d9c40209456ce5c9d41813f7ea56 Mon Sep 17 00:00:00 2001 From: Quang Hoang Date: Fri, 8 Dec 2023 23:19:41 -0500 Subject: [PATCH] move exchange_refine_flags --- source/distributed/tria.cc | 66 +++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 33 deletions(-) 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)) -- 2.39.5