OGS
LocalAssemblerFactoryTaylorHood.h
Go to the documentation of this file.
1
11#pragma once
12
13#include "EnabledElements.h"
15
16namespace ProcessLib
17{
18template <typename ShapeFunction,
19 typename LowerOrderShapeFunction,
20 typename LocalAssemblerInterface,
21 template <typename /* shp fct */,
22 typename /* lower order shp fct */,
23 int /* global dim */>
24 class LocalAssemblerImplementation,
25 NumLib::IntegrationMethodProvider IntegrationMethodProvider,
26 int GlobalDim,
27 typename... ConstructorArgs>
29{
31 IntegrationMethodProvider,
32 ConstructorArgs...>;
35
36 using LocAsmImpl = LocalAssemblerImplementation<ShapeFunction,
37 LowerOrderShapeFunction,
38 GlobalDim>;
39
41
42public:
45 template <typename MeshElement>
47 {
48 return [](MeshLib::Element const& e,
49 std::size_t const local_matrix_size,
50 IntegrationMethodProvider const& integration_method_provider,
51 ConstructorArgs&&... args)
52 {
53 auto const& integration_method =
54 integration_method_provider
55 .template getIntegrationMethod<MeshElement>(e);
56
57 static_assert(std::is_constructible_v<LocAsmImpl,
58 MeshLib::Element const&,
59 std::size_t,
60 decltype(integration_method),
61 ConstructorArgs&&...>,
62 "The given local assembler implementation is not "
63 "constructible from the provided arguments.");
64
65 return std::make_unique<LocAsmImpl>(
66 e,
67 local_matrix_size,
68 integration_method,
69 std::forward<ConstructorArgs>(args)...);
70 };
71 }
72};
73
85template <int MinShapeFctOrder,
86 int MinElementDim,
87 typename LocalAssemblerInterface,
88 template <typename /* shp fct */,
89 typename /* lower order shp fct */,
90 int /* global dim */>
91 class LocalAssemblerImplementation,
92 NumLib::IntegrationMethodProvider IntegrationMethodProvider,
93 int GlobalDim,
94 typename... ConstructorArgs>
96 : public ProcessLib::GenericLocalAssemblerFactory<LocalAssemblerInterface,
97 IntegrationMethodProvider,
98 ConstructorArgs...>
99{
100 using Base =
102 IntegrationMethodProvider,
103 ConstructorArgs...>;
104
105 template <typename ShapeFunction, typename LowerOrderShapeFunction>
108 LowerOrderShapeFunction,
110 LocalAssemblerImplementation,
111 IntegrationMethodProvider,
112 GlobalDim,
113 ConstructorArgs...>;
114
116 {
117 template <typename ElementTraits>
118 constexpr bool operator()(ElementTraits*) const
119 {
120 if constexpr (GlobalDim < ElementTraits::ShapeFunction::DIM)
121 {
122 return false;
123 }
124
125 if constexpr (ElementTraits::Element::dimension < MinElementDim)
126 {
127 return false;
128 }
129
130 return ElementTraits::ShapeFunction::ORDER >= MinShapeFctOrder;
131 }
132 };
133
134public:
136 NumLib::LocalToGlobalIndexMap const& dof_table,
137 IntegrationMethodProvider const& integration_method_provider)
138 : Base{dof_table, integration_method_provider}
139 {
140 using EnabledElementTraits =
141 decltype(BaseLib::TMP::filter<EnabledElementTraitsLagrange>(
142 std::declval<IsElementEnabled>()));
143
144 BaseLib::TMP::foreach<EnabledElementTraits>(
145 [this]<typename ET>(ET*)
146 {
147 using MeshElement = typename ET::Element;
148 using ShapeFunction = typename ET::ShapeFunction;
149 using LowerOrderShapeFunction =
150 typename ET::LowerOrderShapeFunction;
151
152 Base::_builders[std::type_index(typeid(MeshElement))] =
153 LocAsmBuilderFactory<ShapeFunction,
154 LowerOrderShapeFunction>::
155 template create<MeshElement>();
156 });
157 }
158};
159
161template <typename LocalAssemblerInterface,
162 template <typename /* shp fct */,
163 typename /* lower order shp fct */,
164 int /* global dim */>
165 class LocalAssemblerImplementation,
166 NumLib::IntegrationMethodProvider IntegrationMethodProvider,
167 int GlobalDim,
168 typename... ConstructorArgs>
170 LocalAssemblerFactoryTaylorHood<1 /* also on linear elements */,
171 2 /* only in 2D and 3D */,
172 LocalAssemblerInterface,
173 LocalAssemblerImplementation,
174 IntegrationMethodProvider,
175 GlobalDim,
176 ConstructorArgs...>;
177
179template <typename LocalAssemblerInterface,
180 template <typename /* shp fct */,
181 typename /* lower order shp fct */,
182 int /* global dim */>
183 class LocalAssemblerImplementation,
184 NumLib::IntegrationMethodProvider IntegrationMethodProvider,
185 int GlobalDim,
186 typename... ConstructorArgs>
188 LocalAssemblerFactoryTaylorHood<2 /* only for higher-order elements */,
189 2 /* only in 2D and 3D */,
190 LocalAssemblerInterface,
191 LocalAssemblerImplementation,
192 IntegrationMethodProvider,
193 GlobalDim,
194 ConstructorArgs...>;
195
196} // namespace ProcessLib
LocalAssemblerImplementation< ShapeFunction, LowerOrderShapeFunction, GlobalDim > LocAsmImpl
LocalAssemblerFactoryTaylorHood(NumLib::LocalToGlobalIndexMap const &dof_table, IntegrationMethodProvider const &integration_method_provider)
std::function< LocAsmIntfPtr(MeshLib::Element const &e, std::size_t const local_matrix_size, IntegrationMethodProvider const &integration_method_provider, ConstructorArgs &&...)> LocAsmBuilder