3 #include <Caribou/config.h>
4 #include <Caribou/Geometry/BaseSegment.h>
7 namespace caribou::geometry {
9 template<UNSIGNED_INTEGER_TYPE _Dimension, UNSIGNED_INTEGER_TYPE _Order = Linear>
12 template<UNSIGNED_INTEGER_TYPE _Dimension>
14 static constexpr UNSIGNED_INTEGER_TYPE CanonicalDimension = 1;
15 static constexpr UNSIGNED_INTEGER_TYPE Dimension = _Dimension;
16 static constexpr INTEGER_TYPE NumberOfNodesAtCompileTime = 2;
17 static constexpr INTEGER_TYPE NumberOfGaussNodesAtCompileTime = 1;
29 template<UNSIGNED_INTEGER_TYPE _Dimension>
33 using LocalCoordinates =
typename Base::LocalCoordinates;
34 using WorldCoordinates =
typename Base::WorldCoordinates;
36 using GaussNode =
typename Base::GaussNode;
38 template <UNSIGNED_INTEGER_TYPE Dim>
39 using Vector =
typename Base::template Vector<Dim>;
41 template <UNSIGNED_INTEGER_TYPE Rows, UNSIGNED_INTEGER_TYPE Cols>
42 using Matrix =
typename Base::template Matrix<Rows, Cols>;
45 static constexpr
auto CanonicalDimension = Base::CanonicalDimension;
46 static constexpr
auto Dimension = Base::Dimension;
47 static constexpr
auto NumberOfNodesAtCompileTime = Base::NumberOfNodesAtCompileTime;
48 static constexpr
auto NumberOfGaussNodesAtCompileTime = Base::NumberOfGaussNodesAtCompileTime;
53 if constexpr (Dimension == 1) {
54 this->p_nodes[0] = -1;
55 this->p_nodes[1] = +1;
56 }
else if constexpr (Dimension == 2) {
57 this->p_nodes.row(0) = WorldCoordinates(-1, 0);
58 this->p_nodes.row(1) = WorldCoordinates(+1, 0);
60 this->p_nodes.row(0) = WorldCoordinates(-1, 0, 0);
61 this->p_nodes.row(1) = WorldCoordinates(+1, 0, 0);
70 inline auto get_L(
const LocalCoordinates & xi)
const -> Vector<NumberOfNodesAtCompileTime> {
71 const auto & u = xi[0];
73 static_cast<FLOATING_POINT_TYPE
>(1/2. * (1 - u)),
74 static_cast<FLOATING_POINT_TYPE
>(1/2. * (1 + u))
78 inline auto get_dL(
const LocalCoordinates & )
const -> Matrix<NumberOfNodesAtCompileTime, CanonicalDimension> {
80 static_cast<FLOATING_POINT_TYPE
>(-1/2.),
81 static_cast<FLOATING_POINT_TYPE
>(+1/2.)
85 inline auto get_gauss_nodes()
const ->
const auto & {
86 static std::vector<GaussNode> gauss_nodes {
87 GaussNode {LocalCoordinates(0), 2}
94 template<UNSIGNED_INTEGER_TYPE _Dimension>
96 static constexpr UNSIGNED_INTEGER_TYPE CanonicalDimension = 1;
97 static constexpr UNSIGNED_INTEGER_TYPE Dimension = _Dimension;
98 static constexpr INTEGER_TYPE NumberOfNodesAtCompileTime = 3;
99 static constexpr INTEGER_TYPE NumberOfGaussNodesAtCompileTime = 2;
111 template<UNSIGNED_INTEGER_TYPE _Dimension>
115 using LocalCoordinates =
typename Base::LocalCoordinates;
116 using WorldCoordinates =
typename Base::WorldCoordinates;
118 using GaussNode =
typename Base::GaussNode;
120 template <UNSIGNED_INTEGER_TYPE Dim>
121 using Vector =
typename Base::template Vector<Dim>;
123 template <UNSIGNED_INTEGER_TYPE Rows, UNSIGNED_INTEGER_TYPE Cols>
124 using Matrix =
typename Base::template Matrix<Rows, Cols>;
127 static constexpr
auto CanonicalDimension = Base::CanonicalDimension;
128 static constexpr
auto Dimension = Base::Dimension;
129 static constexpr
auto NumberOfNodesAtCompileTime = Base::NumberOfNodesAtCompileTime;
134 if constexpr (Dimension == 1) {
135 this->p_nodes[0] = -1;
136 this->p_nodes[1] = +1;
137 this->p_nodes[2] = 0;
138 }
else if constexpr (Dimension == 2) {
139 this->p_nodes.row(0) = WorldCoordinates(-1, 0);
140 this->p_nodes.row(1) = WorldCoordinates(+1, 0);
141 this->p_nodes.row(2) = WorldCoordinates( 0, 0);
143 this->p_nodes.row(0) = WorldCoordinates(-1, 0, 0);
144 this->p_nodes.row(1) = WorldCoordinates(+1, 0, 0);
145 this->p_nodes.row(2) = WorldCoordinates( 0, 0, 0);
154 inline auto get_L(
const LocalCoordinates & xi)
const -> Vector<NumberOfNodesAtCompileTime> {
155 const auto & u = xi[0];
157 static_cast<FLOATING_POINT_TYPE
>(1/2. * u * (u - 1)),
158 static_cast<FLOATING_POINT_TYPE
>(1/2. * u * (u + 1)),
159 static_cast<FLOATING_POINT_TYPE
>(1 - (u * u))
163 inline auto get_dL(
const LocalCoordinates & xi)
const -> Matrix<NumberOfNodesAtCompileTime, CanonicalDimension> {
164 const auto & u = xi[0];
166 static_cast<FLOATING_POINT_TYPE
>(u - 1/2.),
167 static_cast<FLOATING_POINT_TYPE
>(u + 1/2.),
168 static_cast<FLOATING_POINT_TYPE
>( -2 * u )
172 inline auto get_gauss_nodes()
const ->
const auto & {
173 static std::vector<GaussNode> gauss_nodes {
174 GaussNode {LocalCoordinates(-1/sqrt(3)), 1},
175 GaussNode {LocalCoordinates(+1/sqrt(3)), 1}