OGS
LocalAssemblerFactory.h
Go to the documentation of this file.
1
11#pragma once
12
16
17namespace ProcessLib
18{
19namespace BoundaryConditionAndSourceTerm
20{
21template <typename LocalAssemblerInterface,
22 template <typename /* shp fct */, int /* global dim */>
23 class LocalAssemblerImplementation,
24 int GlobalDim,
25 typename... ConstructorArgs>
28 LocalAssemblerInterface,
29 NumLib::DefaultIntegrationMethodProvider,
30 ConstructorArgs...>
31{
35 ConstructorArgs...>;
36
37 template <typename ShapeFunction>
39 ShapeFunction,
41 LocalAssemblerImplementation,
43 GlobalDim,
44 ConstructorArgs...>;
45
47 {
48 template <typename ElementTraits>
49 constexpr bool operator()(ElementTraits*) const
50 {
51 return GlobalDim >= ElementTraits::ShapeFunction::DIM;
52 }
53 };
54
56 {
57 template <typename ElementTraits>
58 constexpr bool operator()(ElementTraits*) const
59 {
60 if constexpr (GlobalDim < ElementTraits::ShapeFunction::DIM)
61 {
62 return false;
63 }
64 return ElementTraits::ShapeFunction::ORDER == 2 ||
65 // points are needed for 2nd order, too
66 std::is_same_v<MeshLib::Point,
67 typename ElementTraits::Element>;
68 }
69 };
70
71public:
74 integration_method_provider,
75 const unsigned shapefunction_order)
76 : Base{dof_table, integration_method_provider}
77 {
78 if (shapefunction_order < 1 || 2 < shapefunction_order)
79 {
80 OGS_FATAL("The given shape function order {:d} is not supported",
81 shapefunction_order);
82 }
83
84 if (shapefunction_order == 1)
85 {
86 // 1st order is enabled on all elements with suitable dimension
87 using EnabledElementTraits =
89 std::declval<HasSuitableDimension>()));
90
92 [this]<typename ET>(ET*)
93 {
94 using MeshElement = typename ET::Element;
95 // this will use linear shape functions on higher order
96 // elements and the linear shape function on linear elements
97 using LowerOrderShapeFunction =
98 typename ET::LowerOrderShapeFunction;
99 Base::_builders[std::type_index(typeid(MeshElement))] =
101 template create<MeshElement>();
102 });
103 }
104 else if (shapefunction_order == 2)
105 {
106 // 2nd order only on 2nd order elements
107 using EnabledElementTraits =
109 std::declval<Is2ndOrderElementOfSuitableDimension>()));
110
112 [this]<typename ET>(ET*)
113 {
114 using MeshElement = typename ET::Element;
115 using ShapeFunction2ndOrder = typename ET::ShapeFunction;
116 Base::_builders[std::type_index(typeid(MeshElement))] =
118 template create<MeshElement>();
119 });
120 }
121 }
122};
123
124} // namespace BoundaryConditionAndSourceTerm
125} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
LocalAssemblerFactory(NumLib::LocalToGlobalIndexMap const &dof_table, NumLib::DefaultIntegrationMethodProvider const &integration_method_provider, const unsigned shapefunction_order)
void foreach(Function &&f)
Definition TMP.h:157
decltype(auto) filter(Pred pred)
Definition TMP.h:78
TemplateElement< PointRule1 > Point
Definition Point.h:20