OGS
EnabledElements.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
7
8#ifndef OGS_MAX_ELEMENT_DIM
9static_assert(false, "The macro OGS_MAX_ELEMENT_DIM is undefined.");
10#endif
11
12#ifndef OGS_MAX_ELEMENT_ORDER
13static_assert(false, "The macro OGS_MAX_ELEMENT_ORDER is undefined.");
14#endif
15
16namespace ProcessLib
17{
18namespace detail
19{
20static constexpr bool enable_element_type_simplex =
21#ifdef OGS_ENABLE_ELEMENT_SIMPLEX
22 true;
23#else
24 false;
25#endif
26
27static constexpr bool enable_element_type_cuboid =
28#ifdef OGS_ENABLE_ELEMENT_CUBOID
29 true;
30#else
31 false;
32#endif
33
34static constexpr bool enable_element_type_prism =
35#ifdef OGS_ENABLE_ELEMENT_PRISM
36 true;
37#else
38 false;
39#endif
40
41static constexpr bool enable_element_type_pyramid =
42#ifdef OGS_ENABLE_ELEMENT_PYRAMID
43 true;
44#else
45 false;
46#endif
47
48// Faces of tets, pyramids and prisms are triangles
52
53// Faces of hexes, pyramids and prisms are quads
57
58using ZeroOrOneD = std::tuple<MeshLib::Point, MeshLib::Line, MeshLib::Line3>;
59
62
63using Simplices =
64 std::tuple<MeshLib::Tri, MeshLib::Tri6, MeshLib::Tet, MeshLib::Tet10>;
65
66using Prisms = std::tuple<MeshLib::Prism, MeshLib::Prism15>;
67
68using Pyramids = std::tuple<MeshLib::Pyramid, MeshLib::Pyramid13>;
69
70using Triangles = std::tuple<MeshLib::Tri, MeshLib::Tri6>;
71
72using Quads = std::tuple<MeshLib::Quad, MeshLib::Quad8, MeshLib::Quad9>;
73
78template <typename Elements, typename Element>
79constexpr bool isElementEnabledImpl(bool is_group_enabled)
80{
81 return BaseLib::TMP::contains<Elements, Element>() && is_group_enabled;
82}
83
84auto constexpr isElementEnabled = []<typename ElementTraits>(ElementTraits*)
85{
86 using Element = typename ElementTraits::Element;
87
88 if constexpr (ElementTraits::ShapeFunction::ORDER > OGS_MAX_ELEMENT_ORDER)
89 {
90 return false;
91 }
92 if constexpr (Element::dimension > OGS_MAX_ELEMENT_DIM)
93 {
94 return false;
95 }
96
106};
107
108} // namespace detail
109
115} // namespace ProcessLib
constexpr bool contains()
Returns if Type is contained in the given List of types.
Definition TMP.h:158
decltype(auto) filter(Pred pred)
Definition TMP.h:71
TemplateElement< MeshLib::QuadRule9 > Quad9
Definition Quad.h:19
TemplateElement< MeshLib::HexRule20 > Hex20
Definition Hex.h:15
TemplateElement< MeshLib::QuadRule8 > Quad8
Definition Quad.h:18
TemplateElement< MeshLib::QuadRule4 > Quad
Definition Quad.h:17
TemplateElement< MeshLib::HexRule8 > Hex
Definition Hex.h:14
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