Skip to content

Commit

Permalink
Introduce the ST2toST2Concept. Remove usage of implementsST2toST2Conc…
Browse files Browse the repository at this point in the history
…ept. Code clean-up
  • Loading branch information
thelfer committed Jan 25, 2024
1 parent 9b9e285 commit af4c414
Show file tree
Hide file tree
Showing 35 changed files with 1,099 additions and 1,392 deletions.
1 change: 0 additions & 1 deletion include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ install_header(TFEL/Math/ST2toST2 ST2toST2ST2toST2ProductExpr.hxx)
install_header(TFEL/Math/ST2toST2 ConvertT2toST2ToST2toST2Expr.hxx)
install_header(TFEL/Math/ST2toST2 StensorSquareDerivative.hxx)
install_header(TFEL/Math/ST2toST2 BuildFromRotationMatrix.hxx)
install_header(TFEL/Math/ST2toST2 ChangeBasis.hxx)
install_header(TFEL/Math/ST2toST2 StensorSymmetricProductDerivative.hxx)
install_header(TFEL/Math/ST2toST2 ConvertToTangentModuli.hxx)
install_header(TFEL/Math/ST2toST2 ConvertSpatialModuliToKirchhoffJaumanRateModuli.hxx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,11 @@ namespace tfel::material {
return *this;
}
/*!
* assignement operator
* \brief assignement operator
*/
template <typename T>
template <tfel::math::ST2toST2Concept T>
std::enable_if_t<
tfel::math::implementsST2toST2Concept<T>() &&
tfel::math::getSpaceDimension<T>() == N &&
tfel::math::getSpaceDimension<T>() == N &&
std::is_same_v<tfel::math::numeric_type<T>, StressType>,
FiniteStrainBehaviourTangentOperator&>
operator=(const T& e) {
Expand Down
97 changes: 0 additions & 97 deletions include/TFEL/Math/ST2toST2/ChangeBasis.hxx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,24 @@ namespace tfel::math {
* \param[in] m: eigen vectors of the right Cauchy Green tensor
* \param[in] vp: eigen values of the right Cauchy Green tensor
*/
template <typename ST2toST2Type,
typename ST2toST2Type2,
typename ST2toST2Type3,
template <ST2toST2Concept ST2toST2Type,
ST2toST2Concept ST2toST2Type2,
ST2toST2Concept ST2toST2Type3,
StensorConcept StressStensorType>
static typename std::enable_if<
((implementsST2toST2Concept<ST2toST2Type>()) &&
(tfel::math::getSpaceDimension<ST2toST2Type>() == 1u) &&
(std::is_same<numeric_type<ST2toST2Type>, stress>::value) &&
(implementsST2toST2Concept<ST2toST2Type2>()) &&
(tfel::math::getSpaceDimension<ST2toST2Type2>() == 1u) &&
(isAssignableTo<numeric_type<ST2toST2Type2>, stress>()),
(implementsST2toST2Concept<ST2toST2Type3>()) &&
(tfel::math::getSpaceDimension<ST2toST2Type3>() == 1u) &&
(isAssignableTo<numeric_type<ST2toST2Type3>, real>())),
void>::type
exe(ST2toST2Type& Cse,
const ST2toST2Type2& C,
const ST2toST2Type2& P,
const StressStensorType& T,
const tmatrix<3u, 3u, real>&,
const tvector<3u, real>&) {
TFEL_HOST_DEVICE constexpr void exe(ST2toST2Type& Cse,
const ST2toST2Type2& C,
const ST2toST2Type2& P,
const StressStensorType& T,
const tmatrix<3u, 3u, real>&,
const tvector<3u,
real>&) noexcept //
requires(
(tfel::math::getSpaceDimension<ST2toST2Type>() == 1u) &&
(std::is_same<numeric_type<ST2toST2Type>, stress>::value) &&
(tfel::math::getSpaceDimension<ST2toST2Type2>() == 1u) &&
(isAssignableTo<numeric_type<ST2toST2Type2>, stress>()),
(tfel::math::getSpaceDimension<ST2toST2Type3>() == 1u) &&
(isAssignableTo<numeric_type<ST2toST2Type3>, real>())) {
const auto iC0 = P(0, 0);
const auto iC1 = P(1, 1);
const auto iC2 = P(2, 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,124 +32,89 @@ namespace tfel::math {
* \return the moduli associated with Jauman rate of the Kirchhoff
* stress
*/
template <typename ST2toST2Type, StensorConcept StensorType>
typename std::enable_if<
((getSpaceDimension<ST2toST2Type>() == 1u) &&
(getSpaceDimension<StensorType>() == 1u) &&
implementsST2toST2Concept<ST2toST2Type>() &&
std::is_same_v<numeric_type<ST2toST2Type>, numeric_type<StensorType>>),
st2tost2<1u, numeric_type<ST2toST2Type>>>::type
convertSpatialModuliToKirchhoffJaumanRateModuli(const ST2toST2Type& C_s,
const StensorType& tau) {
template <ST2toST2Concept ST2toST2Type, StensorConcept StensorType>
TFEL_HOST_DEVICE constexpr auto
convertSpatialModuliToKirchhoffJaumanRateModuli(
const ST2toST2Type& C_s,
const StensorType&
tau) noexcept requires((getSpaceDimension<ST2toST2Type>() ==
getSpaceDimension<StensorType>()) &&
(std::is_same_v<numeric_type<ST2toST2Type>,
numeric_type<StensorType>>)) {
constexpr auto N = getSpaceDimension<ST2toST2Type>();
using NumType = numeric_type<ST2toST2Type>;
st2tost2<1u, NumType> C_tJ;
C_tJ(0, 0) = C_s(0, 0) + 2 * tau[0];
C_tJ(0, 1) = C_s(0, 1);
C_tJ(0, 2) = C_s(0, 2);
C_tJ(1, 0) = C_s(1, 0);
C_tJ(1, 1) = C_s(1, 1) + 2 * tau[1];
C_tJ(1, 2) = C_s(1, 2);
C_tJ(2, 0) = C_s(2, 0);
C_tJ(2, 1) = C_s(2, 1);
C_tJ(2, 2) = C_s(2, 2) + 2 * tau[2];
return C_tJ;
}

/*!
* \brief convert the spatial moduli in the moduli associated with
* Jauman rate of the Kirchhoff stress
* \param[in] C_s: spatial moduli
* \param[in] tau: Kirchhoff stress
* \return the moduli associated with Jauman rate of the Kirchhoff
* stress
*/
template <typename ST2toST2Type, StensorConcept StensorType>
typename std::enable_if<
((getSpaceDimension<ST2toST2Type>() == 2u) &&
(getSpaceDimension<StensorType>() == 2u) &&
implementsST2toST2Concept<ST2toST2Type>() &&
std::is_same_v<numeric_type<ST2toST2Type>, numeric_type<StensorType>>),
st2tost2<2u, numeric_type<ST2toST2Type>>>::type
convertSpatialModuliToKirchhoffJaumanRateModuli(const ST2toST2Type& C_s,
const StensorType& tau) {
using NumType = numeric_type<ST2toST2Type>;
st2tost2<2u, NumType> C_tJ;
C_tJ(0, 0) = C_s(0, 0) + 2 * tau[0];
C_tJ(1, 1) = C_s(1, 1) + 2 * tau[1];
C_tJ(2, 2) = C_s(2, 2) + 2 * tau[2];
C_tJ(3, 0) = C_s(3, 0) + tau[3];
C_tJ(3, 1) = C_s(3, 1) + tau[3];
C_tJ(0, 3) = C_s(0, 3) + tau[3];
C_tJ(1, 3) = C_s(1, 3) + tau[3];
C_tJ(3, 3) = C_s(3, 3) + tau[1] + tau[0];
C_tJ(0, 1) = C_s(0, 1);
C_tJ(0, 2) = C_s(0, 2);
C_tJ(3, 2) = C_s(3, 2);
C_tJ(1, 0) = C_s(1, 0);
C_tJ(1, 2) = C_s(1, 2);
C_tJ(2, 0) = C_s(2, 0);
C_tJ(2, 1) = C_s(2, 1);
C_tJ(2, 3) = C_s(2, 3);
return C_tJ;
}

/*!
* \brief convert the spatial moduli in the moduli associated with
* Jauman rate of the Kirchhoff stress
* \param[in] C_s: spatial moduli
* \param[in] tau: Kirchhoff stress
* \return the moduli associated with Jauman rate of the Kirchhoff
* stress
*/
template <typename ST2toST2Type, StensorConcept StensorType>
typename std::enable_if<
((getSpaceDimension<ST2toST2Type>() == 3u) &&
(getSpaceDimension<StensorType>() == 3u) &&
implementsST2toST2Concept<ST2toST2Type>() &&
std::is_same_v<numeric_type<ST2toST2Type>, numeric_type<StensorType>>),
st2tost2<3u, numeric_type<ST2toST2Type>>>::type
convertSpatialModuliToKirchhoffJaumanRateModuli(const ST2toST2Type& C_s,
const StensorType& tau) {
using NumType = numeric_type<ST2toST2Type>;
constexpr auto icste = Cste<NumType>::isqrt2;
st2tost2<3u, NumType> C_tJ;
C_tJ(0, 0) = C_s(0, 0) + 2 * tau[0];
C_tJ(1, 1) = C_s(1, 1) + 2 * tau[1];
C_tJ(2, 2) = C_s(2, 2) + 2 * tau[2];
C_tJ(0, 3) = C_s(0, 3) + tau[3];
C_tJ(0, 4) = C_s(0, 4) + tau[4];
C_tJ(1, 3) = C_s(1, 3) + tau[3];
C_tJ(1, 5) = C_s(1, 5) + tau[5];
C_tJ(2, 4) = C_s(2, 4) + tau[4];
C_tJ(2, 5) = C_s(2, 5) + tau[5];
C_tJ(3, 3) = C_s(3, 3) + tau[1] + tau[0];
C_tJ(3, 0) = C_s(3, 0) + tau[3];
C_tJ(3, 1) = C_s(3, 1) + tau[3];
C_tJ(3, 4) = C_s(3, 4) + tau[5] * icste;
C_tJ(3, 5) = C_s(3, 5) + tau[4] * icste;
C_tJ(4, 0) = C_s(4, 0) + tau[4];
C_tJ(4, 2) = C_s(4, 2) + tau[4];
C_tJ(4, 4) = C_s(4, 4) + tau[2] + tau[0];
C_tJ(4, 3) = C_s(4, 3) + tau[5] * icste;
C_tJ(4, 5) = C_s(4, 5) + tau[3] * icste;
C_tJ(5, 1) = C_s(5, 1) + tau[5];
C_tJ(5, 2) = C_s(5, 2) + tau[5];
C_tJ(5, 3) = C_s(5, 3) + tau[4] * icste;
C_tJ(5, 4) = C_s(5, 4) + tau[3] * icste;
C_tJ(5, 5) = C_s(5, 5) + tau[2] + tau[1];
C_tJ(0, 1) = C_s(0, 1);
C_tJ(0, 2) = C_s(0, 2);
C_tJ(5, 0) = C_s(5, 0);
C_tJ(0, 5) = C_s(0, 5);
C_tJ(1, 0) = C_s(1, 0);
C_tJ(1, 2) = C_s(1, 2);
C_tJ(1, 4) = C_s(1, 4);
C_tJ(2, 0) = C_s(2, 0);
C_tJ(2, 1) = C_s(2, 1);
C_tJ(2, 3) = C_s(2, 3);
C_tJ(3, 2) = C_s(3, 2);
C_tJ(4, 1) = C_s(4, 1);
return C_tJ;
if constexpr (N == 1) {
st2tost2<1u, NumType> C_tJ;
C_tJ(0, 0) = C_s(0, 0) + 2 * tau[0];
C_tJ(0, 1) = C_s(0, 1);
C_tJ(0, 2) = C_s(0, 2);
C_tJ(1, 0) = C_s(1, 0);
C_tJ(1, 1) = C_s(1, 1) + 2 * tau[1];
C_tJ(1, 2) = C_s(1, 2);
C_tJ(2, 0) = C_s(2, 0);
C_tJ(2, 1) = C_s(2, 1);
C_tJ(2, 2) = C_s(2, 2) + 2 * tau[2];
return C_tJ;
} else if constexpr (N == 2) {
st2tost2<2u, NumType> C_tJ;
C_tJ(0, 0) = C_s(0, 0) + 2 * tau[0];
C_tJ(1, 1) = C_s(1, 1) + 2 * tau[1];
C_tJ(2, 2) = C_s(2, 2) + 2 * tau[2];
C_tJ(3, 0) = C_s(3, 0) + tau[3];
C_tJ(3, 1) = C_s(3, 1) + tau[3];
C_tJ(0, 3) = C_s(0, 3) + tau[3];
C_tJ(1, 3) = C_s(1, 3) + tau[3];
C_tJ(3, 3) = C_s(3, 3) + tau[1] + tau[0];
C_tJ(0, 1) = C_s(0, 1);
C_tJ(0, 2) = C_s(0, 2);
C_tJ(3, 2) = C_s(3, 2);
C_tJ(1, 0) = C_s(1, 0);
C_tJ(1, 2) = C_s(1, 2);
C_tJ(2, 0) = C_s(2, 0);
C_tJ(2, 1) = C_s(2, 1);
C_tJ(2, 3) = C_s(2, 3);
return C_tJ;
} else {
constexpr auto icste = Cste<NumType>::isqrt2;
st2tost2<3u, NumType> C_tJ;
C_tJ(0, 0) = C_s(0, 0) + 2 * tau[0];
C_tJ(1, 1) = C_s(1, 1) + 2 * tau[1];
C_tJ(2, 2) = C_s(2, 2) + 2 * tau[2];
C_tJ(0, 3) = C_s(0, 3) + tau[3];
C_tJ(0, 4) = C_s(0, 4) + tau[4];
C_tJ(1, 3) = C_s(1, 3) + tau[3];
C_tJ(1, 5) = C_s(1, 5) + tau[5];
C_tJ(2, 4) = C_s(2, 4) + tau[4];
C_tJ(2, 5) = C_s(2, 5) + tau[5];
C_tJ(3, 3) = C_s(3, 3) + tau[1] + tau[0];
C_tJ(3, 0) = C_s(3, 0) + tau[3];
C_tJ(3, 1) = C_s(3, 1) + tau[3];
C_tJ(3, 4) = C_s(3, 4) + tau[5] * icste;
C_tJ(3, 5) = C_s(3, 5) + tau[4] * icste;
C_tJ(4, 0) = C_s(4, 0) + tau[4];
C_tJ(4, 2) = C_s(4, 2) + tau[4];
C_tJ(4, 4) = C_s(4, 4) + tau[2] + tau[0];
C_tJ(4, 3) = C_s(4, 3) + tau[5] * icste;
C_tJ(4, 5) = C_s(4, 5) + tau[3] * icste;
C_tJ(5, 1) = C_s(5, 1) + tau[5];
C_tJ(5, 2) = C_s(5, 2) + tau[5];
C_tJ(5, 3) = C_s(5, 3) + tau[4] * icste;
C_tJ(5, 4) = C_s(5, 4) + tau[3] * icste;
C_tJ(5, 5) = C_s(5, 5) + tau[2] + tau[1];
C_tJ(0, 1) = C_s(0, 1);
C_tJ(0, 2) = C_s(0, 2);
C_tJ(5, 0) = C_s(5, 0);
C_tJ(0, 5) = C_s(0, 5);
C_tJ(1, 0) = C_s(1, 0);
C_tJ(1, 2) = C_s(1, 2);
C_tJ(1, 4) = C_s(1, 4);
C_tJ(2, 0) = C_s(2, 0);
C_tJ(2, 1) = C_s(2, 1);
C_tJ(2, 3) = C_s(2, 3);
C_tJ(3, 2) = C_s(3, 2);
C_tJ(4, 1) = C_s(4, 1);
return C_tJ;
}
}

} // end of namespace tfel::math
Expand Down
Loading

0 comments on commit af4c414

Please sign in to comment.