From 914b8d58de556f2487572d877723b6f3a747d376 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 9 Feb 2023 16:55:15 -0700 Subject: [PATCH] Use functionality in ReferenceCell. --- source/base/qprojector.cc | 74 ++++++++------------------------------- 1 file changed, 14 insertions(+), 60 deletions(-) diff --git a/source/base/qprojector.cc b/source/base/qprojector.cc index b79b62542e..20f588eb81 100644 --- a/source/base/qprojector.cc +++ b/source/base/qprojector.cc @@ -749,67 +749,21 @@ QProjector<3>::project_to_all_faces(const ReferenceCell & reference_cell, return Quadrature<3>(points, weights); }; - if (reference_cell == ReferenceCells::Tetrahedron) + if ((reference_cell == ReferenceCells::Tetrahedron) || + (reference_cell == ReferenceCells::Wedge) || + (reference_cell == ReferenceCells::Pyramid)) { - const std::vector>> face_vertex_locations = { - {{Point<3>(0.0, 0.0, 0.0), - Point<3>(1.0, 0.0, 0.0), - Point<3>(0.0, 1.0, 0.0)}}, - {{Point<3>(1.0, 0.0, 0.0), - Point<3>(0.0, 0.0, 0.0), - Point<3>(0.0, 0.0, 1.0)}}, - {{Point<3>(0.0, 0.0, 0.0), - Point<3>(0.0, 1.0, 0.0), - Point<3>(0.0, 0.0, 1.0)}}, - {{Point<3>(0.0, 1.0, 0.0), - Point<3>(1.0, 0.0, 0.0), - Point<3>(0.0, 0.0, 1.0)}}}; - - return process(face_vertex_locations); - } - else if (reference_cell == ReferenceCells::Wedge) - { - const std::vector>> face_vertex_locations = { - {{Point<3>(1.0, 0.0, 0.0), - Point<3>(0.0, 0.0, 0.0), - Point<3>(0.0, 1.0, 0.0)}}, - {{Point<3>(0.0, 0.0, 1.0), - Point<3>(1.0, 0.0, 1.0), - Point<3>(0.0, 1.0, 1.0)}}, - {{Point<3>(0.0, 0.0, 0.0), - Point<3>(1.0, 0.0, 0.0), - Point<3>(0.0, 0.0, 1.0), - Point<3>(1.0, 0.0, 1.0)}}, - {{Point<3>(1.0, 0.0, 0.0), - Point<3>(0.0, 1.0, 0.0), - Point<3>(1.0, 0.0, 1.0), - Point<3>(0.0, 1.0, 1.0)}}, - {{Point<3>(0.0, 1.0, 0.0), - Point<3>(0.0, 0.0, 0.0), - Point<3>(0.0, 1.0, 1.0), - Point<3>(0.0, 0.0, 1.0)}}}; - - return process(face_vertex_locations); - } - else if (reference_cell == ReferenceCells::Pyramid) - { - const std::vector>> face_vertex_locations = { - {{Point<3>(-1.0, -1.0, 0.0), - Point<3>(+1.0, -1.0, 0.0), - Point<3>(-1.0, +1.0, 0.0), - Point<3>(+1.0, +1.0, 0.0)}}, - {{Point<3>(-1.0, -1.0, 0.0), - Point<3>(-1.0, +1.0, 0.0), - Point<3>(+0.0, +0.0, 1.0)}}, - {{Point<3>(+1.0, +1.0, 0.0), - Point<3>(+1.0, -1.0, 0.0), - Point<3>(+0.0, +0.0, 1.0)}}, - {{Point<3>(+1.0, -1.0, 0.0), - Point<3>(-1.0, -1.0, 0.0), - Point<3>(+0.0, +0.0, 1.0)}}, - {{Point<3>(-1.0, +1.0, 0.0), - Point<3>(+1.0, +1.0, 0.0), - Point<3>(+0.0, +0.0, 1.0)}}}; + std::vector>> face_vertex_locations( + reference_cell.n_faces()); + for (unsigned int f : reference_cell.face_indices()) + { + face_vertex_locations[f].resize( + reference_cell.face_reference_cell(f).n_vertices()); + for (unsigned int v : + reference_cell.face_reference_cell(f).vertex_indices()) + face_vertex_locations[f][v] = + reference_cell.face_vertex_location<3>(f, v); + } return process(face_vertex_locations); } -- 2.39.5