From d817ee1dcb7457d240257cdf0bdf6feb392fcff8 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 23 Jan 2025 09:47:05 -0700 Subject: [PATCH] Rename unit_tangential/normal_vectors() to face_tangent/normal_vector(). --- include/deal.II/grid/reference_cell.h | 67 ++++++++++++++++++--- source/fe/mapping_fe.cc | 9 ++- source/fe/mapping_fe_field.cc | 9 ++- tests/simplex/orientation_03.cc | 2 +- tests/simplex/orientation_04.cc | 2 +- tests/simplex/unit_tangential_vectors_01.cc | 7 +-- 6 files changed, 71 insertions(+), 25 deletions(-) diff --git a/include/deal.II/grid/reference_cell.h b/include/deal.II/grid/reference_cell.h index ed9bd6c832..032bc46af3 100644 --- a/include/deal.II/grid/reference_cell.h +++ b/include/deal.II/grid/reference_cell.h @@ -729,9 +729,9 @@ public: closest_point(const Point &p) const; /** - * Return $i$-th unit tangential vector of a face of the reference cell. - * The vectors are arranged such that the - * cross product between the two vectors returns the unit normal vector. + * Return $i$-th unit tangent vector to a face of the reference cell. + * The vectors are arranged in such an order that the + * cross product between the two vectors returns the face normal vector. * * @pre $i$ must be between zero and `dim-1`. * @@ -741,8 +741,25 @@ public: */ template Tensor<1, dim> - unit_tangential_vectors(const unsigned int face_no, - const unsigned int i) const; + face_tangent_vector(const unsigned int face_no, const unsigned int i) const; + + /** + * Return $i$-th unit tangent vector to a face of the reference cell. + * The vectors are arranged in such an order that the + * cross product between the two vectors returns the face normal vector. + * + * @pre $i$ must be between zero and `dim-1`. + * + * @pre The template argument `dim` must equal the dimension + * of the space in which the reference cell you are querying + * lives (i.e., it must equal the result of get_dimension()). + * + * @deprecated Use face_tangent_vector() instead. + */ + template + DEAL_II_DEPRECATED_EARLY_WITH_COMMENT("Use face_tangent_vector() instead.") + Tensor<1, dim> unit_tangential_vectors(const unsigned int face_no, + const unsigned int i) const; /** * Return the unit normal vector of a face of the reference cell. @@ -753,7 +770,20 @@ public: */ template Tensor<1, dim> - unit_normal_vectors(const unsigned int face_no) const; + face_normal_vector(const unsigned int face_no) const; + + /** + * Return the unit normal vector of a face of the reference cell. + * + * @pre The template argument `dim` must equal the dimension + * of the space in which the reference cell you are querying + * lives (i.e., it must equal the result of get_dimension()). + * + * @deprecated Use face_normal_vector() instead. + */ + template + DEAL_II_DEPRECATED_EARLY_WITH_COMMENT("Use face_normal_vector() instead.") + Tensor<1, dim> unit_normal_vectors(const unsigned int face_no) const; /** * Return the number of orientations for a face in the ReferenceCell. For @@ -3119,6 +3149,16 @@ template inline Tensor<1, dim> ReferenceCell::unit_tangential_vectors(const unsigned int face_no, const unsigned int i) const +{ + return face_tangent_vector(face_no, i); +} + + + +template +inline Tensor<1, dim> +ReferenceCell::face_tangent_vector(const unsigned int face_no, + const unsigned int i) const { Assert(dim == get_dimension(), ExcMessage("You can only call this function with arguments for " @@ -3204,6 +3244,15 @@ ReferenceCell::unit_tangential_vectors(const unsigned int face_no, template inline Tensor<1, dim> ReferenceCell::unit_normal_vectors(const unsigned int face_no) const +{ + return face_normal_vector(face_no); +} + + + +template +inline Tensor<1, dim> +ReferenceCell::face_normal_vector(const unsigned int face_no) const { Assert(dim == get_dimension(), ExcMessage("You can only call this function with arguments for " @@ -3222,12 +3271,12 @@ ReferenceCell::unit_normal_vectors(const unsigned int face_no) const Assert(*this == ReferenceCells::Triangle, ExcInternalError()); // Return the rotated vector - return cross_product_2d(unit_tangential_vectors(face_no, 0)); + return cross_product_2d(face_tangent_vector(face_no, 0)); } else if (dim == 3) { - return cross_product_3d(unit_tangential_vectors(face_no, 0), - unit_tangential_vectors(face_no, 1)); + return cross_product_3d(face_tangent_vector(face_no, 0), + face_tangent_vector(face_no, 1)); } DEAL_II_NOT_IMPLEMENTED(); diff --git a/source/fe/mapping_fe.cc b/source/fe/mapping_fe.cc index f06ffb8997..563045675c 100644 --- a/source/fe/mapping_fe.cc +++ b/source/fe/mapping_fe.cc @@ -157,14 +157,13 @@ MappingFE::InternalData::initialize_face( unit_tangentials[i].resize(n_original_q_points); std::fill(unit_tangentials[i].begin(), unit_tangentials[i].end(), - reference_cell.template unit_tangential_vectors(i, 0)); + reference_cell.template face_tangent_vector(i, 0)); if (dim > 2) { unit_tangentials[n_faces + i].resize(n_original_q_points); - std::fill( - unit_tangentials[n_faces + i].begin(), - unit_tangentials[n_faces + i].end(), - reference_cell.template unit_tangential_vectors(i, 1)); + std::fill(unit_tangentials[n_faces + i].begin(), + unit_tangentials[n_faces + i].end(), + reference_cell.template face_tangent_vector(i, 1)); } } } diff --git a/source/fe/mapping_fe_field.cc b/source/fe/mapping_fe_field.cc index b13539d37e..b8e4f2a058 100644 --- a/source/fe/mapping_fe_field.cc +++ b/source/fe/mapping_fe_field.cc @@ -604,10 +604,9 @@ MappingFEField::compute_face_data( for (unsigned int i = 0; i < n_faces; ++i) { data.unit_tangentials[i].resize(n_original_q_points); - std::fill( - data.unit_tangentials[i].begin(), - data.unit_tangentials[i].end(), - reference_cell.template unit_tangential_vectors(i, 0)); + std::fill(data.unit_tangentials[i].begin(), + data.unit_tangentials[i].end(), + reference_cell.template face_tangent_vector(i, 0)); if (dim > 2) { data.unit_tangentials[n_faces + i].resize( @@ -615,7 +614,7 @@ MappingFEField::compute_face_data( std::fill( data.unit_tangentials[n_faces + i].begin(), data.unit_tangentials[n_faces + i].end(), - reference_cell.template unit_tangential_vectors(i, 1)); + reference_cell.template face_tangent_vector(i, 1)); } } } diff --git a/tests/simplex/orientation_03.cc b/tests/simplex/orientation_03.cc index a80a54fac1..3a6a8d65db 100644 --- a/tests/simplex/orientation_03.cc +++ b/tests/simplex/orientation_03.cc @@ -42,7 +42,7 @@ test_face(const std::vector> &vertices_, face_n, i, numbers::default_geometric_orientation)); extra_vertex /= 3.0; - extra_vertex += ref_cell.template unit_normal_vectors<3>(face_n); + extra_vertex += ref_cell.template face_normal_vector<3>(face_n); vertices.push_back(extra_vertex); diff --git a/tests/simplex/orientation_04.cc b/tests/simplex/orientation_04.cc index fae603c31d..3704c6e5ef 100644 --- a/tests/simplex/orientation_04.cc +++ b/tests/simplex/orientation_04.cc @@ -60,7 +60,7 @@ create_triangulation(const std::vector> &vertices_, face_n, i, numbers::default_geometric_orientation)); extra_vertex /= 3.0; - extra_vertex += ref_cell.template unit_normal_vectors<3>(face_n); + extra_vertex += ref_cell.template face_normal_vector<3>(face_n); vertices.push_back(extra_vertex); diff --git a/tests/simplex/unit_tangential_vectors_01.cc b/tests/simplex/unit_tangential_vectors_01.cc index fd88d06541..a115116ff1 100644 --- a/tests/simplex/unit_tangential_vectors_01.cc +++ b/tests/simplex/unit_tangential_vectors_01.cc @@ -13,7 +13,7 @@ // ------------------------------------------------------------------------ -// Test ReferenceCell::unit_tangential_vectors() and ::unit_normal_vectors() +// Test ReferenceCell::face_tangent_vector() and ::face_normal_vector() // for all reference-cell types. @@ -30,12 +30,11 @@ test(const ReferenceCell &reference_cell) { for (const auto face_no : reference_cell.face_indices()) { - deallog << reference_cell.template unit_normal_vectors(face_no) + deallog << reference_cell.template face_normal_vector(face_no) << std::endl; for (unsigned int i = 0; i < dim - 1; ++i) - deallog << reference_cell.template unit_tangential_vectors(face_no, - i) + deallog << reference_cell.template face_tangent_vector(face_no, i) << std::endl; } deallog << std::endl; -- 2.39.5