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_abstract_v<LocAsmImpl>,
58 "The given local assembler implementation is an "
59 "abstract class, which cannot be instantiated. Make "
60 "sure to implement all virtual methods!");
61
62 static_assert(std::is_constructible_v<LocAsmImpl,
63 MeshLib::Element const&,
64 std::size_t,
65 decltype(integration_method),
66 ConstructorArgs&&...>,
67 "The given local assembler implementation is not "
68 "constructible from the provided arguments.");
69
70 return std::make_unique<LocAsmImpl>(
71 e,
72 local_matrix_size,
73 integration_method,
74 std::forward<ConstructorArgs>(args)...);
75 };
76 }
77};
78
90template <int MinShapeFctOrder,
91 int MinElementDim,
92 typename LocalAssemblerInterface,
93 template <typename /* shp fct */,
94 typename /* lower order shp fct */,
95 int /* global dim */>
96 class LocalAssemblerImplementation,
97 NumLib::IntegrationMethodProvider IntegrationMethodProvider,
98 int GlobalDim,
99 typename... ConstructorArgs>
101 : public ProcessLib::GenericLocalAssemblerFactory<LocalAssemblerInterface,
102 IntegrationMethodProvider,
103 ConstructorArgs...>
104{
105 using Base =
107 IntegrationMethodProvider,
108 ConstructorArgs...>;
109
110 template <typename ShapeFunction, typename LowerOrderShapeFunction>
113 LowerOrderShapeFunction,
115 LocalAssemblerImplementation,
116 IntegrationMethodProvider,
117 GlobalDim,
118 ConstructorArgs...>;
119
121 {
122 template <typename ElementTraits>
123 constexpr bool operator()(ElementTraits*) const
124 {
125 if constexpr (GlobalDim < ElementTraits::ShapeFunction::DIM)
126 {
127 return false;
128 }
129
130 if constexpr (ElementTraits::Element::dimension < MinElementDim)
131 {
132 return false;
133 }
134
135 return ElementTraits::ShapeFunction::ORDER >= MinShapeFctOrder;
136 }
137 };
138
139public:
141 NumLib::LocalToGlobalIndexMap const& dof_table,
142 IntegrationMethodProvider const& integration_method_provider)
143 : Base{dof_table, integration_method_provider}
144 {
145 using EnabledElementTraits =
146 decltype(BaseLib::TMP::filter<EnabledElementTraitsLagrange>(
147 std::declval<IsElementEnabled>()));
148
149 BaseLib::TMP::foreach<EnabledElementTraits>(
150 [this]<typename ET>(ET*)
151 {
152 using MeshElement = typename ET::Element;
153 using ShapeFunction = typename ET::ShapeFunction;
154 using LowerOrderShapeFunction =
155 typename ET::LowerOrderShapeFunction;
156
157 Base::_builders[std::type_index(typeid(MeshElement))] =
158 LocAsmBuilderFactory<ShapeFunction,
159 LowerOrderShapeFunction>::
160 template create<MeshElement>();
161 });
162 }
163};
164
166template <typename LocalAssemblerInterface,
167 template <typename /* shp fct */,
168 typename /* lower order shp fct */,
169 int /* global dim */>
170 class LocalAssemblerImplementation,
171 NumLib::IntegrationMethodProvider IntegrationMethodProvider,
172 int GlobalDim,
173 typename... ConstructorArgs>
175 LocalAssemblerFactoryTaylorHood<1 /* also on linear elements */,
176 2 /* only in 2D and 3D */,
177 LocalAssemblerInterface,
178 LocalAssemblerImplementation,
179 IntegrationMethodProvider,
180 GlobalDim,
181 ConstructorArgs...>;
182
184template <typename LocalAssemblerInterface,
185 template <typename /* shp fct */,
186 typename /* lower order shp fct */,
187 int /* global dim */>
188 class LocalAssemblerImplementation,
189 NumLib::IntegrationMethodProvider IntegrationMethodProvider,
190 int GlobalDim,
191 typename... ConstructorArgs>
193 LocalAssemblerFactoryTaylorHood<2 /* only for higher-order elements */,
194 2 /* only in 2D and 3D */,
195 LocalAssemblerInterface,
196 LocalAssemblerImplementation,
197 IntegrationMethodProvider,
198 GlobalDim,
199 ConstructorArgs...>;
200
201} // 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