26 template <
class T, enum MaterialOutput out>
27 class gsMaterialMatrixIntegrate :
public gsFunction<T>
34 m_materialMatrices(materialMatrices),
37 for (
index_t p = 0; p!=m_materialMatrices.size(); p++)
39 GISMO_ASSERT(materialMatrices.piece(p)!=
nullptr,
"Material matrix "<<p<<
" is incomplete!");
40 GISMO_ASSERT(materialMatrices.piece(p)!=NULL,
"Material matrix "<<p<<
" is incomplete!");
41 GISMO_ASSERT(materialMatrices.piece(p)->initialized(),
"Material matrix "<<p<<
" is incomplete!");
44 this->_makePieces(deformed);
48 gsMaterialMatrixIntegrate( gsMaterialMatrixBase<T> * materialMatrix,
49 const gsFunctionSet<T> * deformed)
51 m_materialMatrices(deformed->nPieces()),
54 GISMO_ASSERT(materialMatrix->initialized(),
"Material matrix is incomplete!");
55 for (
index_t p = 0; p!=deformed->nPieces(); ++p)
56 m_materialMatrices.set(p,materialMatrix);
57 this->_makePieces(deformed);
61 gsMaterialMatrixIntegrate(
const gsMaterialMatrixContainer<T> & materialMatrices,
62 const gsFunctionSet<T> * undeformed,
63 const gsFunctionSet<T> * deformed)
65 m_materialMatrices(materialMatrices),
68 this->_makePieces(undeformed,deformed);
72 gsMaterialMatrixIntegrate( gsMaterialMatrixBase<T> * materialMatrix,
73 const gsFunctionSet<T> * undeformed,
74 const gsFunctionSet<T> * deformed)
76 m_materialMatrices(deformed->
nPieces()),
79 for (
index_t p = 0; p!=deformed->nPieces(); ++p)
81 m_materialMatrices.set(p,materialMatrix);
82 this->_makePieces(undeformed,deformed);
87 ~gsMaterialMatrixIntegrate()
93 short_t domainDim()
const {
return 2;}
102 short_t targetDim()
const {
return this->piece(0).targetDim(); }
105 const gsFunction<T> & piece(
const index_t p)
const
111 void eval_into(
const gsMatrix<T>& u, gsMatrix<T>& result)
const
115 void _makePieces(
const gsFunctionSet<T> * deformed)
117 m_pieces.resize(deformed->nPieces());
118 for (
size_t p = 0; p!=m_pieces.size(); ++p)
119 m_pieces.at(p) =
new gsMaterialMatrixIntegrateSingle<T,out>(p,m_materialMatrices.piece(p),deformed);
122 void _makePieces(
const gsFunctionSet<T> * undeformed,
const gsFunctionSet<T> * deformed)
124 m_pieces.resize(m_deformed->nPieces());
125 for (
size_t p = 0; p!=m_pieces.size(); ++p)
126 m_pieces.at(p) =
new gsMaterialMatrixIntegrateSingle<T,out>(p,m_materialMatrices.piece(p),undeformed,deformed);
130 gsMaterialMatrixContainer<T> m_materialMatrices;
131 const gsFunctionSet<T> * m_deformed;
132 mutable std::vector<gsMaterialMatrixIntegrateSingle<T,out> *> m_pieces;
143 template <
class T, enum MaterialOutput out>
144 class gsMaterialMatrixIntegrateSingle :
public gsFunction<T>
150 gsMaterialMatrixBase<T> * materialMatrix,
151 const gsFunctionSet<T> * deformed);
155 gsMaterialMatrixBase<T> * materialMatrix,
156 const gsFunctionSet<T> * undeformed,
157 const gsFunctionSet<T> * deformed);
176 template<enum MaterialOutput _out>
177 typename std::enable_if<_out==MaterialOutput::Density , short_t>::type
targetDim_impl()
const {
return 1; };
180 template<enum MaterialOutput _out>
181 typename std::enable_if<_out==MaterialOutput::VectorN ||
182 _out==MaterialOutput::CauchyVectorN ||
183 _out==MaterialOutput::VectorM ||
187 template<enum MaterialOutput _out>
188 typename std::enable_if<_out==MaterialOutput::MatrixA ||
189 _out==MaterialOutput::MatrixB ||
190 _out==MaterialOutput::MatrixC ||
194 template<enum MaterialOutput _out>
195 typename std::enable_if<_out==MaterialOutput::PStressN ||
196 _out==MaterialOutput::PStressM ||
197 _out==MaterialOutput::PStrainN ||
201 template<enum MaterialOutput _out>
202 typename std::enable_if<_out==MaterialOutput::Stretch , short_t>::type
targetDim_impl()
const {
return 3; };
205 template<enum MaterialOutput _out>
206 typename std::enable_if<_out==MaterialOutput::StretchDir, short_t>::type
targetDim_impl()
const {
return 9; };
218 template<enum MaterialOutput _out>
222 template<enum MaterialOutput _out>
223 typename std::enable_if<_out==MaterialOutput::VectorN ||
227 template<enum MaterialOutput _out>
228 typename std::enable_if<_out==MaterialOutput::VectorM ||
232 template<enum MaterialOutput _out>
233 typename std::enable_if<_out==MaterialOutput::MatrixA ||
234 _out==MaterialOutput::MatrixB ||
235 _out==MaterialOutput::MatrixC ||
239 template<enum MaterialOutput _out>
240 typename std::enable_if<_out==MaterialOutput::PStressN ||
244 template<enum MaterialOutput _out>
245 typename std::enable_if<_out==MaterialOutput::PStrainN ||
249 template<enum MaterialOutput _out>
253 template<enum MaterialOutput _out>
277 template<enum MaterialOutput _out>
278 typename std::enable_if<_out==MaterialOutput::VectorN ||
279 _out==MaterialOutput::PStressN||
280 _out==MaterialOutput::CauchyVectorN, T>::type
getMoment_impl()
const {
return 0; };
283 template<enum MaterialOutput _out>
284 typename std::enable_if<_out==MaterialOutput::VectorM ||
285 _out==MaterialOutput::PStressM||
286 _out==MaterialOutput::CauchyVectorM, T>::type
getMoment_impl()
const {
return 1; };
289 template<enum MaterialOutput _out>
290 typename std::enable_if<_out==MaterialOutput::MatrixA, T>::type
getMoment_impl()
const {
return 0; };
293 template<enum MaterialOutput _out>
294 typename std::enable_if<_out==MaterialOutput::MatrixB, T>::type
getMoment_impl()
const {
return 1; };
297 template<enum MaterialOutput _out>
298 typename std::enable_if<_out==MaterialOutput::MatrixC, T>::type
getMoment_impl()
const {
return 1; };
301 template<enum MaterialOutput _out>
302 typename std::enable_if<_out==MaterialOutput::MatrixD, T>::type
getMoment_impl()
const {
return 2; };
305 template<enum MaterialOutput _out>
306 typename std::enable_if<!(_out==MaterialOutput::VectorN || _out==MaterialOutput::VectorM ||
307 _out==MaterialOutput::CauchyVectorN || _out==MaterialOutput::CauchyVectorM ||
308 _out==MaterialOutput::MatrixA || _out==MaterialOutput::MatrixB ||
309 _out==MaterialOutput::MatrixC || _out==MaterialOutput::MatrixD ||
310 _out==MaterialOutput::PStressN || _out==MaterialOutput::PStressM )
391 template<enum MaterialOutput _out>
392 typename std::enable_if<_out==MaterialOutput::VectorN ||
396 template<enum MaterialOutput _out>
397 typename std::enable_if<_out==MaterialOutput::CauchyVectorN ||
402 template<enum MaterialOutput _out>
403 typename std::enable_if<_out==MaterialOutput::MatrixA ||
404 _out==MaterialOutput::MatrixB ||
405 _out==MaterialOutput::MatrixC ||
409 template<enum MaterialOutput _out>
410 typename std::enable_if<_out==MaterialOutput::PStress ||
411 _out==MaterialOutput::PStressN ||
415 template<enum MaterialOutput _out>
416 typename std::enable_if<!(_out==MaterialOutput::VectorN || _out==MaterialOutput::VectorM ||
417 _out==MaterialOutput::CauchyVectorN || _out==MaterialOutput::CauchyVectorM ||
418 _out==MaterialOutput::MatrixA || _out==MaterialOutput::MatrixB ||
419 _out==MaterialOutput::MatrixC || _out==MaterialOutput::MatrixD ||
420 _out==MaterialOutput::PStressN || _out==MaterialOutput::PStressM )
433 #ifndef GISMO_BUILD_LIB
434 #include GISMO_HPP_HEADER(gsMaterialMatrixIntegrate.hpp)
void multiplyZ_into(const gsMatrix< T > &u, index_t moment, gsMatrix< T > &result) const
Multiplies the evaluation at z=0 with 2.0/(moment+1) * Thalf^(moment + 1)
Definition: gsMaterialMatrixIntegrate.hpp:270
void integrateZ_into(const gsMatrix< T > &u, const index_t moment, gsMatrix< T > &result) const
Integrates through-thickness using Gauss integration.
Definition: gsMaterialMatrixIntegrate.hpp:183
#define GISMO_NO_IMPLEMENTATION
Definition: gsDebug.h:129
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: gsMaterialMatrixIntegrate.h:191
std::enable_if< _out==MaterialOutput::MatrixB, T >::type getMoment_impl() const
Implementation of getMoment for MaterialOutput::MatrixB; the moment is 1.
Definition: gsMaterialMatrixIntegrate.h:294
std::enable_if< _out==MaterialOutput::MatrixD, T >::type getMoment_impl() const
Implementation of getMoment for MaterialOutput::MatrixD; the moment is 2.
Definition: gsMaterialMatrixIntegrate.h:302
#define short_t
Definition: gsConfig.h:35
short_t targetDim() const
Target dimension.
Definition: gsMaterialMatrixIntegrate.h:171
This class serves as the evaluator of material matrices, based on gsMaterialMatrixBase.
Definition: gsMaterialMatrixContainer.h:33
void setPatch(index_t p)
Sets the patch index.
Definition: gsMaterialMatrixIntegrate.h:210
std::enable_if<!(_out==MaterialOutput::VectorN||_out==MaterialOutput::VectorM||_out==MaterialOutput::CauchyVectorN||_out==MaterialOutput::CauchyVectorM||_out==MaterialOutput::MatrixA||_out==MaterialOutput::MatrixB||_out==MaterialOutput::MatrixC||_out==MaterialOutput::MatrixD||_out==MaterialOutput::PStressN||_out==MaterialOutput::PStressM), gsMatrix< T > >::type eval3D_impl(const gsMatrix< T > &u, const gsMatrix< T > &Z) const
Specialisation of eval3D for other types.
Definition: gsMaterialMatrixIntegrate.h:421
gsMatrix< T > _eval(const gsMatrix< T > &u) const
Integrateuates the base class in 3D, but on Z=0.
Definition: gsMaterialMatrixIntegrate.hpp:296
#define index_t
Definition: gsConfig.h:32
A function from a n-dimensional domain to an m-dimensional image.
Definition: gsFunction.h:59
std::enable_if< _out==MaterialOutput::PStressN||_out==MaterialOutput::PStressM||_out==MaterialOutput::PStrainN||_out==MaterialOutput::PStrainM, short_t >::type targetDim_impl() const
Implementation of targetDim for principal stress fields.
Definition: gsMaterialMatrixIntegrate.h:198
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
This class defines the base class for material matrices.
Definition: gsMaterialMatrixBase.h:32
void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Implementation of eval_into, see gsFunction.
Definition: gsMaterialMatrixIntegrate.hpp:63
std::enable_if< _out==MaterialOutput::MatrixC, T >::type getMoment_impl() const
Implementation of getMoment for MaterialOutput::MatrixC; the moment is 1.
Definition: gsMaterialMatrixIntegrate.h:298
std::enable_if< _out==MaterialOutput::Density, short_t >::type targetDim_impl() const
Implementation of targetDim for densities.
Definition: gsMaterialMatrixIntegrate.h:177
std::enable_if< _out==MaterialOutput::MatrixA, T >::type getMoment_impl() const
Implementation of getMoment for MaterialOutput::MatrixA; the moment is 0.
Definition: gsMaterialMatrixIntegrate.h:290
std::enable_if< _out==MaterialOutput::VectorN||_out==MaterialOutput::VectorM, gsMatrix< T > >::type eval3D_impl(const gsMatrix< T > &u, const gsMatrix< T > &Z) const
Specialisation of eval3D for vectors.
Definition: gsMaterialMatrixIntegrate.hpp:322
void multiplyLinZ_into(const gsMatrix< T > &u, const index_t moment, gsMatrix< T > &result) const
Uses the top and bottom parts of the thickness to compute the integral exactly.
Definition: gsMaterialMatrixIntegrate.hpp:236
std::enable_if<!(_out==MaterialOutput::VectorN||_out==MaterialOutput::VectorM||_out==MaterialOutput::CauchyVectorN||_out==MaterialOutput::CauchyVectorM||_out==MaterialOutput::MatrixA||_out==MaterialOutput::MatrixB||_out==MaterialOutput::MatrixC||_out==MaterialOutput::MatrixD||_out==MaterialOutput::PStressN||_out==MaterialOutput::PStressM), index_t >::type getMoment_impl() const
Implementation of getMoment for MaterialOutput other than VectorN, VectorM, MatrixA, MatrixB, MatrixC, MatrixD, PStressN, PStressM.
Definition: gsMaterialMatrixIntegrate.h:311
Interface for the set of functions defined on a domain (the total number of functions in the set equa...
Definition: gsFuncData.h:23
void freeAll(It begin, It end)
Frees all pointers in the range [begin end)
Definition: gsMemory.h:312
std::enable_if< _out==MaterialOutput::VectorN||_out==MaterialOutput::PStressN||_out==MaterialOutput::CauchyVectorN, T >::type getMoment_impl() const
Implementation of getMoment for MaterialOutput::VectorN; the moment is 0.
Definition: gsMaterialMatrixIntegrate.h:280
short_t domainDim() const
Domain dimension, always 2 for shells.
Definition: gsMaterialMatrixIntegrate.h:162
gsMaterialMatrixIntegrateSingle(index_t patch, gsMaterialMatrixBase< T > *materialMatrix, const gsFunctionSet< T > *deformed)
Constructor.
Definition: gsMaterialMatrixIntegrate.hpp:34
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: gsMaterialMatrixIntegrate.hpp:73
This class serves as the integrator of material matrices, based on gsMaterialMatrixBase.
Definition: gsMaterialMatrixIntegrate.h:24
std::enable_if< _out==MaterialOutput::Stretch, short_t >::type targetDim_impl() const
Implementation of targetDim for principal stretch fields.
Definition: gsMaterialMatrixIntegrate.h:202
virtual index_t nPieces() const
Number of pieces in the domain of definition.
Definition: gsFunctionSet.h:584
std::enable_if< _out==MaterialOutput::StretchDir, short_t >::type targetDim_impl() const
Implementation of targetDim for principal stress directions.
Definition: gsMaterialMatrixIntegrate.h:206
Provides a container for material matrices for thin shells.
T getMoment() const
Gets the moment based on the output type.
Definition: gsMaterialMatrixIntegrate.h:273
Provides declaration of Function abstract interface.
gsMatrix< T > _eval3D(const gsMatrix< T > &u, const gsMatrix< T > &Z) const
Integrateuates the base class in 3D.
Definition: gsMaterialMatrixIntegrate.hpp:304
std::enable_if< _out==MaterialOutput::VectorN||_out==MaterialOutput::CauchyVectorN||_out==MaterialOutput::VectorM||_out==MaterialOutput::CauchyVectorM, short_t >::type targetDim_impl() const
Implementation of targetDim for stress tensors.
Definition: gsMaterialMatrixIntegrate.h:184
std::enable_if< _out==MaterialOutput::VectorM||_out==MaterialOutput::PStressM||_out==MaterialOutput::CauchyVectorM, T >::type getMoment_impl() const
Implementation of getMoment for MaterialOutput::VectorM; the moment is 1.
Definition: gsMaterialMatrixIntegrate.h:286