17#include <dune/common/exceptions.hh>
35 mechanicalPotentialEnergy,
36 microMagneticPotentialEnergy
86 magnetizationAndVectorPotential
108 std::is_same_v<std::remove_cvref_t<T>, AffordanceCollectionImpl>;
118namespace AffordanceCollections {
124 template <
typename T>
125 struct DeduceRawVectorType
127 static_assert(!std::is_same<T, T>::value,
"You should end up in the provided specializations");
130 template <
typename T>
131 struct DeduceRawVectorType<std::reference_wrapper<T>>
136 template <
typename T>
137 struct DeduceRawVectorType<
Eigen::Ref<T>>
139 using Type = Eigen::Ref<T>;
155template <
typename SV = std::reference_wrapper<Eigen::VectorXd>,
typename PM = std::reference_wrapper<
double>>
173 template <FEAffordance Affordance>
175 if constexpr (std::is_same_v<std::remove_cvref_t<Affordance>,
ScalarAffordances>)
177 else if constexpr (std::is_same_v<std::remove_cvref_t<Affordance>,
VectorAffordances>)
179 else if constexpr (std::is_same_v<std::remove_cvref_t<Affordance>,
MatrixAffordances>)
182 affordances_ = affordance;
196 parameter_.insert_or_assign(key, val);
210 sols_.insert_or_assign(key, sol);
226 if constexpr (std::is_same_v<SolutionVectorType, std::reference_wrapper<Eigen::VectorXd>>)
227 return sols_.at(key).get();
229 return sols_.at(key);
230 }
catch (std::out_of_range& oor) {
231 DUNE_THROW(Dune::RangeError, std::string(
"Out of Range error: ") + std::string(oor.what()) +
232 " in getGlobalSolution with key" +
toString(key));
249 return parameter_.at(key).get();
250 }
catch (std::out_of_range& oor) {
251 DUNE_THROW(Dune::RangeError, std::string(
"Out of Range error: ") + std::string(oor.what()) +
252 " in getParameter with key" +
toString(key));
266 template <FEAffordance Affordance>
268 if constexpr (std::is_same_v<std::remove_cvref_t<Affordance>,
ScalarAffordances>)
270 else if constexpr (std::is_same_v<std::remove_cvref_t<Affordance>,
VectorAffordances>)
272 else if constexpr (std::is_same_v<std::remove_cvref_t<Affordance>,
MatrixAffordances>)
275 return affordances_ == affordance;
279 std::map<FESolutions, SolutionVectorType> sols_;
280 std::map<FEParameter, ParameterType> parameter_;
297template <
typename SV = std::reference_wrapper<Eigen::VectorXd>,
typename PM = std::reference_wrapper<
double>>
311 Base::operator=(base);
315 Base::operator=(std::forward<Base>(base));
Implementation of the make enum macro.
Definitions of ResultTypes used for finite element results.
VectorAffordances
A strongly typed enum class representing the vector affordance.
Definition: ferequirements.hh:48
MatrixAffordances
A strongly typed enum class representing the matrix affordance.
Definition: ferequirements.hh:63
ScalarAffordances
A strongly typed enum class representing the scalar affordance.
Definition: ferequirements.hh:37
@ stiffnessdiffBucklingVector
@ mechanicalPotentialEnergy
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
Definition: simpleassemblers.hh:22
constexpr std::string toString(ScalarAffordances _e)
Definition: ferequirements.hh:37
constexpr MatrixAffordances stiffness
Definition: ferequirements.hh:112
constexpr ScalarAffordances potentialEnergy
Definition: ferequirements.hh:116
constexpr MatrixAffordances mass
Definition: ferequirements.hh:114
constexpr MatrixAffordances stiffnessdiffBucklingVector
Definition: ferequirements.hh:113
constexpr VectorAffordances forces
Definition: ferequirements.hh:110
constexpr AffordanceCollectionImpl elastoStatics
Definition: ferequirements.hh:119
Definition: truncatedconjugategradient.hh:24
Struct representing a collection of affordances.
Definition: ferequirements.hh:95
VectorAffordances vectorAffordances
Definition: ferequirements.hh:97
ScalarAffordances scalarAffordances
Definition: ferequirements.hh:96
MatrixAffordances matrixAffordances
Definition: ferequirements.hh:98
Class representing the requirements for finite element calculations.
Definition: ferequirements.hh:157
bool hasAffordance(Affordance &&affordance) const
Check if a specific affordance is present in the requirements.
Definition: ferequirements.hh:267
const ParameterTypeRaw & getParameter(FEParameter &&key) const
Get the raw parameter value for a specific key.
Definition: ferequirements.hh:247
FERequirements & insertGlobalSolution(const FESolutions &key, SolutionVectorTypeRaw &sol)
Insert a global solution vector into the requirements.
Definition: ferequirements.hh:209
const SolutionVectorTypeRaw & getGlobalSolution(const FESolutions &key) const
Get the raw global solution vector for a specific type.
Definition: ferequirements.hh:224
PM ParameterType
Definition: ferequirements.hh:161
SV SolutionVectorType
Definition: ferequirements.hh:159
FERequirements & addAffordance(Affordance &&affordance)
Add an affordance to the requirements.
Definition: ferequirements.hh:174
typename Impl::DeduceRawVectorType< std::remove_cvref_t< SV > >::Type SolutionVectorTypeRaw
Definition: ferequirements.hh:160
FERequirements & insertParameter(const FEParameter &key, ParameterTypeRaw &val)
Insert a parameter into the requirements.
Definition: ferequirements.hh:195
typename PM::type ParameterTypeRaw
Definition: ferequirements.hh:162
Class representing the requirements for finite element calculations.
Definition: ferequirements.hh:301
FErequirements & operator=(const Base &base)
Definition: ferequirements.hh:310
FErequirements & operator=(Base &&base)
Definition: ferequirements.hh:314
FErequirements(Base &&base)
Definition: ferequirements.hh:306
FErequirements(const Base &base)
Definition: ferequirements.hh:308
Concept to check if a given type is one of the predefined affordance enums or the AffordanceCollectio...
Definition: ferequirements.hh:105