OGS
EnabledElements.h
Go to the documentation of this file.
1
11#pragma once
12
14
15#ifndef OGS_MAX_ELEMENT_DIM
16static_assert(false, "The macro OGS_MAX_ELEMENT_DIM is undefined.");
17#endif
18
19#ifndef OGS_MAX_ELEMENT_ORDER
20static_assert(false, "The macro OGS_MAX_ELEMENT_ORDER is undefined.");
21#endif
22
23namespace ProcessLib
24{
25namespace detail
26{
27static constexpr bool enable_element_type_simplex =
28#ifdef OGS_ENABLE_ELEMENT_SIMPLEX
29 true;
30#else
31 false;
32#endif
33
34static constexpr bool enable_element_type_cuboid =
35#ifdef OGS_ENABLE_ELEMENT_CUBOID
36 true;
37#else
38 false;
39#endif
40
41static constexpr bool enable_element_type_prism =
42#ifdef OGS_ENABLE_ELEMENT_PRISM
43 true;
44#else
45 false;
46#endif
47
48static constexpr bool enable_element_type_pyramid =
49#ifdef OGS_ENABLE_ELEMENT_PYRAMID
50 true;
51#else
52 false;
53#endif
54
55// Faces of tets, pyramids and prisms are triangles
59
60// Faces of hexes, pyramids and prisms are quads
64
65using ZeroOrOneD = std::tuple<MeshLib::Point, MeshLib::Line, MeshLib::Line3>;
66
69
70using Simplices =
71 std::tuple<MeshLib::Tri, MeshLib::Tri6, MeshLib::Tet, MeshLib::Tet10>;
72
73using Prisms = std::tuple<MeshLib::Prism, MeshLib::Prism15>;
74
75using Pyramids = std::tuple<MeshLib::Pyramid, MeshLib::Pyramid13>;
76
77using Triangles = std::tuple<MeshLib::Tri, MeshLib::Tri6>;
78
79using Quads = std::tuple<MeshLib::Quad, MeshLib::Quad8, MeshLib::Quad9>;
80
85template <typename Elements, typename Element>
86constexpr bool isElementEnabledImpl(bool is_group_enabled)
87{
88 return BaseLib::TMP::contains<Elements, Element>() && is_group_enabled;
89}
90
91auto constexpr isElementEnabled = []<typename ElementTraits>(ElementTraits*)
92{
93 using Element = typename ElementTraits::Element;
94
95 if constexpr (ElementTraits::ShapeFunction::ORDER > OGS_MAX_ELEMENT_ORDER)
96 {
97 return false;
98 }
99 if constexpr (Element::dimension > OGS_MAX_ELEMENT_DIM)
100 {
101 return false;
102 }
103
104 return isElementEnabledImpl<ZeroOrOneD, Element>(true) ||
105 isElementEnabledImpl<Cuboids, Element>(enable_element_type_cuboid) ||
106 isElementEnabledImpl<Simplices, Element>(
108 isElementEnabledImpl<Prisms, Element>(enable_element_type_prism) ||
109 isElementEnabledImpl<Pyramids, Element>(
111 isElementEnabledImpl<Triangles, Element>(enable_element_type_tri) ||
112 isElementEnabledImpl<Quads, Element>(enable_element_type_quad);
113};
114
115} // namespace detail
116
120 decltype(BaseLib::TMP::filter<NumLib::AllElementTraitsLagrange>(
122} // namespace ProcessLib
TemplateElement< MeshLib::QuadRule9 > Quad9
Definition Quad.h:30
TemplateElement< MeshLib::QuadRule8 > Quad8
Definition Quad.h:29
TemplateElement< MeshLib::QuadRule4 > Quad
Definition Quad.h:28
TemplateElement< MeshLib::HexRule8 > Hex
Definition Hex.h:25
std::tuple< MeshLib::Quad, MeshLib::Quad8, MeshLib::Quad9 > Quads
std::tuple< MeshLib::Prism, MeshLib::Prism15 > Prisms
constexpr bool isElementEnabledImpl(bool is_group_enabled)
std::tuple< MeshLib::Quad, MeshLib::Quad8, MeshLib::Quad9, MeshLib::Hex, MeshLib::Hex20 > Cuboids
std::tuple< MeshLib::Pyramid, MeshLib::Pyramid13 > Pyramids
std::tuple< MeshLib::Tri, MeshLib::Tri6, MeshLib::Tet, MeshLib::Tet10 > Simplices
static constexpr bool enable_element_type_tri
std::tuple< MeshLib::Point, MeshLib::Line, MeshLib::Line3 > ZeroOrOneD
static constexpr bool enable_element_type_cuboid
auto constexpr isElementEnabled
static constexpr bool enable_element_type_pyramid
static constexpr bool enable_element_type_simplex
std::tuple< MeshLib::Tri, MeshLib::Tri6 > Triangles
static constexpr bool enable_element_type_prism
static constexpr bool enable_element_type_quad
decltype(BaseLib::TMP::filter< NumLib::AllElementTraitsLagrange >( detail::isElementEnabled)) EnabledElementTraitsLagrange