v0.9.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OpTools< EleOp >::OpMass Struct Reference

[Grad residual operator] More...

#include <users_modules/basic_finite_elements/lessons/src/BaseOps.hpp>

Inheritance diagram for OpTools< EleOp >::OpMass:
[legend]
Collaboration diagram for OpTools< EleOp >::OpMass:
[legend]

Public Member Functions

 OpMass (const std::string row_field_name, const std::string col_field_name, ScalarFun beta, boost::shared_ptr< std::vector< bool >> boundary_marker=nullptr)
 
- Public Member Functions inherited from OpTools< EleOp >::OpBase
 OpBase (const std::string row_field_name, const std::string col_field_name, const typename EleOp::OpType type, boost::shared_ptr< std::vector< bool >> boundary_marker=nullptr)
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntData &row_data, EntData &col_data)
 Do calculations for the left hand side. More...
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntData &row_data)
 Do calculations for the right hand side. More...
 

Protected Member Functions

MoFEMErrorCode iNtegrate (EntData &row_data, EntData &col_data)
 Integrate grad-grad operator. More...
 
- Protected Member Functions inherited from OpTools< EleOp >::OpBase
MoFEMErrorCode applyBoundaryMarker (EntData &data)
 
virtual MoFEMErrorCode aSsemble (EntData &row_data, EntData &col_data)
 Assemble local entity block matrix. More...
 
virtual MoFEMErrorCode iNtegrate (EntData &data)
 Class dedicated to integrate operator. More...
 
virtual MoFEMErrorCode aSsemble (EntData &data)
 Class dedicated to assemble operator to global system vector. More...
 

Protected Attributes

ScalarFun betaCoeff
 
- Protected Attributes inherited from OpTools< EleOp >::OpBase
boost::shared_ptr< std::vector< bool > > boundaryMarker
 
int nbRows
 number of dofs on rows More...
 
int nbCols
 number if dof on column More...
 
int nbIntegrationPts
 number of integration points More...
 
MatrixDouble locMat
 local entity block matrix More...
 
VectorDouble locF
 local entity vector More...
 

Detailed Description

template<typename EleOp>
struct OpTools< EleOp >::OpMass

[Grad residual operator]

[Mass operator]

Examples
lesson2_approximaton.cpp, lesson3_poisson.cpp, and lesson5_helmholtz.cpp.

Definition at line 239 of file BaseOps.hpp.

Constructor & Destructor Documentation

◆ OpMass()

template<typename EleOp >
OpTools< EleOp >::OpMass::OpMass ( const std::string  row_field_name,
const std::string  col_field_name,
ScalarFun  beta,
boost::shared_ptr< std::vector< bool >>  boundary_marker = nullptr 
)

Definition at line 241 of file BaseOps.hpp.

244  : OpBase(row_field_name, col_field_name, OpBase::OPROWCOL,
245  boundary_marker),
246  betaCoeff(beta) {}
ScalarFun betaCoeff
Definition: BaseOps.hpp:249
OpBase(const std::string row_field_name, const std::string col_field_name, const typename EleOp::OpType type, boost::shared_ptr< std::vector< bool >> boundary_marker=nullptr)
Definition: BaseOps.hpp:22

Member Function Documentation

◆ iNtegrate()

template<typename EleOp >
MoFEMErrorCode OpTools< EleOp >::OpMass::iNtegrate ( EntData row_data,
EntData col_data 
)
protectedvirtual

Integrate grad-grad operator.

Parameters
row_datarow data (consist base functions on row entity)
col_datacolumn data (consist base functions on column entity)
Returns
error code

Reimplemented from OpTools< EleOp >::OpBase.

Definition at line 251 of file BaseOps.hpp.

251  {
253  // get element volume
254  const double vol = OpBase::getMeasure();
255  // get integration weights
256  auto t_w = OpBase::getFTensor0IntegrationWeight();
257  // get base function gradient on rows
258  auto t_row_base = row_data.getFTensor0N();
259  // get coordinate at integration points
260  auto t_coords = OpBase::getFTensor1CoordsAtGaussPts();
261 
262  // loop over integration points
263  for (int gg = 0; gg != OpBase::nbIntegrationPts; gg++) {
264  const double beta =
265  vol * betaCoeff(t_coords(0), t_coords(1), t_coords(2));
266  // take into account Jacobean
267  const double alpha = t_w * beta;
268  // loop over rows base functions
269  for (int rr = 0; rr != OpBase::nbRows; rr++) {
270  // get column base functions gradient at gauss point gg
271  auto t_col_base = col_data.getFTensor0N(gg, 0);
272  // loop over columns
273  for (int cc = 0; cc != OpBase::nbCols; cc++) {
274  // calculate element of local matrix
275  OpBase::locMat(rr, cc) += alpha * (t_row_base * t_col_base);
276  ++t_col_base;
277  }
278  ++t_row_base;
279  }
280  ++t_coords;
281  ++t_w; // move to another integration weight
282  }
284  }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
int nbCols
number if dof on column
Definition: BaseOps.hpp:57
ScalarFun betaCoeff
Definition: BaseOps.hpp:249
MatrixDouble locMat
local entity block matrix
Definition: BaseOps.hpp:60
int nbIntegrationPts
number of integration points
Definition: BaseOps.hpp:58
int nbRows
number of dofs on rows
Definition: BaseOps.hpp:56
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.

Member Data Documentation

◆ betaCoeff

template<typename EleOp >
ScalarFun OpTools< EleOp >::OpMass::betaCoeff
protected

Definition at line 249 of file BaseOps.hpp.


The documentation for this struct was generated from the following file: