]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move make_triangulation into ReferenceCell::Type 11642/head
authorPeter Munch <peterrmuench@gmail.com>
Thu, 28 Jan 2021 12:50:46 +0000 (13:50 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Thu, 28 Jan 2021 12:50:46 +0000 (13:50 +0100)
include/deal.II/fe/fe_tools.templates.h
include/deal.II/grid/reference_cell.h
source/grid/reference_cell.cc
source/grid/reference_cell.inst.in
tests/simplex/orientation_02.cc

index 4e3edf8a9274d875a8ccfa8f4807e0ac7f49c04f..eb13a193d4865f61ed2a0af1675fd59f0a4ac54b 100644 (file)
@@ -1605,7 +1605,7 @@ namespace FETools
 
     // First, create a local mass matrix for the unit cell
     Triangulation<dim, spacedim> tr;
-    ReferenceCell::make_triangulation(reference_cell_type, tr);
+    reference_cell_type.make_triangulation(tr);
 
     const auto &mapping =
       reference_cell_type.template get_default_linear_mapping<dim, spacedim>();
@@ -1814,7 +1814,7 @@ namespace FETools
         // Set up meshes, one with a single
         // reference cell and refine it once
         Triangulation<dim, spacedim> tria;
-        ReferenceCell::make_triangulation(reference_cell_type, tria);
+        reference_cell_type.make_triangulation(tria);
         tria.begin_active()->set_refine_flag(RefinementCase<dim>(ref_case));
         tria.execute_coarsening_and_refinement();
 
index 9c969b6cd4e55a9ef6bd8fd0bb63b5de0f9e9b85..0f9e664bc500871175f5e3a864e0564190d0f1d3 100644 (file)
@@ -240,6 +240,14 @@ namespace ReferenceCell
     ArrayView<const unsigned int>
     faces_for_given_vertex(const unsigned int vertex) const;
 
+    /*
+     * Create a (coarse) grid with a single cell of the shape of this
+     * reference cell.
+     */
+    template <int dim, int spacedim>
+    void
+    make_triangulation(Triangulation<dim, spacedim> &tria) const;
+
   private:
     /**
      * The variable that stores what this object actually corresponds to.
@@ -712,15 +720,6 @@ namespace ReferenceCell
     return {};
   }
 
-  /*
-   * Create a (coarse) grid with a single cell of the shape of the provided
-   * reference cell.
-   */
-  template <int dim, int spacedim>
-  void
-  make_triangulation(const Type &                  reference_cell,
-                     Triangulation<dim, spacedim> &tria);
-
   /**
    * Return a default linear mapping that works for the given triangulation.
    * Internally, this function calls the function above for the reference
index 6d30097984b004194edabee4ee8c2124b144b2fe..b4db7849e16f68430cfa961fc9204478eb2462cb 100644 (file)
@@ -94,16 +94,13 @@ namespace ReferenceCell
 
   template <int dim, int spacedim>
   void
-  make_triangulation(const Type &                  reference_cell,
-                     Triangulation<dim, spacedim> &tria)
+  Type::make_triangulation(Triangulation<dim, spacedim> &tria) const
   {
-    AssertDimension(dim, reference_cell.get_dimension());
-
-    if (reference_cell == Type::get_hypercube<dim>())
+    if (this->is_hyper_cube())
       {
         GridGenerator::hyper_cube(tria, 0, 1);
       }
-    else if ((dim == 2) && (reference_cell == Type::Tri))
+    else if ((dim == 2) && (*this == Tri))
       {
         const std::vector<Point<spacedim>> vertices = {
           Point<spacedim>(),               // the origin
@@ -116,7 +113,7 @@ namespace ReferenceCell
 
         tria.create_triangulation(vertices, cells, {});
       }
-    else if ((dim == 3) && (reference_cell == Type::Tet))
+    else if ((dim == 3) && (*this == Tet))
       {
         AssertDimension(spacedim, 3);
 
@@ -128,7 +125,7 @@ namespace ReferenceCell
 
         tria.create_triangulation(vertices, cells, {});
       }
-    else if ((dim == 3) && (reference_cell == Type::Pyramid))
+    else if ((dim == 3) && (*this == Pyramid))
       {
         AssertDimension(spacedim, 3);
 
@@ -144,7 +141,7 @@ namespace ReferenceCell
 
         tria.create_triangulation(vertices, cells, {});
       }
-    else if ((dim == 3) && (reference_cell == Type::Wedge))
+    else if ((dim == 3) && (*this == Wedge))
       {
         AssertDimension(spacedim, 3);
 
@@ -285,7 +282,7 @@ namespace ReferenceCell
 
     const auto create_quadrature = [](const Type &reference_cell) {
       Triangulation<dim> tria;
-      make_triangulation(reference_cell, tria);
+      reference_cell.make_triangulation(tria);
 
       return Quadrature<dim>(tria.get_vertices());
     };
index b232ba517a5a07cab6a37b3b6e50a421c55cf4e6..51149bca8b12737d8b0b7a5b47264dbdd941fceb 100644 (file)
@@ -16,9 +16,8 @@
 for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
   {
 #if deal_II_dimension <= deal_II_space_dimension
-    template void make_triangulation(
-      const Type &                                               reference_cell,
-      Triangulation<deal_II_dimension, deal_II_space_dimension> &tria);
+    template void Type::make_triangulation(
+      Triangulation<deal_II_dimension, deal_II_space_dimension> & tria) const;
 
     template std::unique_ptr<
       Mapping<deal_II_dimension, deal_II_space_dimension>>
index c81eb0903f629e796ead306513da953e938f211a..7916800d7f942790da97b2ade66f7783271339c0 100644 (file)
@@ -29,7 +29,7 @@ test(const unsigned int orientation)
 
 
   Triangulation<3> dummy, tria;
-  ReferenceCell::make_triangulation(ReferenceCell::Type::Tet, dummy);
+  ReferenceCell::Type::Tet.make_triangulation(dummy);
 
   auto vertices = dummy.get_vertices();
 

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.