Commit e1471fca authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1193 Solid: fix a bug: one must checks whether ALL solid parameters are set...

#1193 Solid: fix a bug: one must checks whether ALL solid parameters are set in the input parameter file.

[WARNING] The models with a Solid involve might not compile!
parent 529e9ace
...@@ -24,7 +24,11 @@ namespace HappyHeart ...@@ -24,7 +24,11 @@ namespace HappyHeart
template<class InputParameterDataT, class T> template<class InputParameterDataT, class T>
constexpr bool IsDefined() constexpr bool IsDefined()
{ {
return (Utilities::Tuple::IndexOf<T, typename InputParameterDataT::Tuple>::value != NumericNS::UninitializedIndex<unsigned int>()); if (Utilities::Tuple::IndexOf<T, typename InputParameterDataT::Tuple>::value != NumericNS::UninitializedIndex<unsigned int>())
return true;
// If InputParameter::Solid is defined, ALL parameters are defined and true should be returned!
return (Utilities::Tuple::IndexOf<InputParameter::Solid, typename InputParameterDataT::Tuple>::value != NumericNS::UninitializedIndex<unsigned int>());
} }
...@@ -46,7 +50,7 @@ namespace HappyHeart ...@@ -46,7 +50,7 @@ namespace HappyHeart
InitScalarParameterFromInputData<InputParameter::Solid::VolumicMass>("Volumic mass", InitScalarParameterFromInputData<InputParameter::Solid::VolumicMass>("Volumic mass",
domain, domain,
input_parameter_data); input_parameter_data);
if constexpr (IsDefined<InputParameterDataT, SolidIP::LameLambda>()) if constexpr (IsDefined<InputParameterDataT, SolidIP::LameLambda>())
{ {
static_assert(IsDefined<InputParameterDataT, SolidIP::LameMu>(), static_assert(IsDefined<InputParameterDataT, SolidIP::LameMu>(),
...@@ -66,7 +70,7 @@ namespace HappyHeart ...@@ -66,7 +70,7 @@ namespace HappyHeart
{ {
static_assert(IsDefined<InputParameterDataT, SolidIP::PoissonRatio>(), static_assert(IsDefined<InputParameterDataT, SolidIP::PoissonRatio>(),
"It makes no sense to define one and not the other"); "It makes no sense to define one and not the other");
std::get<0>(young_poisson_) = std::get<0>(young_poisson_) =
InitScalarParameterFromInputData<InputParameter::Solid::YoungModulus>("Young modulus", InitScalarParameterFromInputData<InputParameter::Solid::YoungModulus>("Young modulus",
domain, domain,
...@@ -83,11 +87,13 @@ namespace HappyHeart ...@@ -83,11 +87,13 @@ namespace HappyHeart
{ {
static_assert(IsDefined<InputParameterDataT, SolidIP::Kappa2>(), static_assert(IsDefined<InputParameterDataT, SolidIP::Kappa2>(),
"It makes no sense to define one and not the other"); "It makes no sense to define one and not the other");
std::get<0>(kappa_list_) = std::get<0>(kappa_list_) =
InitScalarParameterFromInputData<InputParameter::Solid::Kappa1>("Kappa_1", InitScalarParameterFromInputData<InputParameter::Solid::Kappa1>("Kappa_1",
domain, domain,
input_parameter_data); input_parameter_data);
assert(!(!std::get<0>(kappa_list_)));
std::get<1>(kappa_list_) = std::get<1>(kappa_list_) =
InitScalarParameterFromInputData<InputParameter::Solid::Kappa2>("Kappa_2", InitScalarParameterFromInputData<InputParameter::Solid::Kappa2>("Kappa_2",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment