]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move exchange_refinement_flags into internal namespace.
authorMarc Fehling <mafehling.git@gmail.com>
Tue, 21 May 2024 14:48:20 +0000 (16:48 +0200)
committerMarc Fehling <mafehling.git@gmail.com>
Tue, 21 May 2024 14:48:20 +0000 (16:48 +0200)
include/deal.II/distributed/tria.h
source/distributed/tria.cc
source/distributed/tria.inst.in

index fd9e5c5825a254caab07090bc541c3167e0afd47..f9640b3b98325f25d4933a1379f92061757c142c 100644 (file)
 
 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 <int dim, int spacedim>
+        void
+        exchange_refinement_flags(
+          dealii::parallel::distributed::Triangulation<dim, spacedim> &);
+      }
+    } // 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
index e645050a93a94f833fa6e9c9329ee3064fa6e643..6f87521425724a0e977d54d3de22f312e580e1a7 100644 (file)
 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 <int dim, int spacedim>
+        void
+        exchange_refinement_flags(
+          dealii::parallel::distributed::Triangulation<dim, spacedim> &tria)
+        {
+          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>(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 <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>
@@ -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:
index d79045601f7de24e3410f9fa24d1ab0d59436c34..d41f5b0283d8e58df397659be527972b48d2b9ee 100644 (file)
@@ -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<deal_II_dimension, deal_II_space_dimension> &);
+#endif
+          \}
+        \}
+      \}
+    \}
   }

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.