From: Martin Kronbichler Date: Fri, 28 Feb 2020 18:27:16 +0000 (+0100) Subject: Add constexpr array with unit tangential vectors X-Git-Tag: v9.2.0-rc1~492^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58ae90dba3dcd3e1beb8bc43bd45b7f01c8a09c2;p=dealii.git Add constexpr array with unit tangential vectors --- diff --git a/include/deal.II/base/geometry_info.h b/include/deal.II/base/geometry_info.h index 34766592b4..b53b6c57a5 100644 --- a/include/deal.II/base/geometry_info.h +++ b/include/deal.II/base/geometry_info.h @@ -68,6 +68,12 @@ namespace internal return {{Tensor<1, 1>{{-1}}, Tensor<1, 1>{{1}}}}; } + static constexpr std::array, 0>, 2> + unit_tangential_vectors() + { + return {{{}, {}}}; + } + static constexpr std::array opposite_face() { @@ -117,6 +123,15 @@ namespace internal Tensor<1, 2>{{0., 1.}}}}; } + static constexpr std::array, 1>, 4> + unit_tangential_vectors() + { + return {{{Tensor<1, 2>{{0, -1}}}, + {Tensor<1, 2>{{0, 1}}}, + {Tensor<1, 2>{{1, 0}}}, + {Tensor<1, 2>{{-1, 0}}}}}; + } + static constexpr std::array opposite_face() { @@ -168,6 +183,17 @@ namespace internal Tensor<1, 3>{{0, 0, 1}}}}; } + static constexpr std::array, 2>, 6> + unit_tangential_vectors() + { + return {{{Tensor<1, 3>{{0, -1, 0}}, Tensor<1, 3>{{0, 0, 1}}}, + {Tensor<1, 3>{{0, 1, 0}}, Tensor<1, 3>{{0, 0, 1}}}, + {Tensor<1, 3>{{0, 0, -1}}, Tensor<1, 3>{{1, 0, 0}}}, + {Tensor<1, 3>{{0, 0, 1}}, Tensor<1, 3>{{1, 0, 0}}}, + {Tensor<1, 3>{{-1, 0, 0}}, Tensor<1, 3>{{0, 1, 0}}}, + {Tensor<1, 3>{{1, 0, 0}}, Tensor<1, 3>{{0, 1, 0}}}}}; + } + static constexpr std::array opposite_face() { @@ -243,6 +269,35 @@ namespace internal Tensor<1, 4>{{0, 0, 0, 1}}}}; } + static constexpr std::array, 3>, 8> + unit_tangential_vectors() + { + return {{{Tensor<1, 4>{{0, -1, 0, 0}}, + Tensor<1, 4>{{0, 0, 1, 0}}, + Tensor<1, 4>{{0, 0, 0, 1}}}, + {Tensor<1, 4>{{0, 1, 0, 0}}, + Tensor<1, 4>{{0, 0, 1, 0}}, + Tensor<1, 4>{{0, 0, 0, 1}}}, + {Tensor<1, 4>{{0, 0, -1, 0}}, + Tensor<1, 4>{{0, 0, 0, 1}}, + Tensor<1, 4>{{1, 0, 0, 0}}}, + {Tensor<1, 4>{{0, 0, 1, 0}}, + Tensor<1, 4>{{0, 0, 0, 1}}, + Tensor<1, 4>{{1, 0, 0, 0}}}, + {Tensor<1, 4>{{0, 0, 0, -1}}, + Tensor<1, 4>{{1, 0, 0, 0}}, + Tensor<1, 4>{{0, 1, 0, 0}}}, + {Tensor<1, 4>{{0, 0, 0, 1}}, + Tensor<1, 4>{{1, 0, 0, 0}}, + Tensor<1, 4>{{0, 1, 0, 0}}}, + {Tensor<1, 4>{{-1, 0, 0, 0}}, + Tensor<1, 4>{{0, 1, 0, 0}}, + Tensor<1, 4>{{0, 0, 1, 0}}}, + {Tensor<1, 4>{{1, 0, 0, 0}}, + Tensor<1, 4>{{0, 1, 0, 0}}, + Tensor<1, 4>{{0, 0, 1, 0}}}}}; + } + static constexpr std::array opposite_face() { @@ -2433,6 +2488,24 @@ struct GeometryInfo unit_normal_vector = internal::GeometryInfoHelper::Initializers::unit_normal_vector(); + /** + * Unit tangential vectors (array of `dim-1` elements of Point) of a + * face of the reference cell, arranged in a right-hand coordinate system + * such that the cross product between the two vectors return the unit + * normal vector. + * + * Note that this is only the standard orientation of faces. At + * least in 3d, actual faces of cells in a triangulation can also have the + * opposite orientation, depending on a flag that one can query from the + * cell it belongs to. For more information, see the + * @ref GlossFaceOrientation "glossary" + * entry on face orientation. + */ + static constexpr std::array, dim - 1>, + faces_per_cell> + unit_tangential_vectors = internal::GeometryInfoHelper::Initializers< + dim>::unit_tangential_vectors(); + /** * List of numbers which denotes which face is opposite to a given face. Its * entries are the first 2*dim entries of { 1, 0, 3, 2, 5, 4, diff --git a/source/base/geometry_info.cc b/source/base/geometry_info.cc index 5eb6212816..3ffd615398 100644 --- a/source/base/geometry_info.cc +++ b/source/base/geometry_info.cc @@ -57,6 +57,11 @@ template constexpr std::array, GeometryInfo::faces_per_cell> GeometryInfo::unit_normal_vector; +template +constexpr std::array, dim - 1>, + GeometryInfo::faces_per_cell> + GeometryInfo::unit_tangential_vectors; + template constexpr std::array::vertices_per_cell> GeometryInfo::dx_to_deal;