From: David Wells Date: Sat, 18 Jan 2025 16:20:11 +0000 (-0500) Subject: Give standard_vs_true_line_orientation() a better name. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=093b85d4f075cc23668eddc83108b61341680d6b;p=dealii.git Give standard_vs_true_line_orientation() a better name. 'Standard' is ambiguous in this context since we use both per-face and per-cell line orientations in different contexts. --- diff --git a/include/deal.II/grid/reference_cell.h b/include/deal.II/grid/reference_cell.h index b080d14446..2b739b983b 100644 --- a/include/deal.II/grid/reference_cell.h +++ b/include/deal.II/grid/reference_cell.h @@ -593,7 +593,11 @@ public: * Return whether the line with index @p line is oriented in standard * direction within a cell, given the @p face_orientation of the face within * the current cell, and @p line_orientation for the line within that face. + * + * @deprecated Use face_to_cell_line_orientation() instead. */ + DEAL_II_DEPRECATED_EARLY_WITH_COMMENT( + "Use face_to_cell_line_orientation() instead.") types::geometric_orientation standard_vs_true_line_orientation( const unsigned int line, @@ -601,6 +605,35 @@ public: const types::geometric_orientation face_orientation, const types::geometric_orientation line_orientation) const; + /** + * @brief Convert a line orientation defined relative to a face to the + * canonical per-cell line orientation. + * + * Line orientations are used in both face and line contexts. Since a line is + * always shared by two faces, it may need to be reversed (relative to the + * first face) on the second face to guarantee that the per-face lines always + * point in their canonical directions (e.g., so that lines 0 and 1 of a + * quadrilateral point up and lines 2 and 3 point right) and that the vertex + * ordering on that line remains correct. + * + * To achieve this, this function computes the per-cell line orientation based + * on the face's number, orientation and line number. + * + * @param[in] face_line_no The index of the line on the face. + * + * @param[in] face_no The number of the face. + * + * @param[in] face_orientation The orientation of the face. + * + * @param[in] line_orientation The orientation of the line on the given face. + */ + types::geometric_orientation + face_to_cell_line_orientation( + const unsigned int face_line_no, + const unsigned int face_no, + const types::geometric_orientation face_orientation, + const types::geometric_orientation line_orientation) const; + /** * @} */ @@ -3224,6 +3257,20 @@ ReferenceCell::standard_vs_true_line_orientation( const unsigned int face, const types::geometric_orientation combined_face_orientation, const types::geometric_orientation line_orientation) const +{ + return face_to_cell_line_orientation(line, + face, + combined_face_orientation, + line_orientation); +} + + +inline types::geometric_orientation +ReferenceCell::face_to_cell_line_orientation( + const unsigned int face_line_no, + const unsigned int face_no, + const types::geometric_orientation combined_face_orientation, + const types::geometric_orientation line_orientation) const { constexpr auto D = ReferenceCell::default_combined_face_orientation(); constexpr auto R = ReferenceCell::reversed_combined_line_orientation(); @@ -3231,10 +3278,10 @@ ReferenceCell::standard_vs_true_line_orientation( { static constexpr dealii::ndarray table{{{{D, D, R, D, R, R, D, R}}, {{D, D, D, R, R, R, R, D}}}}; - // We use line / 2 here since lines i and i + 1 are parallel and, on a - // given face, have the same relative orientations. + // We use face_line_no / 2 here since lines i and i + 1 are parallel and, + // on a given face, have the same relative orientations. const bool match = - line_orientation == table[line / 2][combined_face_orientation]; + line_orientation == table[face_line_no / 2][combined_face_orientation]; return match ? ReferenceCell::default_combined_face_orientation() : ReferenceCell::reversed_combined_line_orientation(); @@ -3245,7 +3292,7 @@ ReferenceCell::standard_vs_true_line_orientation( static constexpr dealii::ndarray combined_lines{ {{{0, 0, 0}}, {{X, 0, 1}}, {{X, 0, X}}, {{X, X, X}}}}; - const auto combined_line = combined_lines[face][line]; + const auto combined_line = combined_lines[face_no][face_line_no]; Assert(combined_line != X, ExcMessage( diff --git a/include/deal.II/grid/tria_accessor.h b/include/deal.II/grid/tria_accessor.h index c08276b717..6bd6ac1503 100644 --- a/include/deal.II/grid/tria_accessor.h +++ b/include/deal.II/grid/tria_accessor.h @@ -1004,7 +1004,7 @@ public: * @warning This function is really only for internal use in the library * unless you absolutely know what this is all about. * - * @note This function queries ReferenceCell::standard_vs_true_line_orientation(). + * @note This function queries ReferenceCell::face_to_cell_line_orientation(). */ types::geometric_orientation line_orientation(const unsigned int line) const; @@ -5109,22 +5109,22 @@ namespace internal ref_cell.standard_to_real_face_line(3, f, orientation)}}; const auto quad = cell.quad(f); const std::array - my_orientations{{ref_cell.standard_vs_true_line_orientation( + my_orientations{{ref_cell.face_to_cell_line_orientation( 0, f, orientation, quad->line_orientation(my_indices[0])), - ref_cell.standard_vs_true_line_orientation( + ref_cell.face_to_cell_line_orientation( 1, f, orientation, quad->line_orientation(my_indices[1])), - ref_cell.standard_vs_true_line_orientation( + ref_cell.face_to_cell_line_orientation( 2, f, orientation, quad->line_orientation(my_indices[2])), - ref_cell.standard_vs_true_line_orientation( + ref_cell.face_to_cell_line_orientation( 3, f, orientation, @@ -5144,12 +5144,12 @@ namespace internal ref_cell.standard_to_real_face_line(1, f, orientation)}}; const auto quad = cell.quad(f); const std::array - my_orientations{{ref_cell.standard_vs_true_line_orientation( + my_orientations{{ref_cell.face_to_cell_line_orientation( 0, f, orientation, quad->line_orientation(my_indices[0])), - ref_cell.standard_vs_true_line_orientation( + ref_cell.face_to_cell_line_orientation( 1, f, orientation, @@ -5171,32 +5171,32 @@ namespace internal ref_cell.standard_to_real_face_line(1, 1, orientations[1]), ref_cell.standard_to_real_face_line(2, 1, orientations[1]), ref_cell.standard_to_real_face_line(1, 2, orientations[2])}}; - line_orientations[0] = ref_cell.standard_vs_true_line_orientation( + line_orientations[0] = ref_cell.face_to_cell_line_orientation( 0, 0, orientations[0], cell.quad(0)->line_orientation(my_indices[0])); - line_orientations[1] = ref_cell.standard_vs_true_line_orientation( + line_orientations[1] = ref_cell.face_to_cell_line_orientation( 1, 0, orientations[0], cell.quad(0)->line_orientation(my_indices[1])); - line_orientations[2] = ref_cell.standard_vs_true_line_orientation( + line_orientations[2] = ref_cell.face_to_cell_line_orientation( 2, 0, orientations[0], cell.quad(0)->line_orientation(my_indices[2])); - line_orientations[3] = ref_cell.standard_vs_true_line_orientation( + line_orientations[3] = ref_cell.face_to_cell_line_orientation( 1, 1, orientations[1], cell.quad(1)->line_orientation(my_indices[3])); - line_orientations[4] = ref_cell.standard_vs_true_line_orientation( + line_orientations[4] = ref_cell.face_to_cell_line_orientation( 2, 1, orientations[1], cell.quad(1)->line_orientation(my_indices[4])); - line_orientations[5] = ref_cell.standard_vs_true_line_orientation( + line_orientations[5] = ref_cell.face_to_cell_line_orientation( 1, 2, orientations[2], @@ -5567,7 +5567,7 @@ TriaAccessor::line_orientation( line_index, face_index, this->combined_face_orientation(face_index)); // Then query how that line is oriented within that face: - return reference_cell.standard_vs_true_line_orientation( + return reference_cell.face_to_cell_line_orientation( line_index, face_index, this->combined_face_orientation(face_index),