5 #ifndef __UNITTRIANGLEINTEGRATORSHELLFE_H 6 #define __UNITTRIANGLEINTEGRATORSHELLFE_H 11 template <
typename ConfiguratorType,
typename Imp>
34 for (
int q = 0; q < numQuadPoints; ++q ) {
35 a += this->
asImp().evaluateIntegrand ( El, q ) * bfs.getWeight ( q );
44 throw std::invalid_argument(
aol::strprintf (
"Called the interface function. In File %s at line %d.", __FILE__, __LINE__ ).c_str() );
45 return this->
asImp().evaluateIntegrand ( El, QuadPoint );
50 inline Imp&
asImp() {
return static_cast<Imp&
> ( *this ); }
51 inline const Imp&
asImp()
const {
return static_cast<const Imp&
> ( *this ); }
60 template <
typename ConfiguratorType,
typename Imp>
84 for (
int q = 0; q < numQuadPoints; ++q )
85 nl_cache[q] = this->
asImp().getNonlinearity ( El, q );
89 for (
int dof = 0; dof < numLocalDofs; ++dof ) {
92 for (
int q = 0; q < numQuadPoints; ++q )
103 throw std::invalid_argument(
aol::strprintf (
"Called the interface function. In File %s at line %d.", __FILE__, __LINE__ ).c_str() );
104 return this->
asImp().getNonlinearity ( El, QuadPoint );
109 inline Imp&
asImp() {
return static_cast<Imp&
> ( *this ); }
110 inline const Imp&
asImp()
const {
return static_cast<const Imp&
> ( *this ); }
120 template <
typename ConfiguratorType,
typename Imp >
130 :
_config ( conf ), _factor(factor), _tripletListAssembled(false)
136 LocalMatrixType localMatrix;
140 this->
asImp().prepareLocalMatrix ( El, localMatrix );
143 for (
int i = 0; i < numLocalDofs; ++i )
146 for (
int i = 0; i < numLocalDofs; ++i ) {
147 int glob_i = globalDofs[ i ];
148 for (
int j = 0; j < numLocalDofs; ++j ) {
149 int glob_j = globalDofs[ j ];
150 tripletList.push_back( TripletType( glob_i, glob_j, Factor * localMatrix(i,j) ) );
158 if(!_tripletListAssembled) {
159 assembleTripletList(_tripletList, _factor);
160 _tripletListAssembled =
true;
164 template <
typename SparseMatrixType>
166 assembleTripletListCached();
167 Dest.setFromTriplets( _tripletList.cbegin(), _tripletList.cend() );
170 template <
typename SparseMatrixType>
172 assembleTripletListCached();
174 std::vector<TripletType> tripletListMasked;
177 for(
unsigned iter=0; iter < _tripletList.size(); ++iter ){
178 if( (boundaryMask[_tripletList[iter].row()]) || (boundaryMask[_tripletList[iter].col()]) ){
181 tripletListMasked.push_back( _tripletList[iter] );
186 if ( boundaryMask[i] )
187 tripletListMasked.push_back( TripletType( i, i, 1.0 ) );
190 Dest.setFromTriplets( tripletListMasked.begin(), tripletListMasked.end() );
195 inline Imp&
asImp() {
return static_cast<Imp&
> ( *this ); }
196 inline const Imp&
asImp()
const {
return static_cast<const Imp&
> ( *this ); }
211 template <
typename ConfiguratorType,
typename Imp >
224 _config ( Config ) {}
229 Matrix22 &Matrix )
const {
230 this->
asImp().getCoeffMatrix ( El, QuadPoint, Matrix );
235 LocalMatrixType &LocalMatrix )
const {
240 for (
int i = 0; i < numDofs; ++i )
241 for (
int j = 0; j < numDofs; ++j )
242 LocalMatrix(i,j) = 0.;
250 for (
int q = 0; q < numQuadPoints; ++q ) {
251 getCoeffMatrix ( El, q, mat );
252 for (
int i = 0; i < numDofs; ++i ) {
254 matgrad1 = mat * grad_i;
255 for (
int j = 0; j < numDofs; ++j ) {
257 LocalMatrix(j,i) += matgrad1.dot( grad_j ) * bfs.
getWeight ( q );
261 for (
int i = 0; i < numDofs; ++i )
262 for (
int j = 0; j < numDofs; ++j )
263 LocalMatrix(i,j) *= 0.5;
267 inline Imp &
asImp() {
return static_cast<Imp&
> ( *this ); }
268 inline const Imp &
asImp()
const {
return static_cast<const Imp&
> ( *this ); }
DataTypeContainer::MaskType MaskType
Provides an easy interface to Finite Element operators of the form , where is an ASYMMETRIC coeffici...
DataTypeContainer::VectorType VectorType
ConfiguratorType::Matrix22 Matrix22
ConfiguratorType::MaskType MaskType
void prepareLocalMatrix(const typename ConfiguratorType::ElementType &El, LocalMatrixType &LocalMatrix) const
Computes the numerical quadrature of the bilinear form and saves the values locally.
const TriangleType & getTriang(const int num) const
ConfiguratorType::RealType RealType
void assemble(SparseMatrixType &Dest) const
const ConfiguratorType & _config
Integrator for , of some scalar valued function .
ConfiguratorType::RealType RealType
RealType evaluate(int BaseFuncNum, const DomVecType &RefCoord) const
Evaluates a base function at.
void assembleAdd(RealType &Dest) const
int numQuadPoints() const
Returns the number of quadrature points.
const ConfiguratorType & _config
Eigen::Matrix< RealType, maxNumLocalDofs, maxNumLocalDofs > LocalMatrixType
int maxNumQuadPoints() const
Returns the maximum number of quadrature points per element.
DataTypeContainer::DomVecType DomVecType
DataTypeContainer::RealType RealType
ConfiguratorType::ElementType ElementType
RealType getWeight(int QuadPoint) const
Returns the quadrature weight at QuadPointa quadrature point.
const Imp & asImp() const
void evaluateGradient(int BaseFuncNum, const DomVecType &, DomVecType &Gradient) const
Evaluates the gradient of a base function at RefCoord.
int getNumTriangs() const
UnitTriangleFENonlinIntegrationScalarIntegratorShellFE(const ConfiguratorType &Config)
DataTypeContainer::Matrix22 Matrix22
void assembleDirichlet(SparseMatrixType &Dest, const MaskType &boundaryMask) const
void assembleTripletList(std::vector< TripletType > &tripletList, const RealType Factor) const
RealType getNonlinearity(const typename ConfiguratorType::ElementType &El, int QuadPoint) const
interface function, has to be provided in derived classes.
int getNumLocalDofs(const ElementType &) const
Get The number of local degrees of freedom on an element.
ConfiguratorType::LocalMatrixType LocalMatrixType
ConfiguratorType::ElementType ElementType
virtual ~UnitTriangleFENonlinIntegrationScalarIntegratorShellFE()
General interface for matrix valued integrators.
void assembleTripletListCached() const
ConfiguratorType::TripletType TripletType
virtual ~UnitTriangleFENonlinOpIntegratorShellFE()
string strprintf(const char *format,...)
Give back formatted string, analogously to sprintf, but save the long way 'round with char arrays...
int localToGlobal(const ElementType &T, int localIndex) const
Returns global index of the dof with number localIndex.
const InitType & getInitializer() const
Returns the mesh.
ConfiguratorType::SparseMatrixType SparseMatrixType
int getNumGlobalDofs() const
Returns the number of global degrees of freedom.
ConfiguratorType::RealType RealType
ConfiguratorType::DomVecType DomVecType
ConfiguratorType::ElementType ElementType
ConfiguratorType::RealType RealType
ConfiguratorType::LocalMatrixType LocalMatrixType
void assembleAdd(VectorType &Dest) const
void getCoeffMatrix(const typename ConfiguratorType::ElementType &El, int QuadPoint, Matrix22 &Matrix) const
This function has to be provided in the implementation (derived class) of the interface.
bool _tripletListAssembled
static const int maxNumLocalDofs
Configurator for Finite Elements.
const Imp & asImp() const
Integrator to compute , where is the argument of the operator.
Triangle which has a tangent space at each node.
RealType evaluateIntegrand(const typename ConfiguratorType::ElementType &El, int QuadPoint) const
interface function, has to be provided in derived classes.
const BaseFuncSetType & getBaseFunctionSet(const ElementType &) const
Returns the base funcitons set for an element.
ConfiguratorType::VectorType VectorType
const ConfiguratorType & _config
UnitTriangleFELinWeightedStiffIntegrator(const ConfiguratorType &Config)
UnitTriangleFENonlinOpIntegratorShellFE(const ConfiguratorType &Conf)
DataTypeContainer::TripletType TripletType
const Imp & asImp() const
const ConfiguratorType & _config
const Imp & asImp() const
std::vector< TripletType > _tripletList
MatrixValuedIntegratorBase(const ConfiguratorType &conf, const RealType factor=1.0)