OGS
LocalAssemblerFactoryTaylorHood.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
6#include "EnabledElements.h"
8
9namespace ProcessLib
10{
11template <typename ShapeFunction,
12 typename LowerOrderShapeFunction,
14 template <typename /* shp fct */,
15 typename /* lower order shp fct */,
16 int /* global dim */>
17 class LocalAssemblerImplementation,
18 NumLib::IntegrationMethodProvider IntegrationMethodProvider,
19 int GlobalDim,
20 typename... ConstructorArgs>
22{
24 IntegrationMethodProvider,
25 ConstructorArgs...>;
28
29 using LocAsmImpl = LocalAssemblerImplementation<ShapeFunction,
30 LowerOrderShapeFunction,
31 GlobalDim>;
32
34
35public:
38 template <typename MeshElement>
40 {
41 return [](MeshLib::Element const& e,
42 std::size_t const local_matrix_size,
43 IntegrationMethodProvider const& integration_method_provider,
44 ConstructorArgs&&... args)
45 {
46 auto const& integration_method =
47 integration_method_provider
48 .template getIntegrationMethod<MeshElement>(e);
49
50 static_assert(!std::is_abstract_v<LocAsmImpl>,
51 "The given local assembler implementation is an "
52 "abstract class, which cannot be instantiated. Make "
53 "sure to implement all virtual methods!");
54
55 static_assert(std::is_constructible_v<LocAsmImpl,
56 MeshLib::Element const&,
57 std::size_t,
58 decltype(integration_method),
59 ConstructorArgs&&...>,
60 "The given local assembler implementation is not "
61 "constructible from the provided arguments.");
62
63 return std::make_unique<LocAsmImpl>(
64 e,
65 local_matrix_size,
66 integration_method,
67 std::forward<ConstructorArgs>(args)...);
68 };
69 }
70};
71
83template <int MinShapeFctOrder,
84 int MinElementDim,
85 typename LocalAssemblerInterface,
86 template <typename /* shp fct */,
87 typename /* lower order shp fct */,
88 int /* global dim */>
89 class LocalAssemblerImplementation,
90 NumLib::IntegrationMethodProvider IntegrationMethodProvider,
91 int GlobalDim,
92 typename... ConstructorArgs>
94 : public ProcessLib::GenericLocalAssemblerFactory<LocalAssemblerInterface,
95 IntegrationMethodProvider,
96 ConstructorArgs...>
97{
98 using Base =
100 IntegrationMethodProvider,
101 ConstructorArgs...>;
102
103 template <typename ShapeFunction, typename LowerOrderShapeFunction>
106 LowerOrderShapeFunction,
108 LocalAssemblerImplementation,
109 IntegrationMethodProvider,
110 GlobalDim,
111 ConstructorArgs...>;
112
114 {
115 template <typename ElementTraits>
116 constexpr bool operator()(ElementTraits*) const
117 {
118 if constexpr (GlobalDim < ElementTraits::ShapeFunction::DIM)
119 {
120 return false;
121 }
122
123 if constexpr (ElementTraits::Element::dimension < MinElementDim)
124 {
125 return false;
126 }
127
128 return ElementTraits::ShapeFunction::ORDER >= MinShapeFctOrder;
129 }
130 };
131
132public:
134 NumLib::LocalToGlobalIndexMap const& dof_table,
135 IntegrationMethodProvider const& integration_method_provider)
136 : Base{dof_table, integration_method_provider}
137 {
138 using EnabledElementTraits =
140 std::declval<IsElementEnabled>()));
141
143 [this]<typename ET>(ET*)
144 {
145 using MeshElement = typename ET::Element;
146 using ShapeFunction = typename ET::ShapeFunction;
147 using LowerOrderShapeFunction =
148 typename ET::LowerOrderShapeFunction;
149
150 Base::_builders[std::type_index(typeid(MeshElement))] =
152 LowerOrderShapeFunction>::
153 template create<MeshElement>();
154 });
155 }
156};
157
159template <typename LocalAssemblerInterface,
160 template <typename /* shp fct */,
161 typename /* lower order shp fct */,
162 int /* global dim */>
163 class LocalAssemblerImplementation,
164 NumLib::IntegrationMethodProvider IntegrationMethodProvider,
165 int GlobalDim,
166 typename... ConstructorArgs>
168 LocalAssemblerFactoryTaylorHood<1 /* also on linear elements */,
169 2 /* only in 2D and 3D */,
170 LocalAssemblerInterface,
171 LocalAssemblerImplementation,
172 IntegrationMethodProvider,
173 GlobalDim,
174 ConstructorArgs...>;
175
177template <typename LocalAssemblerInterface,
178 template <typename /* shp fct */,
179 typename /* lower order shp fct */,
180 int /* global dim */>
181 class LocalAssemblerImplementation,
182 NumLib::IntegrationMethodProvider IntegrationMethodProvider,
183 int GlobalDim,
184 typename... ConstructorArgs>
186 LocalAssemblerFactoryTaylorHood<2 /* only for higher-order elements */,
187 2 /* only in 2D and 3D */,
188 LocalAssemblerInterface,
189 LocalAssemblerImplementation,
190 IntegrationMethodProvider,
191 GlobalDim,
192 ConstructorArgs...>;
193
194} // namespace ProcessLib
LocalAssemblerImplementation< ShapeFunction, LowerOrderShapeFunction, GlobalDim > LocAsmImpl
GenericLocalAssemblerFactory< LocalAssemblerInterface, IntegrationMethodProvider, ConstructorArgs... > GLAF
LocalAssemblerFactoryTaylorHood(NumLib::LocalToGlobalIndexMap const &dof_table, IntegrationMethodProvider const &integration_method_provider)
LocalAssemblerBuilderFactoryTaylorHood< ShapeFunction, LowerOrderShapeFunction, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs... > LocAsmBuilderFactory
void foreach(Function &&f)
Definition TMP.h:150
decltype(auto) filter(Pred pred)
Definition TMP.h:71
LocalAssemblerFactoryTaylorHood< 2, 2, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs... > LocalAssemblerFactoryStokes
Stokes flow in OGS is defined for higher order elements only.
LocalAssemblerFactoryTaylorHood< 1, 2, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs... > LocalAssemblerFactoryHM
HM processes in OGS are defined for linear and higher order elements.
std::function< LocAsmIntfPtr(MeshLib::Element const &e, std::size_t const local_matrix_size, IntegrationMethodProvider const &integration_method_provider, ConstructorArgs &&...)> LocAsmBuilder