1/*! 2 * \file LSDYNATangentOperator.ixx 3 * \brief 4 * \author Thomas Helfer 5 * \date 04 avril 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_LSDYNATANGENTOPERATOR_IXX 15#define LIB_LSDYNATANGENTOPERATOR_IXX 16 17#include"TFEL/Math/General/ConstExprMathFunctions.hxx" 18 19namespace lsdyna 20{ 21 22 template<typename real> 23 void 24 LSDYNATangentOperator<real>::normalize(tfel::math::ST2toST2View<1u,real>&) 25 {} // end of LSDYNATangentOperator<real>::normalize 26 27 template<typename real> 28 void 29 LSDYNATangentOperator<real>::normalize(tfel::math::ST2toST2View<2u,real>& Dt) 30 { 31 constexpr const auto icste = tfel::math::Cste<real>::isqrt2; 32 Dt(0,3) *= icste; 33 Dt(1,3) *= icste; 34 Dt(2,3) *= icste; 35 Dt(3,0) *= icste; 36 Dt(3,1) *= icste; 37 Dt(3,2) *= icste; 38 Dt(3,3) /= real(2); 39 } // end of LSDYNATangentOperator<real>::normalize 40 41 template<typename real> 42 void 43 LSDYNATangentOperator<real>::normalize(tfel::math::ST2toST2View<3u,real>& Dt) 44 { 45 constexpr const auto icste = tfel::math::Cste<real>::isqrt2; 46 TFEL_CONSTEXPR const auto one_half = real(1)/real(2); 47 Dt(0,3) *= icste; 48 Dt(1,3) *= icste; 49 Dt(2,3) *= icste; 50 Dt(0,4) *= icste; 51 Dt(1,4) *= icste; 52 Dt(2,4) *= icste; 53 Dt(0,5) *= icste; 54 Dt(1,5) *= icste; 55 Dt(2,5) *= icste; 56 Dt(3,0) *= icste; 57 Dt(3,1) *= icste; 58 Dt(3,2) *= icste; 59 Dt(4,0) *= icste; 60 Dt(4,1) *= icste; 61 Dt(4,2) *= icste; 62 Dt(5,0) *= icste; 63 Dt(5,1) *= icste; 64 Dt(5,2) *= icste; 65 Dt(3,3) *= one_half; 66 Dt(3,4) *= one_half; 67 Dt(3,5) *= one_half; 68 Dt(4,3) *= one_half; 69 Dt(4,4) *= one_half; 70 Dt(4,5) *= one_half; 71 Dt(5,3) *= one_half; 72 Dt(5,4) *= one_half; 73 Dt(5,5) *= one_half; 74 } // end of struct LSDYNATangentOperator 75 76 template<typename real> 77 void 78 LSDYNATangentOperator<real>::transpose(tfel::math::ST2toST2View<1u,real>& Dt) 79 { 80 std::swap(Dt(0,1),Dt(1,0)); 81 std::swap(Dt(0,2),Dt(2,0)); 82 std::swap(Dt(1,2),Dt(2,1)); 83 } 84 85 template<typename real> 86 void 87 LSDYNATangentOperator<real>::transpose(tfel::math::ST2toST2View<2u,real>& Dt) 88 { 89 std::swap(Dt(0,1),Dt(1,0)); 90 std::swap(Dt(0,2),Dt(2,0)); 91 std::swap(Dt(0,3),Dt(3,0)); 92 std::swap(Dt(1,2),Dt(2,1)); 93 std::swap(Dt(1,3),Dt(3,1)); 94 std::swap(Dt(2,3),Dt(3,2)); 95 } 96 97 template<typename real> 98 void 99 LSDYNATangentOperator<real>::transpose(tfel::math::ST2toST2View<3u,real>& Dt) 100 { 101 std::swap(Dt(0,1),Dt(1,0)); 102 std::swap(Dt(0,2),Dt(2,0)); 103 std::swap(Dt(0,3),Dt(3,0)); 104 std::swap(Dt(0,4),Dt(4,0)); 105 std::swap(Dt(0,5),Dt(5,0)); 106 std::swap(Dt(1,2),Dt(2,1)); 107 std::swap(Dt(1,3),Dt(3,1)); 108 std::swap(Dt(1,4),Dt(4,1)); 109 std::swap(Dt(1,5),Dt(5,1)); 110 std::swap(Dt(2,3),Dt(3,2)); 111 std::swap(Dt(2,4),Dt(4,2)); 112 std::swap(Dt(2,5),Dt(5,2)); 113 std::swap(Dt(3,4),Dt(4,3)); 114 std::swap(Dt(3,5),Dt(5,3)); 115 std::swap(Dt(4,5),Dt(5,4)); 116 } 117 118} // end of namespace lsdyna 119 120#endif /* LIB_LSDYNATANGENTOPERATOR_IXX */ 121