]> https://gitweb.dealii.org/ - dealii.git/commitdiff
move exchange_refine_flags
authorQuang Hoang <qxhmorrow@gmail.com>
Sat, 9 Dec 2023 04:19:41 +0000 (23:19 -0500)
committerQuang Hoang <qxhmorrow@gmail.com>
Sat, 9 Dec 2023 04:19:41 +0000 (23:19 -0500)
source/distributed/tria.cc

index 3bf950facaa9f0e52e01733c82cb96f0c5d205ec..5bed5a4fd87057f58788f04deae18a4aeea605b2 100644 (file)
@@ -564,7 +564,39 @@ namespace
         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>
@@ -3245,39 +3277,7 @@ namespace parallel
     }
 
 
-    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>))

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.