v0.14.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MoFEM::OpMassImpl< 1, 1, GAUSS, OpBase > Struct Template Reference

#include <src/finite_elements/BiLinearFormsIntegrators.hpp>

Inheritance diagram for MoFEM::OpMassImpl< 1, 1, GAUSS, OpBase >:
[legend]
Collaboration diagram for MoFEM::OpMassImpl< 1, 1, GAUSS, OpBase >:
[legend]

Public Member Functions

 OpMassImpl (const std::string row_field_name, const std::string col_field_name, ScalarFun beta=[](double, double, double) constexpr { return 1;}, boost::shared_ptr< Range > ents_ptr=nullptr)
 
- Public Member Functions inherited from MoFEM::OpBaseImpl< A, EleOp >
 OpBaseImpl (const std::string row_field_name, const std::string col_field_name, const OpType type, boost::shared_ptr< Range > ents_ptr=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 (EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Integrate grad-grad operator. More...
 
- Protected Member Functions inherited from MoFEM::OpBaseImpl< A, EleOp >
template<int DIM>
FTensor::Tensor1< FTensor::PackPtr< double *, DIM >, DIM > getNf ()
 
template<int DIM>
FTensor::Tensor2< FTensor::PackPtr< double *, DIM >, DIM, DIM > getLocMat (const int rr)
 
virtual MoFEMErrorCode aSsemble (EntData &row_data, EntData &col_data, const bool trans)
 
virtual MoFEMErrorCode iNtegrate (EntData &data)
 Class dedicated to integrate operator. More...
 
virtual MoFEMErrorCode aSsemble (EntData &data)
 
virtual size_t getNbOfBaseFunctions (EntitiesFieldData::EntData &data)
 Get number of base functions. More...
 

Protected Attributes

ScalarFun betaCoeff
 
- Protected Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
int nbRows
 number of dofs on rows More...
 
int nbCols
 number if dof on column More...
 
int nbIntegrationPts
 number of integration points More...
 
int nbRowBaseFunctions
 number or row base functions More...
 
int rowSide
 row side number More...
 
int colSide
 column side number More...
 
EntityType rowType
 row type More...
 
EntityType colType
 column type More...
 
bool assembleTranspose
 
bool onlyTranspose
 
MatrixDouble locMat
 local entity block matrix More...
 
MatrixDouble locMatTranspose
 local entity block matrix More...
 
VectorDouble locF
 local entity vector More...
 

Additional Inherited Members

- Public Types inherited from MoFEM::OpBaseImpl< A, EleOp >
using OpType = typename EleOp::OpType
 
using EntData = EntitiesFieldData::EntData
 
using MatSetValuesHook = boost::function< MoFEMErrorCode(ForcesAndSourcesCore::UserDataOperator *op_ptr, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, MatrixDouble &m)>
 
- Public Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
TimeFun timeScalingFun
 assumes that time variable is set More...
 
FEFun feScalingFun
 assumes that time variable is set More...
 
boost::shared_ptr< RangeentsPtr
 Entities on which element is run. More...
 
- Static Public Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
static MatSetValuesHook matSetValuesHook
 

Detailed Description

template<typename OpBase>
struct MoFEM::OpMassImpl< 1, 1, GAUSS, OpBase >

Definition at line 64 of file BiLinearFormsIntegrators.hpp.

Constructor & Destructor Documentation

◆ OpMassImpl()

template<typename OpBase >
MoFEM::OpMassImpl< 1, 1, GAUSS, OpBase >::OpMassImpl ( const std::string  row_field_name,
const std::string  col_field_name,
ScalarFun  beta = [](doubledoubledouble) constexpr { return 1; },
boost::shared_ptr< Range ents_ptr = nullptr 
)
inline

Definition at line 66 of file BiLinearFormsIntegrators.hpp.

68  { return 1; },
69  boost::shared_ptr<Range> ents_ptr = nullptr)
70  : OpBase(row_field_name, col_field_name, OpBase::OPROWCOL, ents_ptr),
71  betaCoeff(beta) {
72  if (row_field_name == col_field_name)
73  this->sYmm = true;
74  }

Member Function Documentation

◆ iNtegrate()

template<typename OpBase >
MoFEMErrorCode MoFEM::OpMassImpl< 1, 1, GAUSS, OpBase >::iNtegrate ( EntitiesFieldData::EntData row_data,
EntitiesFieldData::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 MoFEM::OpBaseImpl< A, EleOp >.

Reimplemented in MoFEM::OpMassImpl< 1, FIELD_DIM, GAUSS, OpBase >.

Definition at line 613 of file BiLinearFormsIntegrators.hpp.

615  {
617 
618 #ifndef NDEBUG
619  auto log_error = [&]() {
620  MOFEM_LOG("SELF", Sev::error) << "Row side " << OpBase::rowSide << " "
621  << CN::EntityTypeName(OpBase::rowType);
622  MOFEM_LOG("SELF", Sev::error) << "Col side " << OpBase::colSide << " "
623  << CN::EntityTypeName(OpBase::colType);
624  };
625 
626  if (row_data.getN().size2() < OpBase::nbRows) {
627  log_error();
628  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
629  "Wrong number of base functions on rows %d < %d",
630  row_data.getN().size2(), OpBase::nbRows);
631  }
632  if (col_data.getN().size2() < OpBase::nbCols) {
633  log_error();
634  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
635  "Wrong number of base functions on cols %d < %d",
636  col_data.getN().size2(), OpBase::nbCols);
637  }
638  if (row_data.getN().size1() != OpBase::nbIntegrationPts) {
639  log_error();
640  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
641  "Wrong number of integration points on rows %d != %d",
642  row_data.getN().size1(), OpBase::nbIntegrationPts);
643  }
644  if (col_data.getN().size1() != OpBase::nbIntegrationPts) {
645  log_error();
646  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
647  "Wrong number of integration points on cols %d != %d",
648  col_data.getN().size1(), OpBase::nbIntegrationPts);
649  }
650 #endif
651 
652  // get element volume
653  const double vol = OpBase::getMeasure();
654  // get integration weights
655  auto t_w = OpBase::getFTensor0IntegrationWeight();
656  // get base function gradient on rows
657  auto t_row_base = row_data.getFTensor0N();
658  // get coordinate at integration points
659  auto t_coords = OpBase::getFTensor1CoordsAtGaussPts();
660  // loop over integration points
661  for (int gg = 0; gg != OpBase::nbIntegrationPts; gg++) {
662  const double beta = vol * betaCoeff(t_coords(0), t_coords(1), t_coords(2));
663  // take into account Jacobian
664  const double alpha = t_w * beta;
665  // loop over rows base functions
666  auto a_mat_ptr = &*OpBase::locMat.data().begin();
667  int rr = 0;
668  for (; rr != OpBase::nbRows; rr++) {
669  // get column base functions gradient at gauss point gg
670  auto t_col_base = col_data.getFTensor0N(gg, 0);
671  // loop over columns
672  for (int cc = 0; cc != OpBase::nbCols; cc++) {
673  // calculate element of local matrix
674  *a_mat_ptr += alpha * (t_row_base * t_col_base);
675  ++t_col_base;
676  ++a_mat_ptr;
677  }
678  ++t_row_base;
679  }
680  for (; rr < OpBase::nbRowBaseFunctions; ++rr)
681  ++t_row_base;
682  ++t_coords;
683  ++t_w; // move to another integration weight
684  }
686 };

Member Data Documentation

◆ betaCoeff

template<typename OpBase >
ScalarFun MoFEM::OpMassImpl< 1, 1, GAUSS, OpBase >::betaCoeff
protected

Definition at line 77 of file BiLinearFormsIntegrators.hpp.


The documentation for this struct was generated from the following file:
MoFEM::OpBaseImpl::nbIntegrationPts
int nbIntegrationPts
number of integration points
Definition: FormsIntegrators.hpp:228
MoFEM::OpBaseImpl::locMat
MatrixDouble locMat
local entity block matrix
Definition: FormsIntegrators.hpp:239
MoFEM::OpMassImpl< 1, 1, GAUSS, OpBase >::betaCoeff
ScalarFun betaCoeff
Definition: BiLinearFormsIntegrators.hpp:77
OpBase
OpBaseImpl< PETSC, EdgeEleOp > OpBase
Definition: radiation.cpp:29
MoFEM::OpBaseImpl::colSide
int colSide
column side number
Definition: FormsIntegrators.hpp:232
MoFEM::OpBaseImpl::nbRowBaseFunctions
int nbRowBaseFunctions
number or row base functions
Definition: FormsIntegrators.hpp:229
MoFEM::OpBaseImpl::rowSide
int rowSide
row side number
Definition: FormsIntegrators.hpp:231
MoFEM::OpBaseImpl::nbCols
int nbCols
number if dof on column
Definition: FormsIntegrators.hpp:227
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
MoFEM::OpBaseImpl::nbRows
int nbRows
number of dofs on rows
Definition: FormsIntegrators.hpp:226
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEM::OpBaseImpl::rowType
EntityType rowType
row type
Definition: FormsIntegrators.hpp:233
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
MoFEM::OpBaseImpl::colType
EntityType colType
column type
Definition: FormsIntegrators.hpp:234