]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Replace uses of GeometryInfo. 12844/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 19 Oct 2021 03:33:31 +0000 (21:33 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 19 Oct 2021 15:51:45 +0000 (09:51 -0600)
include/deal.II/grid/reference_cell.h

index 025abf9e67889f8f1a3d494925c1604927625a34..82eb82a7da34874c7af2c30421ca19d654332915 100644 (file)
@@ -869,9 +869,45 @@ ReferenceCell::vertex(const unsigned int v) const
   AssertDimension(dim, get_dimension());
   AssertIndexRange(v, n_vertices());
 
-  if (*this == ReferenceCells::get_hypercube<dim>())
+  if ((dim == 0) && (*this == ReferenceCells::Vertex))
+    {
+      return Point<dim>(0);
+    }
+  else if ((dim == 1) && (*this == ReferenceCells::Line))
+    {
+      static const Point<dim> vertices[2] = {
+        Point<dim>(),              // the origin
+        Point<dim>::unit_vector(0) // unit point along x-axis
+      };
+      return vertices[v];
+    }
+  else if ((dim == 2) && (*this == ReferenceCells::Quadrilateral))
     {
-      return GeometryInfo<dim>::unit_cell_vertex(v);
+      static const Point<dim> vertices[4] = {
+        // First the two points on the x-axis
+        Point<dim>(),
+        Point<dim>::unit_vector(0),
+        // Then these two points shifted in the y-direction
+        Point<dim>() + Point<dim>::unit_vector(1),
+        Point<dim>::unit_vector(0) + Point<dim>::unit_vector(1)};
+      return vertices[v];
+    }
+  else if ((dim == 3) && (*this == ReferenceCells::Hexahedron))
+    {
+      static const Point<dim> vertices[8] = {
+        // First the two points on the x-axis
+        Point<dim>(),
+        Point<dim>::unit_vector(0),
+        // Then these two points shifted in the y-direction
+        Point<dim>() + Point<dim>::unit_vector(1),
+        Point<dim>::unit_vector(0) + Point<dim>::unit_vector(1),
+        // And now all four points shifted in the z-direction
+        Point<dim>() + Point<dim>::unit_vector(2),
+        Point<dim>::unit_vector(0) + Point<dim>::unit_vector(2),
+        Point<dim>() + Point<dim>::unit_vector(1) + Point<dim>::unit_vector(2),
+        Point<dim>::unit_vector(0) + Point<dim>::unit_vector(1) +
+          Point<dim>::unit_vector(2)};
+      return vertices[v];
     }
   else if ((dim == 2) && (*this == ReferenceCells::Triangle))
     {

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.