From: Peter Munch <peterrmuench@gmail.com>
Date: Wed, 4 Nov 2020 09:20:34 +0000 (+0100)
Subject: Add internal::TriangulationImplementation::ImplementationMixedMesh
X-Git-Tag: v9.3.0-rc1~930^2
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11141%2Fhead;p=dealii.git

Add internal::TriangulationImplementation::ImplementationMixedMesh
---

diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h
index 5a8efeeb31..2a57871fe6 100644
--- a/include/deal.II/grid/tria.h
+++ b/include/deal.II/grid/tria.h
@@ -99,6 +99,7 @@ namespace internal
      * information.
      */
     struct Implementation;
+    struct ImplementationMixedMesh;
   } // namespace TriangulationImplementation
 
   namespace TriaAccessorImplementation
@@ -4025,6 +4026,8 @@ private:
   friend class hp::DoFHandler<dim, spacedim>;
 
   friend struct dealii::internal::TriangulationImplementation::Implementation;
+  friend struct dealii::internal::TriangulationImplementation::
+    ImplementationMixedMesh;
 
   friend class dealii::internal::TriangulationImplementation::TriaObjects;
 
diff --git a/source/grid/tria.cc b/source/grid/tria.cc
index 5912648524..68778d1a82 100644
--- a/source/grid/tria.cc
+++ b/source/grid/tria.cc
@@ -9354,6 +9354,68 @@ namespace internal
     };
 
 
+    /**
+     * Same as above but for mixed meshes (and simplex meshes).
+     */
+    struct ImplementationMixedMesh
+    {
+      template <int dim, int spacedim>
+      static void
+      delete_children(
+        Triangulation<dim, spacedim> &                        triangulation,
+        typename Triangulation<dim, spacedim>::cell_iterator &cell,
+        std::vector<unsigned int> &                           line_cell_count,
+        std::vector<unsigned int> &                           quad_cell_count)
+      {
+        AssertThrow(false, ExcNotImplemented());
+        (void)triangulation;
+        (void)cell;
+        (void)line_cell_count;
+        (void)quad_cell_count;
+      }
+
+      template <int dim, int spacedim>
+      static typename Triangulation<dim, spacedim>::DistortedCellList
+      execute_refinement(Triangulation<dim, spacedim> &triangulation,
+                         const bool check_for_distorted_cells)
+      {
+        AssertThrow(false, ExcNotImplemented());
+        (void)triangulation;
+        (void)check_for_distorted_cells;
+
+        return {};
+      }
+
+      template <int dim, int spacedim>
+      static void
+      prevent_distorted_boundary_cells(
+        Triangulation<dim, spacedim> &triangulation)
+      {
+        AssertThrow(false, ExcNotImplemented());
+        (void)triangulation;
+      }
+
+      template <int dim, int spacedim>
+      static void
+      prepare_refinement_dim_dependent(
+        Triangulation<dim, spacedim> &triangulation)
+      {
+        AssertThrow(false, ExcNotImplemented());
+        (void)triangulation;
+      }
+
+      template <int dim, int spacedim>
+      static bool
+      coarsening_allowed(
+        const typename Triangulation<dim, spacedim>::cell_iterator &cell)
+      {
+        AssertThrow(false, ExcNotImplemented());
+        (void)cell;
+
+        return false;
+      }
+    };
+
 
     template <int dim, int spacedim>
     const Manifold<dim, spacedim> &
@@ -9795,12 +9857,6 @@ Triangulation<dim, spacedim>::create_triangulation(
   // are used
   Assert(subcelldata.check_consistency(dim), ExcInternalError());
 
-  this->policy =
-    std::make_unique<internal::TriangulationImplementation::PolicyWrapper<
-      dim,
-      spacedim,
-      internal::TriangulationImplementation::Implementation>>();
-
   // try to create a triangulation; if this fails, we still want to
   // throw an exception but if we just do so we'll get into trouble
   // because sometimes other objects are already attached to it:
@@ -9810,12 +9866,6 @@ Triangulation<dim, spacedim>::create_triangulation(
         create_triangulation(v, cells, subcelldata, *this);
 
       this->update_reference_cell_types();
-
-#ifndef DEAL_II_WITH_SIMPLEX_SUPPORT
-      Assert(this->all_reference_cell_types_are_hyper_cube(),
-             ExcMessage(
-               "A cell with invalid number of vertices has been provided."));
-#endif
     }
   catch (...)
     {
@@ -9823,6 +9873,27 @@ Triangulation<dim, spacedim>::create_triangulation(
       throw;
     }
 
+  if (this->all_reference_cell_types_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>>();
+    }
+
   // update our counts of the various elements of a triangulation, and set
   // active_cell_indices of all cells
   internal::TriangulationImplementation::Implementation::compute_number_cache(