9#include <kernel/shape.hpp>
10#include <kernel/util/tiny_algebra.hpp>
14namespace FEAT::Geometry::Intern
22 template<
typename Shape_>
23 static std::array<Real, Shape::FaceTraits<Shape_, 0>::count>
24 vertex_coefficients(
const Tiny::Vector<Real, Shape_::dimension>& vertex)
26 static_assert(Shape_::dimension >= 1,
"Can't determine vertex coefficients for shape of this dimension!");
27 static_assert(Shape_::dimension <= 3,
"Can't determine vertex coefficients for shape of this dimension!");
29 static constexpr int size = Shape::FaceTraits<Shape_, 0>::count;
31 if constexpr(Shape_::dimension == 1)
33 const Real x = vertex[0];
35 return std::array<Real, size>{
41 if constexpr(Shape_::dimension == 2)
43 const Real x = vertex[0];
44 const Real y = vertex[1];
45 const Real xy = x * y;
47 return std::array<Real, size>{1 - x - y + xy, x - xy, y - xy, xy};
50 if constexpr(Shape_::dimension == 3)
52 const Real x = vertex[0];
53 const Real y = vertex[1];
54 const Real z = vertex[2];
55 const Real xy = x * y;
56 const Real xz = x * z;
57 const Real yz = y * z;
58 const Real xyz = x * y * z;
60 return std::array<Real, size>{
61 1 - x - y - z + xy + xz + yz - xyz,
78 template<
typename VertexType_, std::
size_t num_verts_>
79 VertexType_
static interpolate(
80 const std::array<VertexType_, num_verts_>& vertices,
81 const std::array<Real, num_verts_>& coeffs)
83 using CoordType =
typename VertexType_::ValueType;
84 VertexType_ result(0);
85 for(
Index i = 0; i < num_verts_; i++)
87 result += CoordType(coeffs[i]) * vertices[i];
92 template<
typename ArrayLike_>
93 static ArrayLike_ rotate_arraylike_2d(
const ArrayLike_& input)
100 result[3] = input[1];
105 template<
typename ArrayLike_>
106 static ArrayLike_ rotate_arraylike_xaxis(
const ArrayLike_& input)
110 result[0] = input[4];
111 result[1] = input[5];
112 result[2] = input[0];
113 result[3] = input[1];
114 result[4] = input[6];
115 result[5] = input[7];
116 result[6] = input[2];
117 result[7] = input[3];
122 template<
typename ArrayLike_>
123 static ArrayLike_ rotate_arraylike_yaxis(
const ArrayLike_& input)
127 result[0] = input[1];
128 result[1] = input[5];
129 result[2] = input[3];
130 result[3] = input[7];
131 result[4] = input[0];
132 result[5] = input[4];
133 result[6] = input[2];
134 result[7] = input[6];
139 template<
typename ArrayLike_>
140 static ArrayLike_ rotate_arraylike_zaxis(
const ArrayLike_& input)
144 result[0] = input[2];
145 result[1] = input[0];
146 result[2] = input[3];
147 result[3] = input[1];
148 result[4] = input[6];
149 result[5] = input[4];
150 result[6] = input[7];
151 result[7] = input[5];
double Real
Real data type.
std::uint64_t Index
Index data type.