]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make face_vertex_location_location() a lot shorter. 15545/head
authorDavid Wells <drwells@email.unc.edu>
Fri, 30 Jun 2023 19:44:08 +0000 (15:44 -0400)
committerDavid Wells <drwells@email.unc.edu>
Fri, 30 Jun 2023 19:44:08 +0000 (15:44 -0400)
We can just call the other functions directly here. We can always switch this
back if we need better performance.

include/deal.II/grid/reference_cell.h

index a07734db3ffc953337ad708e160b1be511ee6b8c..65c962fa11ca88b573550308d9d76c06f7947eb7 100644 (file)
@@ -1961,203 +1961,8 @@ Point<dim>
 ReferenceCell::face_vertex_location(const unsigned int face,
                                     const unsigned int vertex) const
 {
-  AssertIndexRange(face, n_faces());
-  AssertIndexRange(vertex, face_reference_cell(face).n_vertices());
-  AssertDimension(dim, this->get_dimension());
-
-  switch (this->kind)
-    {
-      case ReferenceCells::Vertex:
-        {
-          Assert(false, ExcNotImplemented());
-          break;
-        }
-      case ReferenceCells::Line:
-        {
-          if (face == 0)
-            return Point<dim>(0);
-          else
-            return Point<dim>(1);
-        }
-      case ReferenceCells::Triangle:
-        {
-          static const ndarray<Point<dim>, 3, 2> table = {
-            {{{Point<dim>(0, 0), Point<dim>(1, 0)}},
-             {{Point<dim>(1, 0), Point<dim>(0, 1)}},
-             {{Point<dim>(0, 1), Point<dim>(0, 0)}}}};
-
-          return table[face][vertex];
-        }
-      case ReferenceCells::Quadrilateral:
-        {
-          static const ndarray<Point<dim>, 4, 2> table = {
-            {{{Point<dim>(0, 0), Point<dim>(0, 1)}},
-             {{Point<dim>(1, 0), Point<dim>(1, 1)}},
-             {{Point<dim>(0, 0), Point<dim>(1, 0)}},
-             {{Point<dim>(0, 1), Point<dim>(1, 1)}}}};
-
-          return table[face][vertex];
-        }
-      case ReferenceCells::Tetrahedron:
-        {
-          static const ndarray<Point<dim>, 4, 3> table = {
-            {{{Point<dim>(0.0, 0.0, 0.0),
-               Point<dim>(1.0, 0.0, 0.0),
-               Point<dim>(0.0, 1.0, 0.0)}},
-             {{Point<dim>(1.0, 0.0, 0.0),
-               Point<dim>(0.0, 0.0, 0.0),
-               Point<dim>(0.0, 0.0, 1.0)}},
-             {{Point<dim>(0.0, 0.0, 0.0),
-               Point<dim>(0.0, 1.0, 0.0),
-               Point<dim>(0.0, 0.0, 1.0)}},
-             {{Point<dim>(0.0, 1.0, 0.0),
-               Point<dim>(1.0, 0.0, 0.0),
-               Point<dim>(0.0, 0.0, 1.0)}}}};
-
-          return table[face][vertex];
-        }
-      case ReferenceCells::Pyramid:
-        {
-          // We would like to use ndarray here as we do above, but
-          // not every face has the same number of vertices and so
-          // the inner array needs to be a dynamic vector:
-          static const std::array<std::vector<Point<dim>>, 5> table = {
-            {{{Point<dim>(-1.0, -1.0, 0.0),
-               Point<dim>(+1.0, -1.0, 0.0),
-               Point<dim>(-1.0, +1.0, 0.0),
-               Point<dim>(+1.0, +1.0, 0.0)}},
-             {{Point<dim>(-1.0, -1.0, 0.0),
-               Point<dim>(-1.0, +1.0, 0.0),
-               Point<dim>(+0.0, +0.0, 1.0)}},
-             {{Point<dim>(+1.0, +1.0, 0.0),
-               Point<dim>(+1.0, -1.0, 0.0),
-               Point<dim>(+0.0, +0.0, 1.0)}},
-             {{Point<dim>(+1.0, -1.0, 0.0),
-               Point<dim>(-1.0, -1.0, 0.0),
-               Point<dim>(+0.0, +0.0, 1.0)}},
-             {{Point<dim>(-1.0, +1.0, 0.0),
-               Point<dim>(+1.0, +1.0, 0.0),
-               Point<dim>(+0.0, +0.0, 1.0)}}}};
-
-          return table[face][vertex];
-        }
-      case ReferenceCells::Wedge:
-        {
-          // We would like to use ndarray here as we do above, but
-          // not every face has the same number of vertices and so
-          // the inner array needs to be a dynamic vector:
-          static const std::array<std::vector<Point<dim>>, 5> table = {
-            {{{Point<dim>(1.0, 0.0, 0.0),
-               Point<dim>(0.0, 0.0, 0.0),
-               Point<dim>(0.0, 1.0, 0.0)}},
-             {{Point<dim>(0.0, 0.0, 1.0),
-               Point<dim>(1.0, 0.0, 1.0),
-               Point<dim>(0.0, 1.0, 1.0)}},
-             {{Point<dim>(0.0, 0.0, 0.0),
-               Point<dim>(1.0, 0.0, 0.0),
-               Point<dim>(0.0, 0.0, 1.0),
-               Point<dim>(1.0, 0.0, 1.0)}},
-             {{Point<dim>(1.0, 0.0, 0.0),
-               Point<dim>(0.0, 1.0, 0.0),
-               Point<dim>(1.0, 0.0, 1.0),
-               Point<dim>(0.0, 1.0, 1.0)}},
-             {{Point<dim>(0.0, 1.0, 0.0),
-               Point<dim>(0.0, 0.0, 0.0),
-               Point<dim>(0.0, 1.0, 1.0),
-               Point<dim>(0.0, 0.0, 1.0)}}}};
-
-          return table[face][vertex];
-        }
-      case ReferenceCells::Hexahedron:
-        {
-          /*
-           * Follow these figures:
-           *
-           *  * <li> Faces 0 and 1:
-           *  @verbatim
-           *          Face 0           Face 1
-           *        *-------*        *-------*
-           *       /|       |       /       /|
-           *      3 1       |      /       3 1
-           *    y/  |       |     /      y/  |
-           *    *   |x      |    *-------*   |x
-           *    |   *-------*    |       |   *
-           *    0  /       /     |       0  /
-           *    | 2       /      |       | 2
-           *    |/       /       |       |/
-           *    *-------*        *-------*
-           *  @endverbatim
-           *
-           * <li> Faces 2 and 3:
-           *  @verbatim
-           *        x Face 3           Face 2
-           *        *---1---*        *-------*
-           *       /|       |       /       /|
-           *      / |       3      /       / |
-           *     /  2       |    x/       /  |
-           *    *   |       |    *---1---*   |
-           *    |   *---0---*y   |       |   *
-           *    |  /       /     |       3  /
-           *    | /       /      2       | /
-           *    |/       /       |       |/
-           *    *-------*        *---0---*y
-           *  @endverbatim
-           *
-           * <li> Faces 4 and 5:
-           *  @verbatim
-           *          Face 4         y Face 5
-           *        *-------*        *---3---*
-           *       /|       |       /       /|
-           *      / |       |      0       1 |
-           *     /  |       |     /       /  |
-           *    *   |y      |    *---2---* x |
-           *    |   *---3---*    |       |   *
-           *    |  /       /     |       |  /
-           *    | 0       1      |       | /
-           *    |/       /       |       |/
-           *    *---2---* x      *-------*
-           *  @endverbatim
-           * </ul>
-           */
-          static const ndarray<Point<dim>, 6, 4> table = {
-            {// Face 0:
-             {{Point<dim>(0, 0, 0),
-               Point<dim>(0, 1, 0),
-               Point<dim>(0, 0, 1),
-               Point<dim>(0, 1, 1)}},
-             // Face 1:
-             {{Point<dim>(1, 0, 0),
-               Point<dim>(1, 1, 0),
-               Point<dim>(1, 0, 1),
-               Point<dim>(1, 1, 1)}},
-             // Face 2:
-             {{Point<dim>(0, 0, 0),
-               Point<dim>(0, 0, 1),
-               Point<dim>(1, 0, 0),
-               Point<dim>(1, 0, 1)}},
-             // Face 3:
-             {{Point<dim>(0, 1, 0),
-               Point<dim>(0, 1, 1),
-               Point<dim>(1, 1, 0),
-               Point<dim>(1, 1, 1)}},
-             // Face 4:
-             {{Point<dim>(0, 0, 0),
-               Point<dim>(1, 0, 0),
-               Point<dim>(0, 1, 0),
-               Point<dim>(1, 1, 0)}},
-             // Face 5:
-             {{Point<dim>(0, 0, 1),
-               Point<dim>(1, 0, 1),
-               Point<dim>(0, 1, 1),
-               Point<dim>(1, 1, 1)}}}};
-
-          return table[face][vertex];
-        }
-      default:
-        Assert(false, ExcNotImplemented());
-    }
-
-  return {};
+  return this->template vertex<dim>(
+    face_to_cell_vertices(face, vertex, default_combined_face_orientation()));
 }
 
 

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.