]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move `TemporarilyMatchRefineFlags` out of `internal` namespace. 12154/head
authorMarc Fehling <mafehling.git@gmail.com>
Thu, 6 May 2021 21:35:23 +0000 (15:35 -0600)
committerMarc Fehling <mafehling.git@gmail.com>
Thu, 6 May 2021 22:15:31 +0000 (16:15 -0600)
include/deal.II/distributed/tria.h
source/distributed/tria.cc
source/distributed/tria.inst.in
tests/mpi/error_prediction_01.cc
tests/mpi/error_prediction_02.cc
tests/mpi/limit_p_level_difference_01.cc
tests/mpi/limit_p_level_difference_02.cc
tests/mpi/limit_p_level_difference_03.cc
tests/mpi/limit_p_level_difference_04.cc

index 7b42ed3535d64ea4979e7fe1bcaa786047f1a0ff..4ba19b13fc426717e842322e741bc816be86c931 100644 (file)
@@ -74,17 +74,14 @@ namespace GridTools
   struct PeriodicFacePair;
 }
 
-namespace internal
+namespace parallel
 {
-  namespace parallel
+  namespace distributed
   {
-    namespace distributed
-    {
-      template <int, int>
-      class TemporarilyMatchRefineFlags;
-    }
-  } // namespace parallel
-} // namespace internal
+    template <int, int>
+    class TemporarilyMatchRefineFlags;
+  }
+} // namespace parallel
 #  endif
 
 namespace parallel
@@ -817,8 +814,7 @@ namespace parallel
       friend class dealii::FETools::internal::ExtrapolateImplementation;
 
       template <int, int>
-      friend class dealii::internal::parallel::distributed::
-        TemporarilyMatchRefineFlags;
+      friend class TemporarilyMatchRefineFlags;
     };
 
 
@@ -928,8 +924,7 @@ namespace parallel
         const unsigned int coarse_cell_index) const override;
 
       template <int, int>
-      friend class dealii::internal::parallel::distributed::
-        TemporarilyMatchRefineFlags;
+      friend class TemporarilyMatchRefineFlags;
     };
   } // namespace distributed
 } // namespace parallel
@@ -1021,73 +1016,70 @@ namespace parallel
 #endif
 
 
-namespace internal
+namespace parallel
 {
-  namespace parallel
+  namespace distributed
   {
-    namespace distributed
+    /**
+     * This class temporarily modifies the refine and coarsen flags of all
+     * active cells to match the p4est oracle.
+     *
+     * The modification only happens on parallel::distributed::Triangulation
+     * objects, and persists for the lifetime of an instantiation of this
+     * class.
+     *
+     * The TemporarilyMatchRefineFlags class should only be used in
+     * combination with the Triangulation::Signals::post_p4est_refinement
+     * signal. At this stage, the p4est orcale already has been refined, but
+     * the triangulation is still unchanged. After the modification, all
+     * refine and coarsen flags describe how the traingulation will acutally
+     * be refined.
+     */
+    template <int dim, int spacedim = dim>
+    class TemporarilyMatchRefineFlags : public Subscriptor
     {
+    public:
       /**
-       * This class temporarily modifies the refine and coarsen flags of all
-       * active cells to match the p4est oracle.
+       * Constructor.
        *
-       * The modification only happens on parallel::distributed::Triangulation
-       * objects, and persists for the lifetime of an instantiation of this
-       * class.
+       * Stores the refine and coarsen flags of all active cells if the
+       * provided Triangulation is of type
+       * parallel::distributed::Triangulation.
        *
-       * The TemporarilyMatchRefineFlags class should only be used in
-       * combination with the Triangulation::Signals::post_p4est_refinement
-       * signal. At this stage, the p4est orcale already has been refined, but
-       * the triangulation is still unchanged. After the modification, all
-       * refine and coarsen flags describe how the traingulation will acutally
-       * be refined.
+       * Adjusts them to be consistent with the p4est oracle.
        */
-      template <int dim, int spacedim = dim>
-      class TemporarilyMatchRefineFlags : public Subscriptor
-      {
-      public:
-        /**
-         * Constructor.
-         *
-         * Stores the refine and coarsen flags of all active cells if the
-         * provided Triangulation is of type
-         * parallel::distributed::Triangulation.
-         *
-         * Adjusts them to be consistent with the p4est oracle.
-         */
-        TemporarilyMatchRefineFlags(Triangulation<dim, spacedim> &tria);
+      TemporarilyMatchRefineFlags(dealii::Triangulation<dim, spacedim> &tria);
 
-        /**
-         * Destructor.
-         *
-         * Returns the refine and coarsen flags of all active cells on the
-         * parallel::distributed::Triangulation into their previous state.
-         */
-        ~TemporarilyMatchRefineFlags();
+      /**
+       * Destructor.
+       *
+       * Returns the refine and coarsen flags of all active cells on the
+       * parallel::distributed::Triangulation into their previous state.
+       */
+      ~TemporarilyMatchRefineFlags();
 
-      private:
-        /**
-         * The modified parallel::distributed::Triangulation.
-         */
-        const SmartPointer<
-          dealii::parallel::distributed::Triangulation<dim, spacedim>>
-          distributed_tria;
+    private:
+      /**
+       * The modified parallel::distributed::Triangulation.
+       */
+      const SmartPointer<
+        dealii::parallel::distributed::Triangulation<dim, spacedim>>
+        distributed_tria;
 
-        /**
-         * A vector that temporarily stores the refine flags before they have
-         * been modified on the parallel::distributed::Triangulation.
-         */
-        std::vector<bool> saved_refine_flags;
+      /**
+       * A vector that temporarily stores the refine flags before they have
+       * been modified on the parallel::distributed::Triangulation.
+       */
+      std::vector<bool> saved_refine_flags;
 
-        /**
-         * A vector that temporarily stores the coarsen flags before they have
-         * been modified on the parallel::distributed::Triangulation.
-         */
-        std::vector<bool> saved_coarsen_flags;
-      };
-    } // namespace distributed
-  }   // namespace parallel
-} // namespace internal
+      /**
+       * A vector that temporarily stores the coarsen flags before they have
+       * been modified on the parallel::distributed::Triangulation.
+       */
+      std::vector<bool> saved_coarsen_flags;
+    };
+  } // namespace distributed
+} // namespace parallel
 
 
 DEAL_II_NAMESPACE_CLOSE
index e5a70ac970cb017a791342e8d28ef44269e4c04d..bd5130cc60a282c50c21d1c523300049bc2349d5 100644 (file)
@@ -3563,89 +3563,86 @@ namespace parallel
 
 
 
-namespace internal
+namespace parallel
 {
-  namespace parallel
+  namespace distributed
   {
-    namespace distributed
+    template <int dim, int spacedim>
+    TemporarilyMatchRefineFlags<dim, spacedim>::TemporarilyMatchRefineFlags(
+      dealii::Triangulation<dim, spacedim> &tria)
+      : distributed_tria(
+          dynamic_cast<
+            dealii::parallel::distributed::Triangulation<dim, spacedim> *>(
+            &tria))
     {
-      template <int dim, int spacedim>
-      TemporarilyMatchRefineFlags<dim, spacedim>::TemporarilyMatchRefineFlags(
-        Triangulation<dim, spacedim> &tria)
-        : distributed_tria(
-            dynamic_cast<
-              dealii::parallel::distributed::Triangulation<dim, spacedim> *>(
-              &tria))
-      {
 #ifdef DEAL_II_WITH_P4EST
-        if (distributed_tria != nullptr)
-          {
-            // Save the current set of refinement flags, and adjust the
-            // refinement flags to be consistent with the p4est oracle.
-            distributed_tria->save_coarsen_flags(saved_coarsen_flags);
-            distributed_tria->save_refine_flags(saved_refine_flags);
+      if (distributed_tria != nullptr)
+        {
+          // Save the current set of refinement flags, and adjust the
+          // refinement flags to be consistent with the p4est oracle.
+          distributed_tria->save_coarsen_flags(saved_coarsen_flags);
+          distributed_tria->save_refine_flags(saved_refine_flags);
 
-            for (const auto &pair : distributed_tria->local_cell_relations)
-              {
-                const auto &cell   = pair.first;
-                const auto &status = pair.second;
+          for (const auto &pair : distributed_tria->local_cell_relations)
+            {
+              const auto &cell   = pair.first;
+              const auto &status = pair.second;
 
-                switch (status)
-                  {
-                    case dealii::Triangulation<dim, spacedim>::CELL_PERSIST:
-                      // cell remains unchanged
-                      cell->clear_refine_flag();
-                      cell->clear_coarsen_flag();
-                      break;
+              switch (status)
+                {
+                  case dealii::Triangulation<dim, spacedim>::CELL_PERSIST:
+                    // cell remains unchanged
+                    cell->clear_refine_flag();
+                    cell->clear_coarsen_flag();
+                    break;
 
-                    case dealii::Triangulation<dim, spacedim>::CELL_REFINE:
-                      // cell will be refined
-                      cell->clear_coarsen_flag();
-                      cell->set_refine_flag();
-                      break;
+                  case dealii::Triangulation<dim, spacedim>::CELL_REFINE:
+                    // cell will be refined
+                    cell->clear_coarsen_flag();
+                    cell->set_refine_flag();
+                    break;
 
-                    case dealii::Triangulation<dim, spacedim>::CELL_COARSEN:
-                      // children of this cell will be coarsened
-                      for (const auto &child : cell->child_iterators())
-                        {
-                          child->clear_refine_flag();
-                          child->set_coarsen_flag();
-                        }
-                      break;
+                  case dealii::Triangulation<dim, spacedim>::CELL_COARSEN:
+                    // children of this cell will be coarsened
+                    for (const auto &child : cell->child_iterators())
+                      {
+                        child->clear_refine_flag();
+                        child->set_coarsen_flag();
+                      }
+                    break;
 
-                    case dealii::Triangulation<dim, spacedim>::CELL_INVALID:
-                      // do nothing as cell does not exist yet
-                      break;
+                  case dealii::Triangulation<dim, spacedim>::CELL_INVALID:
+                    // do nothing as cell does not exist yet
+                    break;
 
-                    default:
-                      Assert(false, ExcInternalError());
-                      break;
-                  }
-              }
-          }
+                  default:
+                    Assert(false, ExcInternalError());
+                    break;
+                }
+            }
+        }
 #endif
-      }
+    }
 
 
 
-      template <int dim, int spacedim>
-      TemporarilyMatchRefineFlags<dim, spacedim>::~TemporarilyMatchRefineFlags()
-      {
+    template <int dim, int spacedim>
+    TemporarilyMatchRefineFlags<dim, spacedim>::~TemporarilyMatchRefineFlags()
+    {
 #ifdef DEAL_II_WITH_P4EST
-        if (distributed_tria)
-          {
-            // Undo the refinement flags modification.
-            distributed_tria->load_coarsen_flags(saved_coarsen_flags);
-            distributed_tria->load_refine_flags(saved_refine_flags);
-          }
+      if (distributed_tria)
+        {
+          // Undo the refinement flags modification.
+          distributed_tria->load_coarsen_flags(saved_coarsen_flags);
+          distributed_tria->load_refine_flags(saved_refine_flags);
+        }
 #else
-        // pretend that this destructor does something to silence clang-tidy
-        (void)distributed_tria;
+      // pretend that this destructor does something to silence clang-tidy
+      (void)distributed_tria;
 #endif
-      }
-    } // namespace distributed
-  }   // namespace parallel
-} // namespace internal
+    }
+  } // namespace distributed
+} // namespace parallel
 
 
 
index c0e43213581830c77a083dd936182798992b13c6..cab8c501a96079ca8d878a9edb7157f8d2144112 100644 (file)
@@ -24,21 +24,10 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
 #if deal_II_dimension <= deal_II_space_dimension
         template class Triangulation<deal_II_dimension,
                                      deal_II_space_dimension>;
-#endif
-      \}
-    \}
 
-    namespace internal
-    \{
-      namespace parallel
-      \{
-        namespace distributed
-        \{
-#if deal_II_dimension <= deal_II_space_dimension
-          template class TemporarilyMatchRefineFlags<deal_II_dimension,
-                                                     deal_II_space_dimension>;
+        template class TemporarilyMatchRefineFlags<deal_II_dimension,
+                                                   deal_II_space_dimension>;
 #endif
-        \}
       \}
     \}
   }
index 4b692b25ccd3463a9c45417d4b41ee584e696f0a..3548fcc78c188a1abf2ca64fef75c08cde488a6e 100644 (file)
@@ -87,7 +87,7 @@ test()
   // ----- connect error predictor -----
   Vector<float> predicted_errors;
   tria.signals.post_p4est_refinement.connect([&]() {
-    const internal::parallel::distributed::TemporarilyMatchRefineFlags<dim>
+    const parallel::distributed::TemporarilyMatchRefineFlags<dim>
       refine_modifier(tria);
     predicted_errors.reinit(tria.n_active_cells());
     hp::Refinement::predict_error(dh,
index e999db84ce923eb3cfd886a30bb0d4f74e8f1183..d0b4c48f8faba7d473271f43bdfcb4c5f6babb39 100644 (file)
@@ -113,7 +113,7 @@ test()
   // ----- connect error predictor -----
   Vector<float> predicted_errors;
   tria.signals.post_p4est_refinement.connect([&]() {
-    const internal::parallel::distributed::TemporarilyMatchRefineFlags<dim>
+    const parallel::distributed::TemporarilyMatchRefineFlags<dim>
       refine_modifier(tria);
     predicted_errors.reinit(tria.n_active_cells());
     hp::Refinement::predict_error(dh,
index 75e563125a90647574a46859890ff2ff769eb926..1b6504203bdd78e5af3f8be0292cbdb7144bec87 100644 (file)
@@ -78,7 +78,7 @@ test(const unsigned int fes_size, const unsigned int max_difference)
   bool fe_indices_changed = false;
   tria.signals.post_p4est_refinement.connect(
     [&]() {
-      const internal::parallel::distributed::TemporarilyMatchRefineFlags<dim>
+      const parallel::distributed::TemporarilyMatchRefineFlags<dim>
         refine_modifier(tria);
       fe_indices_changed =
         hp::Refinement::limit_p_level_difference(dofh,
index 81ce6a40979f9b0564680ba1d6eac765525c5dd2..929b7d763259644dc87483672af39a3c53e024ba 100644 (file)
@@ -73,7 +73,7 @@ test(const unsigned int fes_size, const unsigned int max_difference)
   bool fe_indices_changed;
   tria.signals.post_p4est_refinement.connect(
     [&]() {
-      const internal::parallel::distributed::TemporarilyMatchRefineFlags<dim>
+      const parallel::distributed::TemporarilyMatchRefineFlags<dim>
         refine_modifier(tria);
       fe_indices_changed =
         hp::Refinement::limit_p_level_difference(dofh,
index 39ef65dc4bdd58a8fd4a951c517451152d897ccd..97424e75e6f310993e0876c276bfa28274c84da6 100644 (file)
@@ -93,7 +93,7 @@ test(const unsigned int fes_size, const unsigned int max_difference)
   bool fe_indices_changed = false;
   tria.signals.post_p4est_refinement.connect(
     [&]() {
-      const internal::parallel::distributed::TemporarilyMatchRefineFlags<dim>
+      const parallel::distributed::TemporarilyMatchRefineFlags<dim>
         refine_modifier(tria);
       fe_indices_changed =
         hp::Refinement::limit_p_level_difference(dofh,
index 8fcf54bfb955699b71a0c87faed1579700bbabf8..4904a9f638554e7f6d4921f8a91be7aee1e1123a 100644 (file)
@@ -85,7 +85,7 @@ test(const unsigned int max_difference)
   bool fe_indices_changed = false;
   tria.signals.post_p4est_refinement.connect(
     [&]() {
-      const internal::parallel::distributed::TemporarilyMatchRefineFlags<dim>
+      const parallel::distributed::TemporarilyMatchRefineFlags<dim>
         refine_modifier(tria);
       fe_indices_changed =
         hp::Refinement::limit_p_level_difference(dofh,

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.