version 0.4.1
fefactory.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2021-2024 The Ikarus Developers mueller@ibb.uni-stuttgart.de
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
10#pragma once
12namespace Ikarus {
22template <typename BH, typename SK, typename FER = FERequirements<>, bool useFlat = true, bool useEigenRef = false>
24{
25 using Skills = SK;
26
27private:
28 const BH* basisHandler_;
29 SK skills_;
30
31public:
37 template <typename SK2 = SK>
38 FEFactory(const BH& basisHandler, const SK2& sk)
39 : basisHandler_{&basisHandler},
40 skills_{sk} {}
41
42 auto operator()() {
43 return std::apply(
44 [&]<typename... Args>(Args&&... args) {
45 // the template would not be needed,
46 // when https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1814r0.html
47 // will be implemented in clang. It is already implemented in gcc 12.2
49 *basisHandler_, std::forward<Args>(args)...);
50
51 return fe;
52 },
53 skills_.args);
54 }
55};
56
66template <typename FER = FERequirements<>, bool useFlat = true, bool useEigenRef = false, typename BH, typename SK>
67auto makeFE(const BH& basisHandler, const SK& sk) {
68 FEFactory<BH, SK, FER, useFlat, useEigenRef> factory(basisHandler, sk);
69
70 return factory();
71}
72
83template <typename FER = FERequirements<>, bool useEigenRef = false, typename BH, typename SK>
84auto makeFEWithUnTouchedBasis(const BH& basisHandler, SK&& sk) {
85 FEFactory<BH, SK, FER, false, useEigenRef> factory(basisHandler, std::forward<SK>(sk));
86
87 return factory();
88}
89
90} // namespace Ikarus
Contains the FE class, which is used as a base class for all finite elements. It provides information...
Definition: simpleassemblers.hh:22
auto makeFEWithUnTouchedBasis(const BH &basisHandler, SK &&sk)
A function to create a finite element using the untouched version of the basis.
Definition: fefactory.hh:84
auto makeFE(const BH &basisHandler, const SK &sk)
A function to create a finite element using the flat version of the basis.
Definition: fefactory.hh:67
FE class is a base class for all finite elements.
Definition: febase.hh:81
PreFE struct acts as a convenient wrapper for the FE class to access different type traits.
Definition: febase.hh:34
FEFactory is a convenient wrapper to forward arguments to PreFE and create and construct a factory of...
Definition: fefactory.hh:24
SK Skills
Definition: fefactory.hh:25
auto operator()()
Definition: fefactory.hh:42
FEFactory(const BH &basisHandler, const SK2 &sk)
constructor for FEFactory
Definition: fefactory.hh:38