OGS
LocalAssemblerFactory.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
9
10namespace ProcessLib
11{
13{
14template <typename LocalAssemblerInterface,
15 template <typename /* shp fct */, int /* global dim */>
16 class LocalAssemblerImplementation,
17 int GlobalDim,
18 typename... ConstructorArgs>
21 LocalAssemblerInterface,
22 NumLib::DefaultIntegrationMethodProvider,
23 ConstructorArgs...>
24{
28 ConstructorArgs...>;
29
30 template <typename ShapeFunction>
34 LocalAssemblerImplementation,
36 GlobalDim,
37 ConstructorArgs...>;
38
40 {
41 template <typename ElementTraits>
42 constexpr bool operator()(ElementTraits*) const
43 {
44 return GlobalDim >= ElementTraits::ShapeFunction::DIM;
45 }
46 };
47
49 {
50 template <typename ElementTraits>
51 constexpr bool operator()(ElementTraits*) const
52 {
53 if constexpr (GlobalDim < ElementTraits::ShapeFunction::DIM)
54 {
55 return false;
56 }
57 return ElementTraits::ShapeFunction::ORDER == 2 ||
58 // points are needed for 2nd order, too
59 std::is_same_v<MeshLib::Point,
60 typename ElementTraits::Element>;
61 }
62 };
63
64public:
67 integration_method_provider,
68 const unsigned shapefunction_order)
69 : Base{dof_table, integration_method_provider}
70 {
71 if (shapefunction_order < 1 || 2 < shapefunction_order)
72 {
73 OGS_FATAL("The given shape function order {:d} is not supported",
74 shapefunction_order);
75 }
76
77 if (shapefunction_order == 1)
78 {
79 // 1st order is enabled on all elements with suitable dimension
80 using EnabledElementTraits =
82 std::declval<HasSuitableDimension>()));
83
85 [this]<typename ET>(ET*)
86 {
87 using MeshElement = typename ET::Element;
88 // this will use linear shape functions on higher order
89 // elements and the linear shape function on linear elements
90 using LowerOrderShapeFunction =
91 typename ET::LowerOrderShapeFunction;
92 Base::_builders[std::type_index(typeid(MeshElement))] =
94 template create<MeshElement>();
95 });
96 }
97 else if (shapefunction_order == 2)
98 {
99 // 2nd order only on 2nd order elements
100 using EnabledElementTraits =
102 std::declval<Is2ndOrderElementOfSuitableDimension>()));
103
105 [this]<typename ET>(ET*)
106 {
107 using MeshElement = typename ET::Element;
108 using ShapeFunction2ndOrder = typename ET::ShapeFunction;
109 Base::_builders[std::type_index(typeid(MeshElement))] =
111 template create<MeshElement>();
112 });
113 }
114 }
115};
116
117} // namespace BoundaryConditionAndSourceTerm
118} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:19
ProcessLib::GenericLocalAssemblerFactory< LocalAssemblerInterface, NumLib::DefaultIntegrationMethodProvider, ConstructorArgs... > Base
ProcessLib::LocalAssemblerBuilderFactory< ShapeFunction, LocalAssemblerInterface, LocalAssemblerImplementation, NumLib::DefaultIntegrationMethodProvider, GlobalDim, ConstructorArgs... > LocAsmBuilderFactory
LocalAssemblerFactory(NumLib::LocalToGlobalIndexMap const &dof_table, NumLib::DefaultIntegrationMethodProvider const &integration_method_provider, const unsigned shapefunction_order)
void foreach(Function &&f)
Definition TMP.h:150
decltype(auto) filter(Pred pred)
Definition TMP.h:71
TemplateElement< PointRule1 > Point