1 /*!
2  * \file   mfront/include/MFront/LSDYNA/LSDYNAComputeStiffnessTensor.hxx
3  * \brief  This file declares the LSDYNAComputeStiffnessTensor class
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 #ifndef LIB_MFRONT_LSDYNACOMPUTESTIFFNESSTENSOR_HXX
15 #define LIB_MFRONT_LSDYNACOMPUTESTIFFNESSTENSOR_HXX
16 
17 #include"TFEL/Config/TFELTypes.hxx"
18 #include"TFEL/Material/ModellingHypothesis.hxx"
19 
20 #include"MFront/LSDYNA/LSDYNA.hxx"
21 #include"MFront/LSDYNA/LSDYNAConfig.hxx"
22 #include"MFront/LSDYNA/LSDYNATraits.hxx"
23 
24 namespace lsdyna
25 {
26 
27   /*!
28    * \brief compute the stiffness tensor for plane strain, generalised
29    * plane strain and axisymmetrical hypotheses.
30    * \param[out] C     : stiffness tensor
31    * \param[in]  props : material properties
32    */
33   MFRONT_LSDYNA_VISIBILITY_EXPORT void
34   LSDYNAComputeIsotropicStiffnessTensor2D(tfel::config::Types<2u,float,false>::StiffnessTensor&,
35 					  const float* const);
36   /*!
37    * \brief compute the stiffness tensor for plane strain, generalised
38    * plane strain and axisymmetrical hypotheses.
39    * \param[out] C     : stiffness tensor
40    * \param[in]  props : material properties
41    */
42   MFRONT_LSDYNA_VISIBILITY_EXPORT void
43   LSDYNAComputeIsotropicStiffnessTensor2D(tfel::config::Types<2u,double,false>::StiffnessTensor&,
44 					const double* const);
45   /*!
46    * \brief compute the stiffness tensor for plane stress modelling
47    * hypothesis.
48    * \param[out] C     : stiffness tensor
49    * \param[in]  props : material properties
50    */
51   MFRONT_LSDYNA_VISIBILITY_EXPORT void
52   LSDYNAComputeIsotropicPlaneStressAlteredStiffnessTensor(tfel::config::Types<2u,float,false>::StiffnessTensor&,
53 							  const float* const);
54   /*!
55    * \brief compute the stiffness tensor for plane stress modelling
56    * hypothesis.
57    * \param[out] C     : stiffness tensor
58    * \param[in]  props : material properties
59    */
60   MFRONT_LSDYNA_VISIBILITY_EXPORT void
61   LSDYNAComputeIsotropicPlaneStressAlteredStiffnessTensor(tfel::config::Types<2u,double,false>::StiffnessTensor&,
62 							  const double* const);
63   /*!
64    * \brief compute the stiffness tensor for the tridimensionnal
65    * modelling hypothesis.
66    * \param[out] C     : stiffness tensor
67    * \param[in]  props : material properties
68    */
69   MFRONT_LSDYNA_VISIBILITY_EXPORT void
70   LSDYNAComputeIsotropicStiffnessTensor3D(tfel::config::Types<3u,float,false>::StiffnessTensor&,
71 					  const float* const);
72   /*!
73    * \brief compute the stiffness tensor for the tridimensionnal
74    * modelling hypothesis.
75    * \param[out] C     : stiffness tensor
76    * \param[in]  props : material properties
77    */
78   MFRONT_LSDYNA_VISIBILITY_EXPORT void
79   LSDYNAComputeIsotropicStiffnessTensor3D(tfel::config::Types<3u,double,false>::StiffnessTensor&,
80 					const double* const);
81   /*!
82    * \brief compute the stiffness tensor for plane strain, generalised
83    * plane strain and axisymmetrical hypotheses.
84    * \param[out] C     : stiffness tensor
85    * \param[in]  props : material properties
86    */
87   MFRONT_LSDYNA_VISIBILITY_EXPORT void
88   LSDYNAComputeOrthotropicStiffnessTensor2D(tfel::config::Types<2u,float,false>::StiffnessTensor&,
89 					  const float* const);
90   /*!
91    * \brief compute the stiffness tensor for plane strain, generalised
92    * plane strain and axisymmetrical hypotheses.
93    * \param[out] C     : stiffness tensor
94    * \param[in]  props : material properties
95    */
96   MFRONT_LSDYNA_VISIBILITY_EXPORT void
97   LSDYNAComputeOrthotropicStiffnessTensor2D(tfel::config::Types<2u,double,false>::StiffnessTensor&,
98 					    const double* const);
99   /*!
100    * \brief compute the stiffness tensor for plane stress modelling
101    * hypothesis.
102    * \param[out] C     : stiffness tensor
103    * \param[in]  props : material properties
104    */
105   MFRONT_LSDYNA_VISIBILITY_EXPORT void
106   LSDYNAComputeOrthotropicPlaneStressAlteredStiffnessTensor(tfel::config::Types<2u,float,false>::StiffnessTensor&,
107 							    const float* const);
108   /*!
109    * \brief compute the stiffness tensor for plane stress modelling
110    * hypothesis.
111    * \param[out] C     : stiffness tensor
112    * \param[in]  props : material properties
113    */
114   MFRONT_LSDYNA_VISIBILITY_EXPORT void
115   LSDYNAComputeOrthotropicPlaneStressAlteredStiffnessTensor(tfel::config::Types<2u,double,false>::StiffnessTensor&,
116 							    const double* const);
117   /*!
118    * \brief compute the stiffness tensor for the tridimensionnal
119    * modelling hypothesis.
120    * \param[out] C     : stiffness tensor
121    * \param[in]  props : material properties
122    */
123   MFRONT_LSDYNA_VISIBILITY_EXPORT void
124   LSDYNAComputeOrthotropicStiffnessTensor3D(tfel::config::Types<3u,float,false>::StiffnessTensor&,
125 					    const float* const);
126   /*!
127    * \brief compute the stiffness tensor for the tridimensionnal
128    * modelling hypothesis.
129    * \param[out] C     : stiffness tensor
130    * \param[in]  props : material properties
131    */
132   MFRONT_LSDYNA_VISIBILITY_EXPORT void
133   LSDYNAComputeOrthotropicStiffnessTensor3D(tfel::config::Types<3u,double,false>::StiffnessTensor&,
134 					    const double* const);
135 
136   /*!
137    * This structure is in charge of computing the Stiffness operator
138    * from the material properties given by Cast3M.  The resulting
139    * operator uses MFront representation of tensors and symmetric
140    * tensors.
141    */
142   template<LSDYNABehaviourType,
143 	   tfel::material::ModellingHypothesis::Hypothesis,
144 	   LSDYNASymmetryType,bool>
145   struct LSDYNAComputeStiffnessTensor;
146 
147   template<bool b>
148   struct TFEL_VISIBILITY_LOCAL
149   LSDYNAComputeStiffnessTensor<lsdyna::STANDARDSTRAINBASEDBEHAVIOUR,
150 			     tfel::material::ModellingHypothesis::AXISYMMETRICAL,
151 			     ISOTROPIC,b>
152   {
153     /*!
154      * \brief compute the stiffness tensor.
155      * \param[out] C     : stiffness tensor
156      * \param[in]  props : material properties
157      */
158     template<typename real>
159     static void
exelsdyna::LSDYNAComputeStiffnessTensor160     exe(typename tfel::config::Types<2u,real,false>::StiffnessTensor& C,
161 	const real* const props)
162     {
163       LSDYNAComputeIsotropicStiffnessTensor2D(C,props);
164     }
165   }; // end of struct LSDYNAComputeStiffnessTensor
166 
167   template<>
168   struct TFEL_VISIBILITY_LOCAL
169   LSDYNAComputeStiffnessTensor<lsdyna::STANDARDSTRAINBASEDBEHAVIOUR,
170 			     tfel::material::ModellingHypothesis::PLANESTRESS,
171 			     ISOTROPIC,true>
172   {
173     /*!
174      * \brief compute the stiffness tensor.
175      * \param[out] C     : stiffness tensor
176      * \param[in]  props : material properties
177      */
178     template<typename real>
179     static void
exelsdyna::LSDYNAComputeStiffnessTensor180     exe(typename tfel::config::Types<2u,real,false>::StiffnessTensor& C,
181 	const real* const props)
182     {
183       LSDYNAComputeIsotropicStiffnessTensor2D(C,props);
184     }
185   }; // end of struct LSDYNAComputeStiffnessTensor
186 
187   template<>
188   struct TFEL_VISIBILITY_LOCAL
189   LSDYNAComputeStiffnessTensor<lsdyna::STANDARDSTRAINBASEDBEHAVIOUR,
190 			     tfel::material::ModellingHypothesis::PLANESTRESS,
191 			     ISOTROPIC,false>
192   {
193     /*!
194      * \brief compute the stiffness tensor.
195      * \param[out] C     : stiffness tensor
196      * \param[in]  props : material properties
197      */
198     template<typename real>
199     static void
exelsdyna::LSDYNAComputeStiffnessTensor200     exe(typename tfel::config::Types<2u,real,false>::StiffnessTensor& C,
201 	const real* const props)
202     {
203       LSDYNAComputeIsotropicPlaneStressAlteredStiffnessTensor(C,props);
204     }
205   }; // end of struct LSDYNAComputeStiffnessTensor
206 
207   template<bool b>
208   struct TFEL_VISIBILITY_LOCAL
209   LSDYNAComputeStiffnessTensor<lsdyna::STANDARDSTRAINBASEDBEHAVIOUR,
210 			     tfel::material::ModellingHypothesis::PLANESTRAIN,
211 			     ISOTROPIC,b>
212   {
213     /*!
214      * \brief compute the stiffness tensor.
215      * \param[out] C     : stiffness tensor
216      * \param[in]  props : material properties
217      */
218     template<typename real>
219     static void
exelsdyna::LSDYNAComputeStiffnessTensor220     exe(typename tfel::config::Types<2u,real,false>::StiffnessTensor& C,
221 	const real* const props)
222     {
223       LSDYNAComputeIsotropicStiffnessTensor2D(C,props);
224     }
225   }; // end of struct LSDYNAComputeStiffnessTensor
226 
227   template<bool b>
228   struct TFEL_VISIBILITY_LOCAL
229   LSDYNAComputeStiffnessTensor<lsdyna::STANDARDSTRAINBASEDBEHAVIOUR,
230 			     tfel::material::ModellingHypothesis::GENERALISEDPLANESTRAIN,
231 			     ISOTROPIC,b>
232   {
233     /*!
234      * \brief compute the stiffness tensor.
235      * \param[out] C     : stiffness tensor
236      * \param[in]  props : material properties
237      */
238     template<typename real>
239     static void
exelsdyna::LSDYNAComputeStiffnessTensor240     exe(typename tfel::config::Types<2u,real,false>::StiffnessTensor& C,
241 	const real* const props)
242     {
243       LSDYNAComputeIsotropicStiffnessTensor2D(C,props);
244     }
245   }; // end of struct LSDYNAComputeStiffnessTensor
246 
247   template<bool b>
248   struct TFEL_VISIBILITY_LOCAL
249   LSDYNAComputeStiffnessTensor<lsdyna::STANDARDSTRAINBASEDBEHAVIOUR,
250 			     tfel::material::ModellingHypothesis::TRIDIMENSIONAL,
251 			     ISOTROPIC,b>
252   {
253     /*!
254      * \brief compute the stiffness tensor.
255      * \param[out] C     : stiffness tensor
256      * \param[in]  props : material properties
257      */
258     template<typename real>
259     static void
exelsdyna::LSDYNAComputeStiffnessTensor260     exe(typename tfel::config::Types<3u,real,false>::StiffnessTensor& C,
261 	const real* const props)
262     {
263       LSDYNAComputeIsotropicStiffnessTensor3D(C,props);
264     }
265   }; // end of struct LSDYNAComputeStiffnessTensor
266 
267   template<bool b>
268   struct TFEL_VISIBILITY_LOCAL
269   LSDYNAComputeStiffnessTensor<lsdyna::STANDARDSTRAINBASEDBEHAVIOUR,
270 			     tfel::material::ModellingHypothesis::AXISYMMETRICAL,ORTHOTROPIC,b>
271   {
272     /*!
273      * \brief compute the stiffness tensor.
274      * \param[out] C     : stiffness tensor
275      * \param[in]  props : material properties
276      */
277     template<typename real>
278     static void
exelsdyna::LSDYNAComputeStiffnessTensor279     exe(typename tfel::config::Types<2u,real,false>::StiffnessTensor& C,
280 	const real* const props)
281     {
282       LSDYNAComputeOrthotropicStiffnessTensor2D(C,props);
283     }
284   }; // end of struct LSDYNAComputeStiffnessTensor
285 
286   template<>
287   struct TFEL_VISIBILITY_LOCAL
288   LSDYNAComputeStiffnessTensor<lsdyna::STANDARDSTRAINBASEDBEHAVIOUR,
289 			     tfel::material::ModellingHypothesis::PLANESTRESS,
290 			     ORTHOTROPIC,true>
291   {
292     /*!
293      * \brief compute the stiffness tensor.
294      * \param[out] C     : stiffness tensor
295      * \param[in]  props : material properties
296      */
297     template<typename real>
298     static void
exelsdyna::LSDYNAComputeStiffnessTensor299     exe(typename tfel::config::Types<2u,real,false>::StiffnessTensor& C,
300 	const real* const props)
301     {
302       LSDYNAComputeOrthotropicStiffnessTensor2D(C,props);
303     }
304   }; // end of struct LSDYNAComputeStiffnessTensor
305 
306   template<>
307   struct TFEL_VISIBILITY_LOCAL
308   LSDYNAComputeStiffnessTensor<lsdyna::STANDARDSTRAINBASEDBEHAVIOUR,
309 			     tfel::material::ModellingHypothesis::PLANESTRESS,
310 			     ORTHOTROPIC,false>
311   {
312     /*!
313      * \brief compute the stiffness tensor.
314      * \param[out] C     : stiffness tensor
315      * \param[in]  props : material properties
316      */
317     template<typename real>
318     static void
exelsdyna::LSDYNAComputeStiffnessTensor319     exe(typename tfel::config::Types<2u,real,false>::StiffnessTensor& C,
320 	const real* const props)
321     {
322       LSDYNAComputeOrthotropicPlaneStressAlteredStiffnessTensor(C,props);
323     }
324   }; // end of struct LSDYNAComputeStiffnessTensor
325 
326   template<bool b>
327   struct TFEL_VISIBILITY_LOCAL
328   LSDYNAComputeStiffnessTensor<lsdyna::STANDARDSTRAINBASEDBEHAVIOUR,
329 			     tfel::material::ModellingHypothesis::PLANESTRAIN,
330 			     ORTHOTROPIC,b>
331   {
332     /*!
333      * \brief compute the stiffness tensor.
334      * \param[out] C     : stiffness tensor
335      * \param[in]  props : material properties
336      */
337     template<typename real>
338     static void
exelsdyna::LSDYNAComputeStiffnessTensor339     exe(typename tfel::config::Types<2u,real,false>::StiffnessTensor& C,
340 	const real* const props)
341     {
342       LSDYNAComputeOrthotropicStiffnessTensor2D(C,props);
343     }
344   }; // end of struct LSDYNAComputeStiffnessTensor
345 
346   template<bool b>
347   struct TFEL_VISIBILITY_LOCAL
348   LSDYNAComputeStiffnessTensor<lsdyna::STANDARDSTRAINBASEDBEHAVIOUR,
349 			     tfel::material::ModellingHypothesis::GENERALISEDPLANESTRAIN,
350 			     ORTHOTROPIC,b>
351   {
352     /*!
353      * \brief compute the stiffness tensor.
354      * \param[out] C     : stiffness tensor
355      * \param[in]  props : material properties
356      */
357     template<typename real>
358     static void
exelsdyna::LSDYNAComputeStiffnessTensor359     exe(typename tfel::config::Types<2u,real,false>::StiffnessTensor& C,
360 	const real* const props)
361     {
362       LSDYNAComputeOrthotropicStiffnessTensor2D(C,props);
363     }
364   }; // end of struct LSDYNAComputeStiffnessTensor
365 
366   template<bool b>
367   struct TFEL_VISIBILITY_LOCAL
368   LSDYNAComputeStiffnessTensor<lsdyna::STANDARDSTRAINBASEDBEHAVIOUR,
369 			     tfel::material::ModellingHypothesis::TRIDIMENSIONAL,
370 			     ORTHOTROPIC,b>
371   {
372     /*!
373      * \brief compute the stiffness tensor.
374      * \param[out] C     : stiffness tensor
375      * \param[in]  props : material properties
376      */
377     template<typename real>
378     static void
exelsdyna::LSDYNAComputeStiffnessTensor379     exe(typename tfel::config::Types<3u,real,false>::StiffnessTensor& C,
380 	const real* const props)
381     {
382       LSDYNAComputeOrthotropicStiffnessTensor3D(C,props);
383     }
384   }; // end of struct LSDYNAComputeStiffnessTensor
385 
386   /*!
387    * Partial specialisation for finite strain behaviours
388    */
389   template<tfel::material::ModellingHypothesis::Hypothesis H,
390 	   LSDYNASymmetryType stype,bool b>
391   struct TFEL_VISIBILITY_LOCAL
392   LSDYNAComputeStiffnessTensor<lsdyna::STANDARDFINITESTRAINBEHAVIOUR,H,stype,b>
393   {
394     typedef tfel::material::ModellingHypothesisToSpaceDimension<H> ModellingHypothesisToSpaceDimension;
395     /*!
396      * \brief compute the stiffness tensor.
397      * \param[out] C     : stiffness tensor
398      * \param[in]  props : material properties
399      */
400     template<typename real>
401     static void
exelsdyna::LSDYNAComputeStiffnessTensor402     exe(typename tfel::config::Types<ModellingHypothesisToSpaceDimension::value,real,false>::StiffnessTensor& D,
403 	const real* const props)
404     {
405       LSDYNAComputeStiffnessTensor<lsdyna::STANDARDSTRAINBASEDBEHAVIOUR,H,stype,b>::exe(D,props);
406     }
407   }; // end of struct LSDYNAComputeStiffnessTensor
408 
409 } // end of namespace lsdyna
410 
411 #endif /* LIB_MFRONT_LSDYNACOMPUTESTIFFNESSTENSOR_HXX */
412 
413