From d157632cceb984d51ac50e3e6ba6e92c5e1d4a53 Mon Sep 17 00:00:00 2001 From: David Wells Date: Fri, 11 Apr 2025 13:09:15 -0400 Subject: [PATCH] QProjector::project_to_all_faces(): combine all 3d code. --- source/base/qprojector.cc | 78 +++++---------------------------------- 1 file changed, 10 insertions(+), 68 deletions(-) diff --git a/source/base/qprojector.cc b/source/base/qprojector.cc index c605772548..df72b7e91b 100644 --- a/source/base/qprojector.cc +++ b/source/base/qprojector.cc @@ -884,77 +884,19 @@ QProjector<3>::project_to_all_faces(const ReferenceCell &reference_cell, return Quadrature<3>(std::move(points), std::move(weights)); }; - if ((reference_cell == ReferenceCells::Tetrahedron) || - (reference_cell == ReferenceCells::Wedge) || - (reference_cell == ReferenceCells::Pyramid)) + std::vector>> face_vertex_locations( + reference_cell.n_faces()); + for (const unsigned int f : reference_cell.face_indices()) { - std::vector>> face_vertex_locations( - reference_cell.n_faces()); - for (const unsigned int f : reference_cell.face_indices()) - { - face_vertex_locations[f].resize( - reference_cell.face_reference_cell(f).n_vertices()); - for (const 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); + face_vertex_locations[f].resize( + reference_cell.face_reference_cell(f).n_vertices()); + for (const unsigned int v : + reference_cell.face_reference_cell(f).vertex_indices()) + face_vertex_locations[f][v] = + reference_cell.face_vertex_location<3>(f, v); } - else - { - Assert(reference_cell == ReferenceCells::Hexahedron, ExcNotImplemented()); - - const unsigned int dim = 3; - - unsigned int n_points_total = 0; - - if (quadrature.size() == 1) - n_points_total = - quadrature[0].size() * GeometryInfo::faces_per_cell; - else - { - AssertDimension(quadrature.size(), GeometryInfo::faces_per_cell); - for (const auto &q : quadrature) - n_points_total += q.size(); - } - - n_points_total *= 8; - // first fix quadrature points - std::vector> q_points; - q_points.reserve(n_points_total); - - std::vector weights; - weights.reserve(n_points_total); - - for (unsigned int face = 0; face < GeometryInfo::faces_per_cell; - ++face) - { - // project to each face and append results - for (types::geometric_orientation combined_orientation = 0; - combined_orientation < 8; - ++combined_orientation) - { - const unsigned int q_index = quadrature.size() == 1 ? 0 : face; - internal::QProjector::project_to_hex_face_and_append( - internal::QProjector::mutate_points_with_offset( - quadrature[q_index].get_points(), combined_orientation), - face, - q_points); - - std::copy(quadrature[q_index].get_weights().begin(), - quadrature[q_index].get_weights().end(), - std::back_inserter(weights)); - } - } - - Assert(q_points.size() == n_points_total, ExcInternalError()); - Assert(weights.size() == n_points_total, ExcInternalError()); - - return Quadrature(std::move(q_points), std::move(weights)); - } + return process(face_vertex_locations); } -- 2.39.5