From: David Wells Date: Fri, 30 Jun 2023 19:44:08 +0000 (-0400) Subject: Make face_vertex_location_location() a lot shorter. X-Git-Tag: relicensing~836^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e0fb1b9627df974dbca26b1fbba7e749a70a6f6;p=dealii.git Make face_vertex_location_location() a lot shorter. We can just call the other functions directly here. We can always switch this back if we need better performance. --- diff --git a/include/deal.II/grid/reference_cell.h b/include/deal.II/grid/reference_cell.h index a07734db3f..65c962fa11 100644 --- a/include/deal.II/grid/reference_cell.h +++ b/include/deal.II/grid/reference_cell.h @@ -1961,203 +1961,8 @@ Point 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(0); - else - return Point(1); - } - case ReferenceCells::Triangle: - { - static const ndarray, 3, 2> table = { - {{{Point(0, 0), Point(1, 0)}}, - {{Point(1, 0), Point(0, 1)}}, - {{Point(0, 1), Point(0, 0)}}}}; - - return table[face][vertex]; - } - case ReferenceCells::Quadrilateral: - { - static const ndarray, 4, 2> table = { - {{{Point(0, 0), Point(0, 1)}}, - {{Point(1, 0), Point(1, 1)}}, - {{Point(0, 0), Point(1, 0)}}, - {{Point(0, 1), Point(1, 1)}}}}; - - return table[face][vertex]; - } - case ReferenceCells::Tetrahedron: - { - static const ndarray, 4, 3> table = { - {{{Point(0.0, 0.0, 0.0), - Point(1.0, 0.0, 0.0), - Point(0.0, 1.0, 0.0)}}, - {{Point(1.0, 0.0, 0.0), - Point(0.0, 0.0, 0.0), - Point(0.0, 0.0, 1.0)}}, - {{Point(0.0, 0.0, 0.0), - Point(0.0, 1.0, 0.0), - Point(0.0, 0.0, 1.0)}}, - {{Point(0.0, 1.0, 0.0), - Point(1.0, 0.0, 0.0), - Point(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>, 5> table = { - {{{Point(-1.0, -1.0, 0.0), - Point(+1.0, -1.0, 0.0), - Point(-1.0, +1.0, 0.0), - Point(+1.0, +1.0, 0.0)}}, - {{Point(-1.0, -1.0, 0.0), - Point(-1.0, +1.0, 0.0), - Point(+0.0, +0.0, 1.0)}}, - {{Point(+1.0, +1.0, 0.0), - Point(+1.0, -1.0, 0.0), - Point(+0.0, +0.0, 1.0)}}, - {{Point(+1.0, -1.0, 0.0), - Point(-1.0, -1.0, 0.0), - Point(+0.0, +0.0, 1.0)}}, - {{Point(-1.0, +1.0, 0.0), - Point(+1.0, +1.0, 0.0), - Point(+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>, 5> table = { - {{{Point(1.0, 0.0, 0.0), - Point(0.0, 0.0, 0.0), - Point(0.0, 1.0, 0.0)}}, - {{Point(0.0, 0.0, 1.0), - Point(1.0, 0.0, 1.0), - Point(0.0, 1.0, 1.0)}}, - {{Point(0.0, 0.0, 0.0), - Point(1.0, 0.0, 0.0), - Point(0.0, 0.0, 1.0), - Point(1.0, 0.0, 1.0)}}, - {{Point(1.0, 0.0, 0.0), - Point(0.0, 1.0, 0.0), - Point(1.0, 0.0, 1.0), - Point(0.0, 1.0, 1.0)}}, - {{Point(0.0, 1.0, 0.0), - Point(0.0, 0.0, 0.0), - Point(0.0, 1.0, 1.0), - Point(0.0, 0.0, 1.0)}}}}; - - return table[face][vertex]; - } - case ReferenceCells::Hexahedron: - { - /* - * Follow these figures: - * - * *
  • Faces 0 and 1: - * @verbatim - * Face 0 Face 1 - * *-------* *-------* - * /| | / /| - * 3 1 | / 3 1 - * y/ | | / y/ | - * * |x | *-------* |x - * | *-------* | | * - * 0 / / | 0 / - * | 2 / | | 2 - * |/ / | |/ - * *-------* *-------* - * @endverbatim - * - *
  • Faces 2 and 3: - * @verbatim - * x Face 3 Face 2 - * *---1---* *-------* - * /| | / /| - * / | 3 / / | - * / 2 | x/ / | - * * | | *---1---* | - * | *---0---*y | | * - * | / / | 3 / - * | / / 2 | / - * |/ / | |/ - * *-------* *---0---*y - * @endverbatim - * - *
  • Faces 4 and 5: - * @verbatim - * Face 4 y Face 5 - * *-------* *---3---* - * /| | / /| - * / | | 0 1 | - * / | | / / | - * * |y | *---2---* x | - * | *---3---* | | * - * | / / | | / - * | 0 1 | | / - * |/ / | |/ - * *---2---* x *-------* - * @endverbatim - * - */ - static const ndarray, 6, 4> table = { - {// Face 0: - {{Point(0, 0, 0), - Point(0, 1, 0), - Point(0, 0, 1), - Point(0, 1, 1)}}, - // Face 1: - {{Point(1, 0, 0), - Point(1, 1, 0), - Point(1, 0, 1), - Point(1, 1, 1)}}, - // Face 2: - {{Point(0, 0, 0), - Point(0, 0, 1), - Point(1, 0, 0), - Point(1, 0, 1)}}, - // Face 3: - {{Point(0, 1, 0), - Point(0, 1, 1), - Point(1, 1, 0), - Point(1, 1, 1)}}, - // Face 4: - {{Point(0, 0, 0), - Point(1, 0, 0), - Point(0, 1, 0), - Point(1, 1, 0)}}, - // Face 5: - {{Point(0, 0, 1), - Point(1, 0, 1), - Point(0, 1, 1), - Point(1, 1, 1)}}}}; - - return table[face][vertex]; - } - default: - Assert(false, ExcNotImplemented()); - } - - return {}; + return this->template vertex( + face_to_cell_vertices(face, vertex, default_combined_face_orientation())); }