G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsMaterialMatrixEval.h
Go to the documentation of this file.
1
16#pragma once
17
18#include <gsCore/gsFunction.h>
20
21namespace gismo
22{
23
24template <class T, enum MaterialOutput out> class gsMaterialMatrixEvalSingle;
25
26template <class T, enum MaterialOutput out>
27class gsMaterialMatrixEval : public gsFunction<T>
28{
29public:
31 gsMaterialMatrixEval( const gsMaterialMatrixContainer<T> & materialMatrices,
32 const gsFunctionSet<T> * deformed,
33 const gsMatrix<T> z);
34
36 gsMaterialMatrixEval( gsMaterialMatrixBase<T> * materialMatrix,
37 const gsFunctionSet<T> * deformed,
38 const gsMatrix<T> z);
39
41 gsMaterialMatrixEval( typename gsMaterialMatrixBase<T>::uPtr & materialMatrix,
42 const gsFunctionSet<T> * deformed,
43 const gsMatrix<T> z);
44
46 gsMaterialMatrixEval( const gsMaterialMatrixContainer<T> & materialMatrices,
47 const gsFunctionSet<T> * undeformed,
48 const gsFunctionSet<T> * deformed,
49 const gsMatrix<T> z);
50
52 gsMaterialMatrixEval( gsMaterialMatrixBase<T> * materialMatrix,
53 const gsFunctionSet<T> * undeformed,
54 const gsFunctionSet<T> * deformed,
55 const gsMatrix<T> z);
56
58 gsMaterialMatrixEval( typename gsMaterialMatrixBase<T>::uPtr & materialMatrix,
59 const gsFunctionSet<T> * undeformed,
60 const gsFunctionSet<T> * deformed,
61 const gsMatrix<T> z);
62
64 ~gsMaterialMatrixEval();
65
67 short_t domainDim() const {return 2;}
68
76 short_t targetDim() const { return this->piece(0).targetDim(); }
77
79 const gsFunction<T> & piece(const index_t p) const { return *m_pieces[p]; }
80
82 void eval_into(const gsMatrix<T>& /*u*/, gsMatrix<T>& /*result*/) const
84
85protected:
86 void _makePieces();
87
88 void _makePieces(const gsFunctionSet<T> * undeformed);
89
90protected:
91 gsMaterialMatrixContainer<T> m_materialMatrices;
92 const gsFunctionSet<T> * m_deformed;
93 gsMatrix<T> m_z;
94 mutable std::vector<gsMaterialMatrixEvalSingle<T,out> *> m_pieces;
95};
96
105template <class T, enum MaterialOutput out>
107{
108public:
109
112 gsMaterialMatrixBase<T> * materialMatrix,
113 const gsFunctionSet<T> * deformed,
114 const gsMatrix<T> z);
115
118 gsMaterialMatrixBase<T> * materialMatrix,
119 const gsFunctionSet<T> * undeformed,
120 const gsFunctionSet<T> * deformed,
121 const gsMatrix<T> z);
122
124
126 short_t domainDim() const {return 2;}
127
135 short_t targetDim() const { return targetDim_impl<out>(); }
136
137
138private:
140 template<enum MaterialOutput _out>
141 typename std::enable_if<_out==MaterialOutput::Density , short_t>::type targetDim_impl() const { return 1; };
142
144 template<enum MaterialOutput _out>
145 typename std::enable_if<_out==MaterialOutput::VectorN ||
146 _out==MaterialOutput::CauchyVectorN ||
147 _out==MaterialOutput::VectorM ||
148 _out==MaterialOutput::CauchyVectorM ||
149 _out==MaterialOutput::Generic , short_t>::type targetDim_impl() const { return 3; };
150
152 template<enum MaterialOutput _out>
153 typename std::enable_if<_out==MaterialOutput::MatrixA ||
154 _out==MaterialOutput::MatrixB ||
155 _out==MaterialOutput::MatrixC ||
156 _out==MaterialOutput::MatrixD , short_t>::type targetDim_impl() const { return 9; };
157
159 template<enum MaterialOutput _out>
160 typename std::enable_if<_out==MaterialOutput::Stretch , short_t>::type targetDim_impl() const { return 3; };
161
163 template<enum MaterialOutput _out>
164 typename std::enable_if<_out==MaterialOutput::PStress ||
165 _out==MaterialOutput::PStressN ||
166 _out==MaterialOutput::PCauchyStressN ||
167 _out==MaterialOutput::PStressM ||
168 _out==MaterialOutput::PCauchyStressM ||
169 _out==MaterialOutput::PStrainN ||
170 _out==MaterialOutput::PStrainM , short_t>::type targetDim_impl() const { return 2; };
171
173 template<enum MaterialOutput _out>
174 typename std::enable_if<_out==MaterialOutput::StretchDir, short_t>::type targetDim_impl() const { return 9; };
175
177 template<enum MaterialOutput _out>
178 typename std::enable_if<_out==MaterialOutput::PStressDir, short_t>::type targetDim_impl() const { return 9; };
179
181 template<enum MaterialOutput _out>
182 typename std::enable_if<_out==MaterialOutput::Spec2CovTransform ||
183 _out==MaterialOutput::Spec2ConTransform ||
184 _out==MaterialOutput::Cov2CartTransform ||
185 _out==MaterialOutput::Con2CartTransform, short_t>::type targetDim_impl() const { return 9; };
186
188 template<enum MaterialOutput _out>
189 typename std::enable_if<_out==MaterialOutput::TensionField, short_t>::type targetDim_impl() const { return 1; };
190
192 template<enum MaterialOutput _out>
193 typename std::enable_if<_out==MaterialOutput::StretchTransform ||
194 _out==MaterialOutput::PStressTransform, short_t>::type targetDim_impl() const { return 9; };
195
197 template<enum MaterialOutput _out>
198 typename std::enable_if<_out==MaterialOutput::Theta ||
199 _out==MaterialOutput::Gamma , short_t>::type targetDim_impl() const { return 1; };
200
202 template<enum MaterialOutput _out>
203 typename std::enable_if<_out==MaterialOutput::Strain ||
204 _out==MaterialOutput::StrainN ||
205 _out==MaterialOutput::StrainM , short_t>::type targetDim_impl() const { return 3; };
206
208 template<enum MaterialOutput _out>
209 typename std::enable_if<_out==MaterialOutput::Stress ||
210 _out==MaterialOutput::StressN ||
211 _out==MaterialOutput::StressM ||
212 _out==MaterialOutput::CauchyStressN ||
213 _out==MaterialOutput::CauchyStressM , short_t>::type targetDim_impl() const { return 3; };
214
216 template<enum MaterialOutput _out>
217 typename std::enable_if<_out==MaterialOutput::Thickness, short_t>::type targetDim_impl() const { return 1; };
218
220 template<enum MaterialOutput _out>
221 typename std::enable_if<_out==MaterialOutput::Parameters, short_t>::type targetDim_impl() const { return m_materialMat->numParameters(); };
222
224 template<enum MaterialOutput _out>
225 typename std::enable_if<_out==MaterialOutput::Deformation, short_t>::type targetDim_impl() const { return 9; };
226
227protected:
229 void setPatch(index_t p) {m_pIndex = p; }
230
231public:
232
234 void eval_into(const gsMatrix<T>& u, gsMatrix<T>& result) const;
235
236private:
238 template<enum MaterialOutput _out>
239 typename std::enable_if<_out==MaterialOutput::Density , void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
240
242 template<enum MaterialOutput _out>
243 typename std::enable_if<_out==MaterialOutput::VectorN ||
244 _out==MaterialOutput::VectorM ||
245 _out==MaterialOutput::Generic , void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
246
248 template<enum MaterialOutput _out>
249 typename std::enable_if<_out==MaterialOutput::CauchyVectorN ||
250 _out==MaterialOutput::CauchyVectorM , void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
251
252
254 template<enum MaterialOutput _out>
255 typename std::enable_if<_out==MaterialOutput::MatrixA ||
256 _out==MaterialOutput::MatrixB ||
257 _out==MaterialOutput::MatrixC ||
258 _out==MaterialOutput::MatrixD , void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
259
261 template<enum MaterialOutput _out>
262 typename std::enable_if<_out==MaterialOutput::PStress ||
263 _out==MaterialOutput::PStressN ||
264 _out==MaterialOutput::PStressM , void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
265
267 template<enum MaterialOutput _out>
268 typename std::enable_if<_out==MaterialOutput::PCauchyStressN ||
269 _out==MaterialOutput::PCauchyStressM , void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
270
272 template<enum MaterialOutput _out>
273 typename std::enable_if<_out==MaterialOutput::PStrainN ||
274 _out==MaterialOutput::PStrainM , void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
275
277 template<enum MaterialOutput _out>
278 typename std::enable_if<_out==MaterialOutput::Stretch , void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
279
281 template<enum MaterialOutput _out>
282 typename std::enable_if<_out==MaterialOutput::StretchDir, void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
283
285 template<enum MaterialOutput _out>
286 typename std::enable_if<_out==MaterialOutput::PStressDir, void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
287
289 template<enum MaterialOutput _out>
290 typename std::enable_if<_out==MaterialOutput::StretchTransform, void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
291
293 template<enum MaterialOutput _out>
294 typename std::enable_if<_out==MaterialOutput::PStressTransform, void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
295
297 template<enum MaterialOutput _out>
298 typename std::enable_if<_out==MaterialOutput::Spec2CovTransform, void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
299
301 template<enum MaterialOutput _out>
302 typename std::enable_if<_out==MaterialOutput::Spec2ConTransform, void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
303
305 template<enum MaterialOutput _out>
306 typename std::enable_if<_out==MaterialOutput::Cov2CartTransform, void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
307
309 template<enum MaterialOutput _out>
310 typename std::enable_if<_out==MaterialOutput::Con2CartTransform, void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
311
313 template<enum MaterialOutput _out>
314 typename std::enable_if<_out==MaterialOutput::TensionField, void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
315
317 template<enum MaterialOutput _out>
318 typename std::enable_if<_out==MaterialOutput::Theta, void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
319
321 template<enum MaterialOutput _out>
322 typename std::enable_if<_out==MaterialOutput::Gamma, void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
323
325 template<enum MaterialOutput _out>
326 typename std::enable_if<_out==MaterialOutput::Strain ||
327 _out==MaterialOutput::StrainN ||
328 _out==MaterialOutput::StrainM , void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
329
331 template<enum MaterialOutput _out>
332 typename std::enable_if<_out==MaterialOutput::Stress ||
333 _out==MaterialOutput::StressN ||
334 _out==MaterialOutput::StressM , void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
335
337 template<enum MaterialOutput _out>
338 typename std::enable_if<_out==MaterialOutput::CauchyStress ||
339 _out==MaterialOutput::CauchyStressN ||
340 _out==MaterialOutput::CauchyStressM , void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
341
342
344 template<enum MaterialOutput _out>
345 typename std::enable_if<_out==MaterialOutput::Thickness, void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
346
348 template<enum MaterialOutput _out>
349 typename std::enable_if<_out==MaterialOutput::Parameters, void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
350
352 template<enum MaterialOutput _out>
353 typename std::enable_if<_out==MaterialOutput::Deformation, void>::type eval_into_impl(const gsMatrix<T>& u, gsMatrix<T>& result) const;
354
355protected:
356 index_t m_pIndex;
357 gsMaterialMatrixBase<T> * m_materialMat;
358 gsMatrix<T> m_z;
359};
360
361} // namespace
362
363
364#ifndef GISMO_BUILD_LIB
365#include GISMO_HPP_HEADER(gsMaterialMatrixEval.hpp)
366#endif
367
Interface for the set of functions defined on a domain (the total number of functions in the set equa...
Definition gsFunctionSet.h:219
A function from a n-dimensional domain to an m-dimensional image.
Definition gsFunction.h:60
This class defines the base class for material matrices.
Definition gsMaterialMatrixBase.h:33
memory::unique_ptr< gsMaterialMatrixBase > uPtr
Unique pointer for gsGeometry.
Definition gsMaterialMatrixBase.h:44
This class serves as the evaluator of material matrices, based on gsMaterialMatrixBase.
Definition gsMaterialMatrixEval.h:107
std::enable_if< _out==MaterialOutput::Stress||_out==MaterialOutput::StressN||_out==MaterialOutput::StressM, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for stress.
std::enable_if< _out==MaterialOutput::PCauchyStressN||_out==MaterialOutput::PCauchyStressM, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the membrane and flexural principle stresses.
std::enable_if< _out==MaterialOutput::PStress||_out==MaterialOutput::PStressN||_out==MaterialOutput::PStressM, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the membrane and flexural principle stresses.
std::enable_if< _out==MaterialOutput::CauchyStress||_out==MaterialOutput::CauchyStressN||_out==MaterialOutput::CauchyStressM, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for cauchy stress.
std::enable_if< _out==MaterialOutput::StretchDir, short_t >::type targetDim_impl() const
Implementation of targetDim for principal stretch directions.
Definition gsMaterialMatrixEval.h:174
std::enable_if< _out==MaterialOutput::Strain||_out==MaterialOutput::StrainN||_out==MaterialOutput::StrainM, short_t >::type targetDim_impl() const
Specialisation of targetDim for strain.
Definition gsMaterialMatrixEval.h:205
std::enable_if< _out==MaterialOutput::VectorN||_out==MaterialOutput::VectorM||_out==MaterialOutput::Generic, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the membrane stress tensor N, M and generic stress.
std::enable_if< _out==MaterialOutput::StretchDir, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the stretch directions.
std::enable_if< _out==MaterialOutput::PStressDir, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the stretch directions.
std::enable_if< _out==MaterialOutput::TensionField, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for tension field indicator.
std::enable_if< _out==MaterialOutput::Stretch, short_t >::type targetDim_impl() const
Implementation of targetDim for principal stretch fields.
Definition gsMaterialMatrixEval.h:160
std::enable_if< _out==MaterialOutput::Con2CartTransform, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the contravariant basis transformation.
std::enable_if< _out==MaterialOutput::Stress||_out==MaterialOutput::StressN||_out==MaterialOutput::StressM||_out==MaterialOutput::CauchyStressN||_out==MaterialOutput::CauchyStressM, short_t >::type targetDim_impl() const
Specialisation of targetDim for strain.
Definition gsMaterialMatrixEval.h:213
std::enable_if< _out==MaterialOutput::TensionField, short_t >::type targetDim_impl() const
Implementation of targetDim for the tension field indicator.
Definition gsMaterialMatrixEval.h:189
std::enable_if< _out==MaterialOutput::Cov2CartTransform, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the covariant basis transformation.
std::enable_if< _out==MaterialOutput::MatrixA||_out==MaterialOutput::MatrixB||_out==MaterialOutput::MatrixC||_out==MaterialOutput::MatrixD, short_t >::type targetDim_impl() const
Implementation of targetDim for material tensors.
Definition gsMaterialMatrixEval.h:156
std::enable_if< _out==MaterialOutput::MatrixA||_out==MaterialOutput::MatrixB||_out==MaterialOutput::MatrixC||_out==MaterialOutput::MatrixD, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the moments of the material matrices.
void setPatch(index_t p)
Sets the patch index.
Definition gsMaterialMatrixEval.h:229
std::enable_if< _out==MaterialOutput::Stretch, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the stretches.
short_t targetDim() const
Target dimension.
Definition gsMaterialMatrixEval.h:135
std::enable_if< _out==MaterialOutput::Spec2CovTransform||_out==MaterialOutput::Spec2ConTransform||_out==MaterialOutput::Cov2CartTransform||_out==MaterialOutput::Con2CartTransform, short_t >::type targetDim_impl() const
Implementation of targetDim for transformations.
Definition gsMaterialMatrixEval.h:185
void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Implementation of eval_into, see gsFunction.
Definition gsMaterialMatrixEval.hpp:175
std::enable_if< _out==MaterialOutput::PStress||_out==MaterialOutput::PStressN||_out==MaterialOutput::PCauchyStressN||_out==MaterialOutput::PStressM||_out==MaterialOutput::PCauchyStressM||_out==MaterialOutput::PStrainN||_out==MaterialOutput::PStrainM, short_t >::type targetDim_impl() const
Implementation of targetDim for principal stress fields.
Definition gsMaterialMatrixEval.h:170
std::enable_if< _out==MaterialOutput::Parameters, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the parameters.
std::enable_if< _out==MaterialOutput::Gamma, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for theta.
std::enable_if< _out==MaterialOutput::Density, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for densities.
Definition gsMaterialMatrixEval.hpp:185
std::enable_if< _out==MaterialOutput::Spec2CovTransform, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the covariant basis transformation.
std::enable_if< _out==MaterialOutput::Thickness, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the thickness.
short_t domainDim() const
Domain dimension, always 2 for shells.
Definition gsMaterialMatrixEval.h:126
std::enable_if< _out==MaterialOutput::Theta||_out==MaterialOutput::Gamma, short_t >::type targetDim_impl() const
Implementation of targetDim for TFT variables.
Definition gsMaterialMatrixEval.h:199
std::enable_if< _out==MaterialOutput::Theta, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for theta.
std::enable_if< _out==MaterialOutput::Deformation, short_t >::type targetDim_impl() const
Implementation of targetDim for principal stress directions.
Definition gsMaterialMatrixEval.h:225
std::enable_if< _out==MaterialOutput::Spec2ConTransform, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the contravariant basis transformation.
std::enable_if< _out==MaterialOutput::Parameters, short_t >::type targetDim_impl() const
Implementation of targetDim for the parameters.
Definition gsMaterialMatrixEval.h:221
std::enable_if< _out==MaterialOutput::StretchTransform||_out==MaterialOutput::PStressTransform, short_t >::type targetDim_impl() const
Implementation of targetDim for principal stress directions.
Definition gsMaterialMatrixEval.h:194
std::enable_if< _out==MaterialOutput::StretchTransform, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the covariant basis transformation.
std::enable_if< _out==MaterialOutput::Strain||_out==MaterialOutput::StrainN||_out==MaterialOutput::StrainM, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for strain.
std::enable_if< _out==MaterialOutput::CauchyVectorN||_out==MaterialOutput::CauchyVectorM, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the membrane cauchy stress tensor N, M and generic cauchy stress.
std::enable_if< _out==MaterialOutput::Density, short_t >::type targetDim_impl() const
Implementation of targetDim for densities.
Definition gsMaterialMatrixEval.h:141
std::enable_if< _out==MaterialOutput::VectorN||_out==MaterialOutput::CauchyVectorN||_out==MaterialOutput::VectorM||_out==MaterialOutput::CauchyVectorM||_out==MaterialOutput::Generic, short_t >::type targetDim_impl() const
Implementation of targetDim for stress tensors.
Definition gsMaterialMatrixEval.h:149
std::enable_if< _out==MaterialOutput::PStrainN||_out==MaterialOutput::PStrainM, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the membrane and flexural principle stresses.
std::enable_if< _out==MaterialOutput::Thickness, short_t >::type targetDim_impl() const
Implementation of targetDim for the thickness.
Definition gsMaterialMatrixEval.h:217
std::enable_if< _out==MaterialOutput::PStressTransform, void >::type eval_into_impl(const gsMatrix< T > &u, gsMatrix< T > &result) const
Specialisation of eval_into for the contravariant basis transformation.
std::enable_if< _out==MaterialOutput::PStressDir, short_t >::type targetDim_impl() const
Implementation of targetDim for principal stress directions.
Definition gsMaterialMatrixEval.h:178
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
#define GISMO_NO_IMPLEMENTATION
Definition gsDebug.h:129
Provides declaration of Function abstract interface.
Provides a container for material matrices for thin shells.
The G+Smo namespace, containing all definitions for the library.