1 /*!
2  * \file   ConvertLogarithmicStrainTangentOperator.hxx
3  * \brief
4  * \author Thomas Helfer
5  * \date   29 août 2016
6  * \copyright Copyright (C) 2006-2018 CEA/DEN, EDF R&D. All rights
7  * reserved.
8  * This project is publicly released under either the GNU GPL Licence
9  * or the CECILL-A licence. A copy of thoses licences are delivered
10  * with the sources of TFEL. CEA or EDF may also distribute this
11  * project under specific licensing conditions.
12  */
13 
14 #ifndef LIB_TFEL_MATH_CONVERTLOGARITHMICSTRAINTANGENTOPERATOR_HXX
15 #define LIB_TFEL_MATH_CONVERTLOGARITHMICSTRAINTANGENTOPERATOR_HXX
16 
17 #include<type_traits>
18 #include"TFEL/Metaprogramming/Implements.hxx"
19 #include"TFEL/TypeTraits/BaseType.hxx"
20 #include"TFEL/Math/tvector.hxx"
21 #include"TFEL/Math/tmatrix.hxx"
22 #include"TFEL/Math/stensor.hxx"
23 #include"TFEL/Math/st2tost2.hxx"
24 
25 namespace tfel{
26 
27   namespace math{
28 
29     /*!
30      * \brief A class used to convert the tangent operator in the
31      * logarithmic strain framework into the CSE tangent moduli
32      *
33      * \tparam N:      space dimension
34      * \tparam stress: stress type
35      */
36     template<unsigned short N,typename stress>
37     struct ConvertLogarithmicStrainTangentOperator;
38 
39     /*!
40      * \brief Partial specialisation of the
41      * ConvertLogarithmicStrainTangentOperator in 1D.
42      * \tparam stress: stress type
43      */
44     template<typename stress>
45     struct ConvertLogarithmicStrainTangentOperator<1u,stress>
46     {
47       //! a simple alias
48       using real = tfel::typetraits::base_type<stress>;
49       /*!
50        *  \param[out] Cse: tangent moduli relating the rate of the
51        *                   second Kirchhoff stress to the rate of the
52        *                   Green-Lagrange strain
53        *  \param[in] C:    tangent operator in the logarithmic strain
54        *                   framework
55        *  \param[in] P:    two times the derivative of the logarithmic
56        *                   strain with respect to the right Cauchy
57        *                   Green tensor
58        *  \param[in] T:    dual stress of the logarithmic strain
59        *  \param[in] m:    eigen vectors of the right Cauchy Green tensor
60        *  \param[in] vp:   eigen values  of the right Cauchy Green tensor
61        */
62       template<typename ST2toST2Type,typename ST2toST2Type2,typename ST2toST2Type3,
63 	       typename StressStensorType>
64       static typename
65       std::enable_if<((tfel::meta::implements<ST2toST2Type,tfel::math::ST2toST2Concept>())&&
66 		      (tfel::math::ST2toST2Traits<ST2toST2Type>::dime==1u)&&
67 		      (std::is_same<ST2toST2NumType<ST2toST2Type>,stress>::value)&&
68 		      (tfel::meta::implements<ST2toST2Type2,tfel::math::ST2toST2Concept>())&&
69 		      (tfel::math::ST2toST2Traits<ST2toST2Type2>::dime==1u)&&
70 		      (tfel::typetraits::IsAssignableTo<ST2toST2NumType<ST2toST2Type2>,stress>::cond),
71 		      (tfel::meta::implements<ST2toST2Type3,tfel::math::ST2toST2Concept>())&&
72 		      (tfel::math::ST2toST2Traits<ST2toST2Type3>::dime==1u)&&
73 		      (tfel::typetraits::IsAssignableTo<ST2toST2NumType<ST2toST2Type3>,real>::cond),
74 		      (tfel::meta::implements<StressStensorType,tfel::math::StensorConcept>())&&
75 		      (tfel::math::StensorTraits<StressStensorType>::dime==1u)&&
76 		      (tfel::typetraits::IsAssignableTo<StensorNumType<StressStensorType>,stress>::cond)),
77 		     void>::type
exetfel::math::ConvertLogarithmicStrainTangentOperator78       exe(ST2toST2Type& Cse,
79 	  const ST2toST2Type2& C,
80 	  const ST2toST2Type2& P,
81 	  const StressStensorType& T,
82 	  const tmatrix<3u,3u,real>&,
83 	  const tvector<3u,real>&){
84 	const auto iC0 = P(0,0);
85 	const auto iC1 = P(1,1);
86 	const auto iC2 = P(2,2);
87 	Cse(0,0)=(C(0,0)-T[0])*iC0*iC0;
88 	Cse(0,1)=C(0,1)*iC1*iC0;
89 	Cse(0,2)=C(0,2)*iC2*iC0;
90 	Cse(1,0)=(C(1,0)-T[1])*iC0*iC1;
91 	Cse(1,1)=C(1,1)*iC1*iC1;
92 	Cse(1,2)=C(1,2)*iC2*iC1;
93 	Cse(2,0)=(C(2,0)-T[2])*iC0*iC2;
94 	Cse(2,1)=C(2,1)*iC1*iC2;
95 	Cse(2,2)=C(2,2)*iC2*iC2;
96       }
97     }; // end of struct ConvertLogarithmicStrainTangentOperator<1u,stress>
98 
99   } // end of namespace math
100 
101 } // end of namespace tfel
102 
103 #endif /* LIB_TFEL_MATH_CONVERTLOGARITHMICSTRAINTANGENTOPERATOR_HXX */
104