21 static_assert(Dim == 2 || Dim == 3,
"ReferenceElement exists for Dim = 2 and Dim = 3");
26 static constexpr int kDim = Dim;
38 if (i > 0) x(i - 1) = 1.0;
42 [[nodiscard]]
static constexpr Real volume() noexcept {
return Dim == 2 ? 0.5 : 1.0 / 6.0; }
48 [[nodiscard]]
static std::array<Real, static_cast<std::size_t>(Dim + 1)>
barycentric(
50 std::array<Real, static_cast<std::size_t>(Dim + 1)> lambda{};
52 for (
int d = 0; d < Dim; ++d) {
53 lambda[
static_cast<std::size_t
>(d + 1)] = xi(d);
59 [[nodiscard]]
static std::array<Point<Dim>,
static_cast<std::size_t
>(Dim + 1)>
61 std::array<Point<Dim>,
static_cast<std::size_t
>(Dim + 1)> grad;
63 for (
int d = 0; d < Dim; ++d) {
65 grad[
static_cast<std::size_t
>(d + 1)](d) = 1.0;
72 if (l < -tol)
return false;
84 n(opposite - 1) = -1.0;
91 if constexpr (Dim == 2) {
92 return slanted ? std::sqrt(2.0) : 1.0;
94 return slanted ? std::sqrt(3.0) / 2.0 : 0.5;
102 return static_cast<LocalIndex>(Dim * (Dim + 1) / 2 - sum);
111 for (
int j = 0; j < Dim - 1; ++j) {
112 x += eta(j) * (
vertex(fv[
static_cast<std::size_t
>(j + 1)]) -
vertex(fv[0]));
#define HPFEM_ASSERT(cond, msg)
Definition error.hpp:48
Definition cell_layout.hpp:13
double Real
Definition types.hpp:15
Eigen::Matrix< Real, Dim, 1 > Point
Definition types.hpp:27
std::int32_t LocalIndex
element-local indices
Definition types.hpp:18
Geometry and numbering of the reference simplex in Dim dimensions.
Definition reference_element.hpp:20
static std::array< Point< Dim >, static_cast< std::size_t >(Dim+1)> barycentric_gradients()
Constant reference gradients .
Definition reference_element.hpp:60
static constexpr LocalIndex kNumEdges
Definition reference_element.hpp:28
static constexpr Real volume() noexcept
Measure of the reference simplex: 1/2 (triangle), 1/6 (tetrahedron).
Definition reference_element.hpp:42
static bool contains(const Point< Dim > &xi, Real tol=1e-12)
True if all barycentric coordinates are (closed simplex).
Definition reference_element.hpp:70
static constexpr LocalIndex kNumFacets
Definition reference_element.hpp:29
Point< Dim - 1 > FacetPoint
point of the reference facet ([0,1] or triangle)
Definition reference_element.hpp:24
static Point< Dim > edge_point(LocalIndex k, Real t)
Point at parameter t ∈ [0,1] on local edge k, from kEdgeVertices[k][0] to [1].
Definition reference_element.hpp:117
static Point< Dim > facet_normal(LocalIndex k)
Outward unit normal of local facet k.
Definition reference_element.hpp:78
static Point< Dim > vertex(LocalIndex i)
Vertex i: , the i-th unit vector.
Definition reference_element.hpp:35
static constexpr const auto & kEdgeVertices
Local vertices of each edge / facet: the binding tables of mesh::SimplexTopology.
Definition reference_element.hpp:31
static Real facet_measure(LocalIndex k)
Measure of local facet k in reference coordinates (length in 2D, area in 3D).
Definition reference_element.hpp:88
static Point< Dim > facet_point(LocalIndex k, const FacetPoint &eta)
Definition reference_element.hpp:107
static Point< Dim > centroid()
Definition reference_element.hpp:43
static std::array< Real, static_cast< std::size_t >(Dim+1)> barycentric(const Point< Dim > &xi)
Barycentric coordinates .
Definition reference_element.hpp:48
static LocalIndex opposite_vertex(LocalIndex k)
Local vertex opposite facet k (the one not contained in it).
Definition reference_element.hpp:98
static constexpr int kDim
Definition reference_element.hpp:26
static constexpr const auto & kFacetVertices
Definition reference_element.hpp:32
static constexpr LocalIndex kNumVertices
Definition reference_element.hpp:27
Local topology tables of the reference simplex in Dim dimensions.
Definition simplex_topology.hpp:27