17#include <dune/common/exceptions.hh>
35 mechanicalPotentialEnergy,
36 microMagneticPotentialEnergy
86 magnetizationAndVectorPotential
103requires(
sizeof...(Affordances) <= 3)
106 using Base = std::tuple<Affordances...>;
110 :
Base(affordances...) {}
124 template <FEAffordance Affordance>
126 using AffordanceRaw = std::remove_cvref_t<Affordance>;
127 if constexpr (std::is_same_v<AffordanceRaw, AffordanceCollection>)
128 return affordances == *
this;
130 if constexpr (std::is_same_v<AffordanceRaw, ScalarAffordance>) {
131 if constexpr (hasScalarAffordance)
132 return affordances == std::get<ScalarAffordance>(*
this);
136 if constexpr (std::is_same_v<AffordanceRaw, VectorAffordance>) {
137 if constexpr (hasVectorAffordance)
138 return affordances == std::get<VectorAffordance>(*
this);
142 if constexpr (std::is_same_v<AffordanceRaw, MatrixAffordance>) {
143 if constexpr (hasMatrixAffordance)
144 return affordances == std::get<MatrixAffordance>(*
this);
153 requires hasScalarAffordance
155 return std::get<ScalarAffordance>(*
this);
158 requires hasVectorAffordance
160 return std::get<VectorAffordance>(*
this);
163 requires hasMatrixAffordance
165 return std::get<MatrixAffordance>(*
this);
203namespace AffordanceCollections {
209 template <
typename T>
212 using InputType = T&;
213 using StorageType = std::reference_wrapper<T>;
215 using ConstReturnType =
const T&;
218 template <
typename T>
219 struct DeduceTypes<
std::reference_wrapper<T>>
221 using InputType = T&;
222 using StorageType = std::reference_wrapper<T>;
224 using ConstReturnType =
const T&;
227 template <
typename T>
228 struct DeduceTypes<
Eigen::Ref<T>>
230 using InputType = Eigen::Ref<T>&;
231 using StorageType = Eigen::Ref<T>;
234 using ConstReturnType =
const Eigen::Ref<T>&;
250template <FESolutions sol, FEParameter para,
typename SV = Eigen::VectorXd,
typename PM =
double>
258 using SVHelper = Impl::DeduceTypes<std::remove_cvref_t<SV>>;
259 using PMHelper = Impl::DeduceTypes<std::remove_cvref_t<PM>>;
262 using SolutionVectorStorageType = SVHelper::StorageType;
263 using ParameterStorageType = PMHelper::StorageType;
264 using SolutionVectorInputType = SVHelper::InputType;
265 using ParameterInputType = PMHelper::InputType;
326 return parameter_.value();
336 ParameterReturnType
parameter() {
return parameter_.value(); }
344 bool populated()
const {
return sol_.has_value() and parameter_.has_value(); }
347 std::optional<SolutionVectorStorageType> sol_;
348 std::optional<ParameterStorageType> parameter_;
352 typename PM =
double>
356 using typeEigen = std::conditional_t<wrapWithRef and Ikarus::Concepts::EigenMatrix<SV>, Eigen::Ref<SV>, SV>;
Implementation of the make enum macro.
Definitions of ResultTypes used for finite element results.
FEParameter
A strongly typed enum class representing the FE parameter.
Definition: ferequirements.hh:74
FESolutions
A strongly typed enum class representing the type of the solutions vectors.
Definition: ferequirements.hh:87
#define MAKE_ENUM(type,...)
Macro to create an enumeration with a string conversion function.The macro creates an enum class with...
Definition: makeenum.hh:40
std::invoke_result_t< Fun, Args... > ReturnType
Type trait to obtain the return type of a callable type when given specific arguments.
Definition: traits.hh:74
Definition: assemblermanipulatorbuildingblocks.hh:22
constexpr MatrixAffordance stiffnessdiffBucklingVector
Definition: ferequirements.hh:172
auto vectorAffordance(MatrixAffordance affordanceM)
Definition: ferequirements.hh:176
MatrixAffordance
A strongly typed enum class representing the matrix affordance.
Definition: ferequirements.hh:63
@ stiffnessdiffBucklingVector
constexpr MatrixAffordance stiffness
Definition: ferequirements.hh:171
constexpr VectorAffordance forces
Definition: ferequirements.hh:169
constexpr ScalarAffordance potentialEnergy
Definition: ferequirements.hh:174
auto scalarAffordance(MatrixAffordance affordanceM)
Definition: ferequirements.hh:185
VectorAffordance
A strongly typed enum class representing the vector affordance.
Definition: ferequirements.hh:48
constexpr MatrixAffordance mass
Definition: ferequirements.hh:173
ScalarAffordance
A strongly typed enum class representing the scalar affordance.
Definition: ferequirements.hh:37
@ mechanicalPotentialEnergy
@ microMagneticPotentialEnergy
constexpr AffordanceCollection elastoStatics(ScalarAffordance::mechanicalPotentialEnergy, VectorAffordance::forces, MatrixAffordance::stiffness)
Definition: truncatedconjugategradient.hh:24
Struct representing a collection of affordances.
Definition: ferequirements.hh:105
std::tuple< Affordances... > Base
Definition: ferequirements.hh:106
auto vectorAffordance() const
Definition: ferequirements.hh:157
constexpr AffordanceCollection(Affordances... affordances)
Definition: ferequirements.hh:109
auto scalarAffordance() const
Definition: ferequirements.hh:152
AffordanceCollection()=default
constexpr bool hasAffordance(Affordance &&affordances) const
Check if a specific affordance is present in the requirements.
Definition: ferequirements.hh:125
auto matrixAffordance() const
Definition: ferequirements.hh:162
Class representing the requirements for finite element calculations.
Definition: ferequirements.hh:252
bool populated() const
Tells if the class contains all needed values.
Definition: ferequirements.hh:344
static constexpr FEParameter parameterTag
Definition: ferequirements.hh:255
SV SolutionVectorType
Definition: ferequirements.hh:268
PM ParameterType
Definition: ferequirements.hh:269
SolutionVectorReturnType globalSolution()
Get the global solution vector.
Definition: ferequirements.hh:308
FERequirements & insertParameter(ParameterInputType val)
Insert a parameter into the requirements.
Definition: ferequirements.hh:284
ParameterReturnType parameter()
Get the parameter value.
Definition: ferequirements.hh:336
FERequirements & insertGlobalSolution(SolutionVectorInputType solVec)
Insert a global solution vector into the requirements.
Definition: ferequirements.hh:297
static constexpr FESolutions globalSolutionTag
Definition: ferequirements.hh:254
FERequirements(SolutionVectorInputType solVec, ParameterInputType parameter)
Definition: ferequirements.hh:272
PMHelper::ConstReturnType parameter() const
Get the parameter value.
Definition: ferequirements.hh:325
SVHelper::ConstReturnType globalSolution() const
Get the global solution vector. *.
Definition: ferequirements.hh:316
Definition: ferequirements.hh:354
Type trait to check if a specified type is present in a tuple.
Definition: traits.hh:86
Concept to check if a given type is one of the predefined affordance enums or the AffordanceCollectio...
Definition: ferequirements.hh:95