19 template <
typename GEO,
int myDim,
typename EASFunction>
21 template <
typename GEO>
22 struct EASType<GEO, 3, EAS::LinearStrain>
24 using type = std::variant<E0<GEO>, E9<GEO>, E21<GEO>>;
26 template <
typename GEO>
27 struct EASType<GEO, 2, EAS::LinearStrain>
29 using type = std::variant<E0<GEO>, E4<GEO>, E5<GEO>, E7<GEO>, E11<GEO>>;
31 template <
typename GEO,
int myDim>
32 struct EASType<GEO, myDim, EAS::GreenLagrangeStrain>
34 using type = EASType<GEO, myDim, EAS::LinearStrain>::type;
36 template <
typename GEO>
37 struct EASType<GEO, 2, EAS::DisplacementGradient>
39 using type = std::variant<H0<GEO>, H4<GEO>>;
41 template <
typename GEO>
42 struct EASType<GEO, 3, EAS::DisplacementGradient>
44 using type = std::variant<H0<GEO>, H9<GEO>>;
46 template <
typename GEO,
int myDim>
47 struct EASType<GEO, myDim, EAS::DisplacementGradientTransposed>
49 using type = EASType<GEO, myDim, EAS::DisplacementGradient>::type;
58template <
typename EASFunction,
typename GEO>
61 static constexpr int myDim = GEO::mydimension;
62 using Variant = Impl::EASType<GEO, myDim, EASFunction>::type;
63 static_assert((
myDim == 2) or (
myDim == 3),
"EAS variants are only available for 2D and 3D elements.");
72 std::visit([&]<
typename EAST>(
const EAST& easFunction) { f(easFunction); }, var_);
80 return std::visit([]<
typename EAST>(
const EAST&) ->
int {
return EAST::enhancedStrainSize; }, var_);
95 void bind(
const GEO& geometry) {
96 geometry_ = std::make_optional<GEO>(geometry);
101 void createEASType() {
102 const std::string& errorMessage =
"The given EAS parameters are not available for enhancing " +
103 EASFunction::name() +
" strain measure for the " + std::to_string(
myDim) +
106 if constexpr (std::same_as<EASFunction, EAS::LinearStrain> or std::same_as<EASFunction, EAS::GreenLagrangeStrain>) {
107 if (numberOfEASParameters_ == 0) {
108 var_ =
E0(geometry_.value());
111 if constexpr (
myDim == 2) {
112 switch (numberOfEASParameters_) {
114 var_ = E4(geometry_.value());
117 var_ = E5(geometry_.value());
120 var_ = E7(geometry_.value());
123 var_ = E11(geometry_.value());
126 DUNE_THROW(Dune::NotImplemented, errorMessage);
128 }
else if constexpr (
myDim == 3) {
129 switch (numberOfEASParameters_) {
131 var_ = E9(geometry_.value());
134 var_ = E21(geometry_.value());
137 DUNE_THROW(Dune::NotImplemented, errorMessage);
141 if constexpr (std::same_as<EASFunction, EAS::DisplacementGradient> or
142 std::same_as<EASFunction, EAS::DisplacementGradientTransposed>) {
143 if (numberOfEASParameters_ == 0) {
144 var_ = H0(geometry_.value());
147 if constexpr (
myDim == 2) {
148 switch (numberOfEASParameters_) {
150 var_ = H4(geometry_.value());
153 DUNE_THROW(Dune::NotImplemented, errorMessage);
155 }
else if constexpr (
myDim == 3) {
156 switch (numberOfEASParameters_) {
158 var_ = H9(geometry_.value());
161 DUNE_THROW(Dune::NotImplemented, errorMessage);
166 std::optional<GEO> geometry_;
168 int numberOfEASParameters_;
Helper for the Eigen::Tensor types.
Header file for various EAS functions.
Definition of the types of EAS formulations for 2D and 3D linear solid elements, where linear and Gre...
Definition: easfunctions/displacementgradient.hh:21
Wrapper around the EAS variant, contains helper functions.
Definition: easvariants.hh:60
void bind(const GEO &geometry)
Definition: easvariants.hh:95
auto numberOfInternalVariables() const
A helper function to get the number of EAS parameters.
Definition: easvariants.hh:79
Impl::EASType< GEO, myDim, EASFunction >::type Variant
Definition: easvariants.hh:62
bool isDisplacmentBased() const
A helper function to identify if the formulation is purely displacement-based, i.e....
Definition: easvariants.hh:88
void operator()(F &&f) const
Executes a function F on the variant, if enhancedStrainSize is not zero.
Definition: easvariants.hh:71
void setEASType(int numberOfInternalVariables)
Definition: easvariants.hh:90
static constexpr int myDim
Definition: easvariants.hh:61
Dummy struct for displacement-based EAS elements, i.e. 0 enhanced modes.
Definition: linearandglstrains.hh:46
Definition of the types of EAS formulations for 2D and 3D linear solid elements, where the displaceme...