]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Reset policy during Triangulation::load() 11983/head
authorPeter Munch <peterrmuench@gmail.com>
Tue, 30 Mar 2021 15:29:49 +0000 (17:29 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Tue, 30 Mar 2021 15:29:49 +0000 (17:29 +0200)
include/deal.II/grid/tria.h
source/grid/tria.cc
tests/serialization/triangulation_02.cc

index 8b9c753406b727cb79897dc53489e20b15d1f613..4bdb4fac7a2755992e992664a8b1c794d564bba9 100644 (file)
@@ -3866,6 +3866,12 @@ private:
   void
   clear_despite_subscriptions();
 
+  /**
+   * Reset triangulation policy.
+   */
+  void
+  reset_policy();
+
   /**
    * For all cells, set the active cell indices so that active cells know the
    * how many-th active cell they are, and all other cells have an invalid
@@ -4243,6 +4249,7 @@ Triangulation<dim, spacedim>::load(Archive &ar, const unsigned int)
     reset_global_cell_indices();
   }
 
+  reset_policy();
 
   bool my_check_for_distorted_cells;
   ar & my_check_for_distorted_cells;
index 129d57cfb84a889821e5d22f6130fedaa462f038..10f106a297b460cc997821fecfce1bc6220d5f92 100644 (file)
@@ -10486,6 +10486,35 @@ Triangulation<dim, spacedim>::create_triangulation_compatibility(
 }
 
 
+template <int dim, int spacedim>
+void
+Triangulation<dim, spacedim>::reset_policy()
+{
+  this->update_reference_cells();
+
+  if (this->all_reference_cells_are_hyper_cube())
+    {
+      this->policy =
+        std::make_unique<internal::TriangulationImplementation::PolicyWrapper<
+          dim,
+          spacedim,
+          internal::TriangulationImplementation::Implementation>>();
+    }
+  else
+    {
+#ifndef DEAL_II_WITH_SIMPLEX_SUPPORT
+      Assert(false, ExcNeedsSimplexSupport());
+#endif
+
+      this->policy =
+        std::make_unique<internal::TriangulationImplementation::PolicyWrapper<
+          dim,
+          spacedim,
+          internal::TriangulationImplementation::ImplementationMixedMesh>>();
+    }
+}
+
+
 
 template <int dim, int spacedim>
 void
@@ -10507,8 +10536,6 @@ Triangulation<dim, spacedim>::create_triangulation(
     {
       internal::TriangulationImplementation::Implementation::
         create_triangulation(v, cells, subcelldata, *this);
-
-      this->update_reference_cells();
     }
   catch (...)
     {
@@ -10516,26 +10543,7 @@ Triangulation<dim, spacedim>::create_triangulation(
       throw;
     }
 
-  if (this->all_reference_cells_are_hyper_cube())
-    {
-      this->policy =
-        std::make_unique<internal::TriangulationImplementation::PolicyWrapper<
-          dim,
-          spacedim,
-          internal::TriangulationImplementation::Implementation>>();
-    }
-  else
-    {
-#ifndef DEAL_II_WITH_SIMPLEX_SUPPORT
-      Assert(false, ExcNeedsSimplexSupport());
-#endif
-
-      this->policy =
-        std::make_unique<internal::TriangulationImplementation::PolicyWrapper<
-          dim,
-          spacedim,
-          internal::TriangulationImplementation::ImplementationMixedMesh>>();
-    }
+  reset_policy();
 
   // update our counts of the various elements of a triangulation, and set
   // active_cell_indices of all cells
index 90457a41356ff2cafb2338d877ad3db30f77acbf..a78b10ee7578755bb235241da45ce2aef27d0935 100644 (file)
@@ -169,6 +169,11 @@ test()
   do_boundary(tria_1);
 
   verify(tria_1, tria_2);
+
+  // test if the policy has been set
+  tria_2.begin_active()->set_refine_flag();
+  tria_2.prepare_coarsening_and_refinement();
+  tria_2.execute_coarsening_and_refinement();
 }
 
 

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.