1 /*!
2  * \file   mfront/src/LSDYNAComputeStiffnessTensor.cxx
3  * \brief
4  * \author Thomas Helfer
5  * \date   18 mar 2008
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 #include<algorithm>
15 
16 #include"TFEL/Math/st2tost2.hxx"
17 #include"TFEL/Material/StiffnessTensor.hxx"
18 #include"MFront/LSDYNA/LSDYNAComputeStiffnessTensor.hxx"
19 
20 namespace lsdyna
21 {
22 
23   template<typename real>
24   static inline void
LSDYNAComputeIsotropicStiffnessTensor2DImpl(typename tfel::config::Types<2u,real,false>::StiffnessTensor & C,const real * const props)25   LSDYNAComputeIsotropicStiffnessTensor2DImpl(typename tfel::config::Types<2u,real,false>::StiffnessTensor& C,
26 					      const real* const props)
27   {
28     using namespace tfel::material;
29     using STAC = StiffnessTensorAlterationCharacteristic;
30     computeIsotropicStiffnessTensorII<2u,STAC::UNALTERED>(C,props[0],props[1]);
31   }
32 
33   template<typename real>
34   static inline void
LSDYNAComputeIsotropicPlaneStressAlteredStiffnessTensorImpl(typename tfel::config::Types<2u,real,false>::StiffnessTensor & C,const real * const props)35   LSDYNAComputeIsotropicPlaneStressAlteredStiffnessTensorImpl(typename tfel::config::Types<2u,real,false>::StiffnessTensor& C,
36 							      const real* const props)
37 
38   {
39     using namespace tfel::material;
40     using STAC = StiffnessTensorAlterationCharacteristic;
41     computeIsotropicStiffnessTensorII<2u,STAC::ALTERED>(C,props[0],props[1]);
42   } // end of struct LSDYNAComputeIsotropicPlaneStressAlteredStiffnessTensor
43 
44   template<typename real>
45   static inline void
LSDYNAComputeIsotropicStiffnessTensor3DImpl(typename tfel::config::Types<3u,real,false>::StiffnessTensor & C,const real * const props)46   LSDYNAComputeIsotropicStiffnessTensor3DImpl(typename tfel::config::Types<3u,real,false>::StiffnessTensor& C,
47 					      const real* const props)
48   {
49     using namespace tfel::material;
50     using STAC = StiffnessTensorAlterationCharacteristic;
51     computeIsotropicStiffnessTensorII<3u,STAC::UNALTERED>(C,props[0],props[1]);
52   } // end of struct LSDYNAComputeStiffnessTensor
53 
54   template<typename real>
55   static inline void
LSDYNAComputeOrthotropicStiffnessTensor2DImpl(typename tfel::config::Types<2u,real,false>::StiffnessTensor & C,const real * const props)56   LSDYNAComputeOrthotropicStiffnessTensor2DImpl(typename tfel::config::Types<2u,real,false>::StiffnessTensor& C,
57 						const real* const props)
58   {
59     using namespace tfel::material;
60     using STAC = StiffnessTensorAlterationCharacteristic;
61     computeOrthotropicStiffnessTensorII<2u,STAC::UNALTERED>(C,props[0],props[1],props[2],
62 							    props[3],props[4],props[5],
63 							    props[6],props[6],props[6]);
64   } // end of struct LSDYNAComputeStiffnessTensor
65 
66   template<typename real>
67   static inline void
LSDYNAComputeOrthotropicPlaneStressAlteredStiffnessTensorImpl(typename tfel::config::Types<2u,real,false>::StiffnessTensor & C,const real * const props)68   LSDYNAComputeOrthotropicPlaneStressAlteredStiffnessTensorImpl(typename tfel::config::Types<2u,real,false>::StiffnessTensor& C,
69 								const real* const props)
70   {
71     using namespace tfel::material;
72     using STAC = StiffnessTensorAlterationCharacteristic;
73     computeOrthotropicStiffnessTensorII<2u,STAC::ALTERED>(C,props[0],props[1],props[2],
74 							  props[3],props[4],props[5],
75 							  props[6],props[6],props[6]);
76   } // end of struct LSDYNAComputeOrthotropicPlaneStressAlteredStiffnessTensor
77 
78   template<typename real>
79   static inline void
LSDYNAComputeOrthotropicStiffnessTensor3DImpl(typename tfel::config::Types<3u,real,false>::StiffnessTensor & C,const real * const props)80   LSDYNAComputeOrthotropicStiffnessTensor3DImpl(typename tfel::config::Types<3u,real,false>::StiffnessTensor& C,
81 						const real* const props)
82   {
83     using namespace tfel::material;
84     using STAC = StiffnessTensorAlterationCharacteristic;
85     computeOrthotropicStiffnessTensorII<3u,STAC::UNALTERED>(C,props[0],props[1],props[2],
86 							    props[3],props[4],props[5],
87 							    props[6],props[7],props[8]);
88   } // end of struct LSDYNAComputeStiffnessTensor
89 
90   void
LSDYNAComputeIsotropicStiffnessTensor2D(tfel::config::Types<2u,float,false>::StiffnessTensor & C,const float * const props)91   LSDYNAComputeIsotropicStiffnessTensor2D(tfel::config::Types<2u,float,false>::StiffnessTensor& C,
92 					  const float* const props)
93   {
94     LSDYNAComputeIsotropicStiffnessTensor2DImpl(C,props);
95   }
96 
97   void
LSDYNAComputeIsotropicPlaneStressAlteredStiffnessTensor(tfel::config::Types<2u,float,false>::StiffnessTensor & C,const float * const props)98   LSDYNAComputeIsotropicPlaneStressAlteredStiffnessTensor(tfel::config::Types<2u,float,false>::StiffnessTensor& C,
99 							  const float* const props)
100 
101   {
102     LSDYNAComputeIsotropicPlaneStressAlteredStiffnessTensorImpl(C,props);
103   } // end of struct LSDYNAComputeIsotropicPlaneStressAlteredStiffnessTensor
104 
105   void
LSDYNAComputeIsotropicStiffnessTensor3D(tfel::config::Types<3u,float,false>::StiffnessTensor & C,const float * const props)106   LSDYNAComputeIsotropicStiffnessTensor3D(tfel::config::Types<3u,float,false>::StiffnessTensor& C,
107 					  const float* const props)
108   {
109     LSDYNAComputeIsotropicStiffnessTensor3DImpl(C,props);
110   } // end of struct LSDYNAComputeStiffnessTensor
111 
112   void
LSDYNAComputeOrthotropicStiffnessTensor2D(tfel::config::Types<2u,float,false>::StiffnessTensor & C,const float * const props)113   LSDYNAComputeOrthotropicStiffnessTensor2D(tfel::config::Types<2u,float,false>::StiffnessTensor& C,
114 					    const float* const props)
115   {
116     LSDYNAComputeOrthotropicStiffnessTensor2DImpl(C,props);
117   } // end of struct LSDYNAComputeStiffnessTensor
118 
119   void
LSDYNAComputeOrthotropicPlaneStressAlteredStiffnessTensor(tfel::config::Types<2u,float,false>::StiffnessTensor & C,const float * const props)120   LSDYNAComputeOrthotropicPlaneStressAlteredStiffnessTensor(tfel::config::Types<2u,float,false>::StiffnessTensor& C,
121 							    const float* const props)
122   {
123     LSDYNAComputeOrthotropicPlaneStressAlteredStiffnessTensorImpl(C,props);
124   } // end of struct LSDYNAComputeOrthotropicPlaneStressAlteredStiffnessTensor
125 
126   void
LSDYNAComputeOrthotropicStiffnessTensor3D(tfel::config::Types<3u,float,false>::StiffnessTensor & C,const float * const props)127   LSDYNAComputeOrthotropicStiffnessTensor3D(tfel::config::Types<3u,float,false>::StiffnessTensor& C,
128 					    const float* const props)
129   {
130     LSDYNAComputeOrthotropicStiffnessTensor3DImpl(C,props);
131   } // end of struct LSDYNAComputeStiffnessTensor
132 
133   void
LSDYNAComputeIsotropicStiffnessTensor2D(tfel::config::Types<2u,double,false>::StiffnessTensor & C,const double * const props)134   LSDYNAComputeIsotropicStiffnessTensor2D(tfel::config::Types<2u,double,false>::StiffnessTensor& C,
135 					  const double* const props)
136   {
137     LSDYNAComputeIsotropicStiffnessTensor2DImpl(C,props);
138   }
139 
140   void
LSDYNAComputeIsotropicPlaneStressAlteredStiffnessTensor(tfel::config::Types<2u,double,false>::StiffnessTensor & C,const double * const props)141   LSDYNAComputeIsotropicPlaneStressAlteredStiffnessTensor(tfel::config::Types<2u,double,false>::StiffnessTensor& C,
142 							  const double* const props)
143 
144   {
145     LSDYNAComputeIsotropicPlaneStressAlteredStiffnessTensorImpl(C,props);
146   } // end of struct LSDYNAComputeIsotropicPlaneStressAlteredStiffnessTensor
147 
148   void
LSDYNAComputeIsotropicStiffnessTensor3D(tfel::config::Types<3u,double,false>::StiffnessTensor & C,const double * const props)149   LSDYNAComputeIsotropicStiffnessTensor3D(tfel::config::Types<3u,double,false>::StiffnessTensor& C,
150 					  const double* const props)
151   {
152     LSDYNAComputeIsotropicStiffnessTensor3DImpl(C,props);
153   } // end of struct LSDYNAComputeStiffnessTensor
154 
155   void
LSDYNAComputeOrthotropicStiffnessTensor2D(tfel::config::Types<2u,double,false>::StiffnessTensor & C,const double * const props)156   LSDYNAComputeOrthotropicStiffnessTensor2D(tfel::config::Types<2u,double,false>::StiffnessTensor& C,
157 					    const double* const props)
158   {
159     LSDYNAComputeOrthotropicStiffnessTensor2DImpl(C,props);
160   } // end of struct LSDYNAComputeStiffnessTensor
161 
162   void
LSDYNAComputeOrthotropicPlaneStressAlteredStiffnessTensor(tfel::config::Types<2u,double,false>::StiffnessTensor & C,const double * const props)163   LSDYNAComputeOrthotropicPlaneStressAlteredStiffnessTensor(tfel::config::Types<2u,double,false>::StiffnessTensor& C,
164 							    const double* const props)
165   {
166     LSDYNAComputeOrthotropicPlaneStressAlteredStiffnessTensorImpl(C,props);
167   } // end of struct LSDYNAComputeOrthotropicPlaneStressAlteredStiffnessTensor
168 
169   void
LSDYNAComputeOrthotropicStiffnessTensor3D(tfel::config::Types<3u,double,false>::StiffnessTensor & C,const double * const props)170   LSDYNAComputeOrthotropicStiffnessTensor3D(tfel::config::Types<3u,double,false>::StiffnessTensor& C,
171 					    const double* const props)
172   {
173     LSDYNAComputeOrthotropicStiffnessTensor3DImpl(C,props);
174   } // end of struct LSDYNAComputeStiffnessTensor
175 
176 } // end of namespace lsdyna
177