cell->set_subdomain_id(ghost_owner);
}
}
+ template <int dim, int spacedim>
+ void
+ exchange_refinement_flags(Triangulation<dim, spacedim> &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<dim, spacedim>::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<dim, spacedim>::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<std::uint8_t,
+ Triangulation<dim, spacedim>>(
+ tria, pack, unpack);
+ }
# ifdef P4EST_SEARCH_LOCAL
template <int dim>
}
- template <int dim, int spacedim>
- void
- exchange_refinement_flags(Triangulation<dim, spacedim> &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<dim, spacedim>::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<dim, spacedim>::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<std::uint8_t,
- Triangulation<dim, spacedim>>(
- tria, pack, unpack);
- }
+
template <int dim, int spacedim>
DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))