3 #include <Caribou/config.h>
4 #include <Caribou/constants.h>
5 #include <Caribou/Geometry/Element.h>
8 namespace caribou::geometry {
10 template<
typename Derived>
15 using LocalCoordinates =
typename Base::LocalCoordinates;
16 using WorldCoordinates =
typename Base::WorldCoordinates;
18 using GaussNode =
typename Base::GaussNode;
20 template <UNSIGNED_INTEGER_TYPE Dim>
21 using Vector =
typename Base::template Vector<Dim>;
23 template <UNSIGNED_INTEGER_TYPE Rows, UNSIGNED_INTEGER_TYPE Cols>
24 using Matrix =
typename Base::template Matrix<Rows, Cols>;
27 static constexpr
auto CanonicalDimension = Base::CanonicalDimension;
28 static constexpr
auto Dimension = Base::Dimension;
29 static constexpr
auto NumberOfNodesAtCompileTime = Base::NumberOfNodesAtCompileTime;
30 static constexpr
auto NumberOfGaussNodesAtCompileTime = Base::NumberOfGaussNodesAtCompileTime;
36 template<
typename EigenType, REQUIRES(EigenType::RowsAtCompileTime == NumberOfNodesAtCompileTime)>
40 template<
typename EigenType, REQUIRES(EigenType::RowsAtCompileTime == NumberOfNodesAtCompileTime)>
44 template<
typename EigenType,
int Options,
typename Str
ideType>
45 explicit BaseSegment(
const Eigen::Ref<EigenType, Options, StrideType> &
nodes) : p_nodes(
nodes.derived().template cast<typename
Base::Scalar>()) {}
50 REQUIRES(NumberOfNodesAtCompileTime ==
sizeof...(Nodes)+1)
52 explicit BaseSegment(
const WorldCoordinates & first_node, Nodes&&...remaining_nodes)
54 construct_from_nodes<0>(first_node, std::forward<Nodes>(remaining_nodes)...);
61 inline auto get_number_of_nodes()
const {
return NumberOfNodesAtCompileTime;}
62 inline auto get_number_of_gauss_nodes()
const {
return NumberOfGaussNodesAtCompileTime;}
63 inline auto get_node(
const UNSIGNED_INTEGER_TYPE & index)
const {
return WorldCoordinates(p_nodes.row(index));};
64 inline auto get_nodes() const -> const auto & {
return p_nodes;};
66 inline auto get_contains_local(
const LocalCoordinates & xi,
const FLOATING_POINT_TYPE & eps)
const ->
bool {
67 const auto & u = xi[0];
68 return IN_CLOSED_INTERVAL(-1-eps, u, 1+eps);
71 template <
size_t index,
typename ...Nodes, REQUIRES(
sizeof...(Nodes) >= 1)>
73 void construct_from_nodes(
const WorldCoordinates & first_node, Nodes&&...remaining_nodes) {
74 p_nodes.row(index) = first_node;
75 construct_from_nodes<index+1>(std::forward<Nodes>(remaining_nodes)...);
78 template <
size_t index>
80 void construct_from_nodes(
const WorldCoordinates & last_node) {
81 p_nodes.row(index) = last_node;
84 Matrix<NumberOfNodesAtCompileTime, Dimension> p_nodes;