32template <
class T, enum MaterialOutput out>
33gsMaterialMatrixIntegrate<T,out>::gsMaterialMatrixIntegrate(
const gsMaterialMatrixContainer<T> & materialMatrices,
34 const gsFunctionSet<T> * deformed)
36m_materialMatrices(materialMatrices),
39 for (
index_t p = 0; p!=m_materialMatrices.size(); p++)
41 GISMO_ASSERT(materialMatrices.piece(p)!=
nullptr,
"Material matrix "<<p<<
" is incomplete!");
42 GISMO_ASSERT(materialMatrices.piece(p)!=NULL,
"Material matrix "<<p<<
" is incomplete!");
43 GISMO_ASSERT(materialMatrices.piece(p)->initialized(),
"Material matrix "<<p<<
" is incomplete!");
46 this->_makePieces(deformed);
49template <
class T, enum MaterialOutput out>
50gsMaterialMatrixIntegrate<T,out>::gsMaterialMatrixIntegrate(gsMaterialMatrixBase<T> * materialMatrix,
51 const gsFunctionSet<T> * deformed)
53m_materialMatrices(deformed->nPieces()),
56 GISMO_ASSERT(materialMatrix->initialized(),
"Material matrix is incomplete!");
57 for (
index_t p = 0; p!=deformed->nPieces(); ++p)
58 m_materialMatrices.set(p,materialMatrix);
59 this->_makePieces(deformed);
62template <
class T, enum MaterialOutput out>
63gsMaterialMatrixIntegrate<T,out>::gsMaterialMatrixIntegrate(
typename gsMaterialMatrixBase<T>::uPtr & materialMatrix,
64 const gsFunctionSet<T> * deformed)
66gsMaterialMatrixIntegrate(materialMatrix.get(),deformed)
70template <
class T, enum MaterialOutput out>
71gsMaterialMatrixIntegrate<T,out>::gsMaterialMatrixIntegrate(
const gsMaterialMatrixContainer<T> & materialMatrices,
72 const gsFunctionSet<T> * undeformed,
73 const gsFunctionSet<T> * deformed)
75m_materialMatrices(materialMatrices),
78 this->_makePieces(undeformed,deformed);
81template <
class T, enum MaterialOutput out>
82gsMaterialMatrixIntegrate<T,out>::gsMaterialMatrixIntegrate(gsMaterialMatrixBase<T> * materialMatrix,
83 const gsFunctionSet<T> * undeformed,
84 const gsFunctionSet<T> * deformed)
86m_materialMatrices(deformed->nPieces()),
89 for (
index_t p = 0; p!=deformed->nPieces(); ++p)
91 m_materialMatrices.set(p,materialMatrix);
92 this->_makePieces(undeformed,deformed);
96template <
class T, enum MaterialOutput out>
97gsMaterialMatrixIntegrate<T,out>::gsMaterialMatrixIntegrate(
typename gsMaterialMatrixBase<T>::uPtr & materialMatrix,
98 const gsFunctionSet<T> * undeformed,
99 const gsFunctionSet<T> * deformed)
101gsMaterialMatrixIntegrate(materialMatrix.get(),undeformed,deformed)
105template <
class T, enum MaterialOutput out>
106gsMaterialMatrixIntegrate<T,out>::~gsMaterialMatrixIntegrate()
111template <
class T, enum MaterialOutput out>
112void gsMaterialMatrixIntegrate<T,out>::_makePieces(
const gsFunctionSet<T> * deformed)
114 m_pieces.resize(deformed->nPieces());
115 for (
size_t p = 0; p!=m_pieces.size(); ++p)
116 m_pieces.at(p) =
new gsMaterialMatrixIntegrateSingle<T,out>(p,m_materialMatrices.piece(p),deformed);
120template <
class T, enum MaterialOutput out>
121void gsMaterialMatrixIntegrate<T,out>::_makePieces(
const gsFunctionSet<T> * undeformed,
const gsFunctionSet<T> * deformed)
123 m_pieces.resize(m_deformed->nPieces());
124 for (
size_t p = 0; p!=m_pieces.size(); ++p)
125 m_pieces.at(p) =
new gsMaterialMatrixIntegrateSingle<T,out>(p,m_materialMatrices.piece(p),undeformed,deformed);
130template <
class T, enum MaterialOutput out>
137m_materialMat(materialMatrix)
139 m_materialMat->setDeformed(deformed);
144template <
class T, enum MaterialOutput out>
152m_materialMat(materialMatrix)
154 m_materialMat->setUndeformed(undeformed);
155 m_materialMat->setDeformed(deformed);
159template <
class T, enum MaterialOutput out>
164 this->eval_into_impl<out>(u,result);
167template <
class T, enum MaterialOutput out>
168template <enum MaterialOutput _out>
169typename std::enable_if<_out==MaterialOutput::Density, void>::type
172 m_materialMat->density_into(m_pIndex,u,result);
175template <
class T, enum MaterialOutput out>
176template <enum MaterialOutput _out>
177typename std::enable_if<_out==MaterialOutput::VectorN ||
178 _out==MaterialOutput::CauchyVectorN,
void>::type
181 if (m_materialMat->isVecIntegrated() == MatIntegration::NotIntegrated)
182 this->integrateZ_into(u,getMoment(),result);
183 else if (m_materialMat->isVecIntegrated() == MatIntegration::Integrated)
184 result = this->_eval(u);
185 else if (m_materialMat->isVecIntegrated() == MatIntegration::Constant)
186 this->multiplyZ_into(u,0,result);
187 else if (m_materialMat->isVecIntegrated() == MatIntegration::Linear)
188 this->multiplyLinZ_into(u,getMoment(),result);
193template <
class T, enum MaterialOutput out>
194template <enum MaterialOutput _out>
195typename std::enable_if<_out==MaterialOutput::VectorM ||
196 _out==MaterialOutput::CauchyVectorM,
void>::type
199 if (m_materialMat->isVecIntegrated() == MatIntegration::NotIntegrated)
200 this->integrateZ_into(u,getMoment(),result);
201 else if (m_materialMat->isVecIntegrated() == MatIntegration::Integrated)
202 result = this->_eval(u);
203 else if (m_materialMat->isVecIntegrated() == MatIntegration::Constant)
204 this->multiplyZ_into(u,2,result);
205 else if (m_materialMat->isVecIntegrated() == MatIntegration::Linear)
206 this->multiplyLinZ_into(u,getMoment(),result);
211template <
class T, enum MaterialOutput out>
212template <enum MaterialOutput _out>
213typename std::enable_if< _out==MaterialOutput::MatrixA || _out==MaterialOutput::MatrixB
214 || _out==MaterialOutput::MatrixC || _out==MaterialOutput::MatrixD,
void>::type
217 if (m_materialMat->isMatIntegrated() == MatIntegration::NotIntegrated)
218 this->integrateZ_into(u,getMoment(),result);
219 else if (m_materialMat->isMatIntegrated() == MatIntegration::Integrated)
220 result = this->_eval(u);
221 else if (m_materialMat->isMatIntegrated() == MatIntegration::Constant)
222 this->multiplyZ_into(u,getMoment(),result);
223 else if (m_materialMat->isMatIntegrated() == MatIntegration::Linear)
224 this->multiplyLinZ_into(u,getMoment(),result);
229template <
class T, enum MaterialOutput out>
230template <enum MaterialOutput _out>
231typename std::enable_if<_out==MaterialOutput::PStressN || _out==MaterialOutput::PStressM, void>::type
234 if (m_materialMat->isMatIntegrated() == MatIntegration::NotIntegrated)
235 this->integrateZ_into(u,getMoment(),result);
236 else if (m_materialMat->isMatIntegrated() == MatIntegration::Integrated)
237 result = this->_eval(u);
238 else if (m_materialMat->isMatIntegrated() == MatIntegration::Constant)
239 this->multiplyZ_into(u,getMoment(),result);
240 else if (m_materialMat->isMatIntegrated() == MatIntegration::Linear)
241 this->multiplyLinZ_into(u,getMoment(),result);
246template <
class T, enum MaterialOutput out>
247template <enum MaterialOutput _out>
248typename std::enable_if<_out==MaterialOutput::PStrainN || _out==MaterialOutput::PStrainM, void>::type
251 if (m_materialMat->isMatIntegrated() == MatIntegration::NotIntegrated)
252 this->integrateZ_into(u,getMoment(),result);
253 else if (m_materialMat->isMatIntegrated() == MatIntegration::Integrated)
254 result = this->_eval(u);
255 else if (m_materialMat->isMatIntegrated() == MatIntegration::Constant)
256 this->multiplyZ_into(u,getMoment(),result);
257 else if (m_materialMat->isMatIntegrated() == MatIntegration::Linear)
258 this->multiplyLinZ_into(u,getMoment(),result);
263template <
class T, enum MaterialOutput out>
264template <enum MaterialOutput _out>
265typename std::enable_if<_out==MaterialOutput::Stretch, void>::type
268 m_materialMat->stretch_into(m_pIndex,u,result);
271template <
class T, enum MaterialOutput out>
272template <enum MaterialOutput _out>
273typename std::enable_if<_out==MaterialOutput::StretchDir, void>::type
276 m_materialMat->stretchDir_into(m_pIndex,u,result);
279template <
class T, enum MaterialOutput out>
286 index_t numGauss = m_materialMat->options().askInt(
"NumGauss",4);
288 result.resize(this->targetDim(),u.cols());
298 m_materialMat->thickness_into(m_pIndex,u,Tmat);
301 for (
index_t k = 0; k != u.cols(); ++k)
308 gauss.
mapTo(-Thalf,Thalf,quNodes,quWeights);
310 z.col(k)=quNodes.transpose();
312 vals = this->_eval3D(u,z);
314 for (
index_t k = 0; k != u.cols(); ++k)
316 for (
index_t i=0; i!=this->targetDim(); ++i)
319 for (
index_t j = 0; j != numGauss; ++j)
320 res += w(j, k) * math::pow(z(j, k) * Tmat(0, k), moment) * vals(i, j * u.cols() + k) * Tmat(0, k);
332template <
class T, enum MaterialOutput out>
337 result.resize(this->targetDim(),u.cols());
341 m_materialMat->thickness_into(m_pIndex,u,Tmat);
345 for (
index_t k = 0; k != u.cols(); ++k)
349 z.col(k)<<Thalf,-Thalf;
352 T fac = (moment % 2 == 0) ? 0. : 1.;
355 for (
index_t k = 0; k != u.cols(); ++k)
359 result.col(k) = 1.0/(moment+fac+1) *
360 ( math::pow( z(0,k) * Tmat(0, k), moment + 1) * vals.col(0*u.cols() + k)
361 - math::pow( z(1,k) * Tmat(0, k), moment + 1) * vals.col(1*u.cols() + k) );
366template <
class T, enum MaterialOutput out>
371 result.resize(this->targetDim(),u.cols());
379 m_materialMat->thickness_into(m_pIndex,u,Tmat);
382 for (
index_t k = 0; k != u.cols(); ++k)
384 Thalf = Tmat(0, k) / 2.0;
385 fac = 2.0/(moment+1) * math::pow( Thalf , moment + 1);
386 result.col(k) = vals.col(k) * fac;
392template <
class T, enum MaterialOutput out>
397 return this->_eval3D(u,Z);
400template <
class T, enum MaterialOutput out>
403 return this->eval3D_impl<out>(u,Z);
406template <
class T, enum MaterialOutput out>
407template <enum MaterialOutput _out>
408typename std::enable_if< _out==MaterialOutput::MatrixA || _out==MaterialOutput::MatrixB
409 || _out==MaterialOutput::MatrixC || _out==MaterialOutput::MatrixD,
gsMatrix<T>>::type
412 return m_materialMat->eval3D_matrix(m_pIndex,u,Z,_out);
415template <
class T, enum MaterialOutput out>
416template <enum MaterialOutput _out>
417typename std::enable_if<_out==MaterialOutput::VectorN ||
421 return m_materialMat->eval3D_vector(m_pIndex,u,Z,_out);
424template <
class T, enum MaterialOutput out>
425template <enum MaterialOutput _out>
426typename std::enable_if<_out==MaterialOutput::CauchyVectorN ||
427 _out==MaterialOutput::CauchyVectorM, gsMatrix<T>>::type
430 return m_materialMat->eval3D_CauchyVector(m_pIndex,u,Z,_out);
434template <
class T, enum MaterialOutput out>
435template <enum MaterialOutput _out>
436typename std::enable_if<_out==MaterialOutput::PStress ||
437 _out==MaterialOutput::PStressN ||
438 _out==MaterialOutput::PStressM, gsMatrix<T>>::type
441 return m_materialMat->eval3D_pstress(m_pIndex,u,Z,_out);
Interface for the set of functions defined on a domain (the total number of functions in the set equa...
Definition gsFunctionSet.h:219
Class that represents the (tensor) Gauss-Legendre quadrature rule.
Definition gsGaussRule.h:28
This class defines the base class for material matrices.
Definition gsMaterialMatrixBase.h:33
This class serves as the integrator of material matrices, based on gsMaterialMatrixBase.
Definition gsMaterialMatrixIntegrate.h:103
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:410
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:170
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:367
void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Implementation of eval_into, see gsFunction.
Definition gsMaterialMatrixIntegrate.hpp:160
void integrateZ_into(const gsMatrix< T > &u, const index_t moment, gsMatrix< T > &result) const
Integrates through-thickness using Gauss integration.
Definition gsMaterialMatrixIntegrate.hpp:280
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:333
gsMatrix< T > _eval3D(const gsMatrix< T > &u, const gsMatrix< T > &Z) const
Integrateuates the base class in 3D.
Definition gsMaterialMatrixIntegrate.hpp:401
gsMatrix< T > _eval(const gsMatrix< T > &u) const
Integrateuates the base class in 3D, but on Z=0.
Definition gsMaterialMatrixIntegrate.hpp:393
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
virtual void mapTo(const gsVector< T > &lower, const gsVector< T > &upper, gsMatrix< T > &nodes, gsVector< T > &weights) const
Maps quadrature rule (i.e., points and weights) from the reference domain to an element.
Definition gsQuadRule.h:177
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
#define index_t
Definition gsConfig.h:32
#define GISMO_ERROR(message)
Definition gsDebug.h:118
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
Provides the Gauss-Legendre quadrature rule.
Provides an evaluator for material matrices for thin shells.
The G+Smo namespace, containing all definitions for the library.
void freeAll(It begin, It end)
Frees all pointers in the range [begin end)
Definition gsMemory.h:312