From: David Wells Date: Sun, 9 Feb 2025 02:54:08 +0000 (-0500) Subject: QProjector: deprecate the other project_to_face() functions. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2eb695a370094df0cc3957276e3df11aef09b8f5;p=dealii.git QProjector: deprecate the other project_to_face() functions. --- diff --git a/include/deal.II/base/qprojector.h b/include/deal.II/base/qprojector.h index 37e16f9d4d..07643e71ab 100644 --- a/include/deal.II/base/qprojector.h +++ b/include/deal.II/base/qprojector.h @@ -91,7 +91,13 @@ public: * Compute the quadrature points on the cell if the given quadrature formula * is used on face face_no. For further details, see the general * doc for this class. + * + * @deprecated Use the version of this function which takes a + * combined_orientation argument instead. */ + DEAL_II_DEPRECATED_EARLY_WITH_COMMENT( + "Use the version of this function which takes a combined_orientation " + "argument instead.") static void project_to_face(const ReferenceCell &reference_cell, const SubQuadrature &quadrature, @@ -102,7 +108,13 @@ public: * Compute the cell quadrature formula corresponding to using * quadrature on face face_no. For further details, see * the general doc for this class. + * + * @deprecated Use the version of this function which takes a + * combined_orientation argument instead. */ + DEAL_II_DEPRECATED_EARLY_WITH_COMMENT( + "Use the version of this function which takes a combined_orientation " + "argument instead.") static Quadrature project_to_face(const ReferenceCell &reference_cell, const SubQuadrature &quadrature, @@ -113,7 +125,13 @@ public: * quadrature on face face_no taking into account the * orientation of the face. For further details, see the general doc for this * class. + * + * @deprecated Use the version of project_to_face() which takes a + * combined_orientation argument instead. */ + DEAL_II_DEPRECATED_EARLY_WITH_COMMENT( + "Use the version of project_to_face() which takes a combined_orientation " + "argument instead.") static Quadrature project_to_oriented_face(const ReferenceCell &reference_cell, const SubQuadrature &quadrature, @@ -128,9 +146,9 @@ public: * the general doc for this class. */ static Quadrature - project_to_face(const ReferenceCell &reference_cell, - const SubQuadrature &quadrature, - const unsigned int face_no, + project_to_face(const ReferenceCell &reference_cell, + const SubQuadrature &quadrature, + const unsigned int face_no, const types::geometric_orientation orientation); /** diff --git a/source/base/qprojector.cc b/source/base/qprojector.cc index a6a897d566..127352e97a 100644 --- a/source/base/qprojector.cc +++ b/source/base/qprojector.cc @@ -341,19 +341,18 @@ namespace internal template <> void -QProjector<1>::project_to_face(const ReferenceCell &reference_cell, - const Quadrature<0> &, +QProjector<1>::project_to_face(const ReferenceCell &reference_cell, + const Quadrature<0> &quadrature, const unsigned int face_no, std::vector> &q_points) { - Assert(reference_cell == ReferenceCells::Line, ExcNotImplemented()); - (void)reference_cell; - - const unsigned int dim = 1; - AssertIndexRange(face_no, GeometryInfo::faces_per_cell); - AssertDimension(q_points.size(), 1); - - q_points[0] = Point(static_cast(face_no)); + AssertDimension(quadrature.size(), q_points.size()); + const auto face_quadrature = + QProjector<1>::project_to_face(reference_cell, + quadrature, + face_no, + numbers::default_geometric_orientation); + q_points = face_quadrature.get_points(); } @@ -365,43 +364,13 @@ QProjector<2>::project_to_face(const ReferenceCell &reference_cell, const unsigned int face_no, std::vector> &q_points) { - AssertIndexRange(face_no, reference_cell.n_faces()); - AssertDimension(reference_cell.get_dimension(), 2); - Assert(q_points.size() == quadrature.size(), - ExcDimensionMismatch(q_points.size(), quadrature.size())); - - q_points.resize(0); - if (reference_cell == ReferenceCells::Triangle) - // use linear polynomial to map the reference quadrature points correctly - // on faces, i.e., BarycentricPolynomials<1>(1) - for (unsigned int p = 0; p < quadrature.size(); ++p) - { - if (face_no == 0) - q_points.emplace_back(quadrature.point(p)[0], 0); - else if (face_no == 1) - q_points.emplace_back(1.0 - quadrature.point(p)[0], - quadrature.point(p)[0]); - else if (face_no == 2) - q_points.emplace_back(0, 1.0 - quadrature.point(p)[0]); - else - DEAL_II_ASSERT_UNREACHABLE(); - } - else if (reference_cell == ReferenceCells::Quadrilateral) - for (unsigned int p = 0; p < quadrature.size(); ++p) - { - if (face_no == 0) - q_points.emplace_back(0, quadrature.point(p)[0]); - else if (face_no == 1) - q_points.emplace_back(1, quadrature.point(p)[0]); - else if (face_no == 2) - q_points.emplace_back(quadrature.point(p)[0], 0); - else if (face_no == 3) - q_points.emplace_back(quadrature.point(p)[0], 1); - else - DEAL_II_ASSERT_UNREACHABLE(); - } - else - DEAL_II_ASSERT_UNREACHABLE(); + AssertDimension(quadrature.size(), q_points.size()); + const auto face_quadrature = + QProjector<2>::project_to_face(reference_cell, + quadrature, + face_no, + numbers::default_geometric_orientation); + q_points = face_quadrature.get_points(); } @@ -426,38 +395,23 @@ QProjector<3>::project_to_face(const ReferenceCell &reference_cell, } + template Quadrature QProjector::project_to_oriented_face(const ReferenceCell &reference_cell, const Quadrature &quadrature, const unsigned int face_no, - const bool, - const bool, - const bool) -{ - return QProjector::project_to_face(reference_cell, quadrature, face_no); -} - - - -template <> -Quadrature<3> -QProjector<3>::project_to_oriented_face(const ReferenceCell &reference_cell, - const Quadrature<2> &quadrature, - const unsigned int face_no, - const bool face_orientation, - const bool face_flip, - const bool face_rotation) + const bool face_orientation, + const bool face_flip, + const bool face_rotation) { - Assert(reference_cell == ReferenceCells::Hexahedron, ExcNotImplemented()); - - const Quadrature<2> mutation = internal::QProjector::mutate_quadrature( + return QProjector::project_to_face( + reference_cell, quadrature, + face_no, internal::combined_face_orientation(face_orientation, face_rotation, face_flip)); - - return QProjector<3>::project_to_face(reference_cell, mutation, face_no); } @@ -470,7 +424,9 @@ QProjector::project_to_face(const ReferenceCell &reference_cell, const types::geometric_orientation orientation) { AssertIndexRange(face_no, reference_cell.n_faces()); - AssertIndexRange(orientation, reference_cell.n_face_orientations(face_no)); + // TODO once the default orientation is zero we can remove this special case + AssertIndexRange(dim == 1 ? 1 - orientation : orientation, + reference_cell.n_face_orientations(face_no)); AssertDimension(reference_cell.get_dimension(), dim); std::vector> q_points;