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/BiLinearFormsIntegratorsImpl.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, boost::shared_ptr< MatrixDouble > cache_mat=nullptr)
 

Protected Member Functions

MoFEMErrorCode integrateImpl (EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data, double vol)
 
MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 

Protected Attributes

ScalarFun betaCoeff = [](double, double, double) constexpr { return 1; }
 

Detailed Description

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

Definition at line 67 of file BiLinearFormsIntegratorsImpl.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,
boost::shared_ptr< MatrixDouble cache_mat = nullptr 
)
inline

Definition at line 69 of file BiLinearFormsIntegratorsImpl.hpp.

71  { return 1; },
72  boost::shared_ptr<Range> ents_ptr = nullptr,
73  boost::shared_ptr<MatrixDouble> cache_mat = nullptr)
74  : OpBase(row_field_name, col_field_name, OpBase::OPROWCOL, ents_ptr),
75  betaCoeff(beta) {
76  if (row_field_name == col_field_name)
77  this->sYmm = true;
78  }

Member Function Documentation

◆ iNtegrate()

template<typename OpBase >
MoFEMErrorCode MoFEM::OpMassImpl< 1, 1, GAUSS, OpBase >::iNtegrate ( EntitiesFieldData::EntData row_data,
EntitiesFieldData::EntData col_data 
)
inlineprotected

Definition at line 85 of file BiLinearFormsIntegratorsImpl.hpp.

86  {
87  return integrateImpl(row_data, col_data, OpBase::getMeasure());
88  }

◆ integrateImpl()

template<typename OpBase >
MoFEMErrorCode MoFEM::OpMassImpl< 1, 1, GAUSS, OpBase >::integrateImpl ( EntitiesFieldData::EntData row_data,
EntitiesFieldData::EntData col_data,
double  vol 
)
protected

Definition at line 525 of file BiLinearFormsIntegratorsImpl.hpp.

527  {
529 
530 #ifndef NDEBUG
531  auto log_error = [&]() {
532  MOFEM_LOG("SELF", Sev::error) << "Row side " << OpBase::rowSide << " "
533  << CN::EntityTypeName(OpBase::rowType);
534  MOFEM_LOG("SELF", Sev::error) << "Col side " << OpBase::colSide << " "
535  << CN::EntityTypeName(OpBase::colType);
536  };
537 
538  if (row_data.getN().size2() < OpBase::nbRows) {
539  log_error();
540  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
541  "Wrong number of base functions on rows %d < %d",
542  row_data.getN().size2(), OpBase::nbRows);
543  }
544  if (col_data.getN().size2() < OpBase::nbCols) {
545  log_error();
546  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
547  "Wrong number of base functions on cols %d < %d",
548  col_data.getN().size2(), OpBase::nbCols);
549  }
550  if (row_data.getN().size1() != OpBase::nbIntegrationPts) {
551  log_error();
552  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
553  "Wrong number of integration points on rows %d != %d",
554  row_data.getN().size1(), OpBase::nbIntegrationPts);
555  }
556  if (col_data.getN().size1() != OpBase::nbIntegrationPts) {
557  log_error();
558  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
559  "Wrong number of integration points on cols %d != %d",
560  col_data.getN().size1(), OpBase::nbIntegrationPts);
561  }
562 #endif
563 
564  // get integration weights
565  auto t_w = OpBase::getFTensor0IntegrationWeight();
566  // get base function gradient on rows
567  auto t_row_base = row_data.getFTensor0N();
568  // get coordinate at integration points
569  auto t_coords = OpBase::getFTensor1CoordsAtGaussPts();
570  // loop over integration points
571  for (int gg = 0; gg != OpBase::nbIntegrationPts; gg++) {
572  const double beta = betaCoeff(t_coords(0), t_coords(1), t_coords(2));
573  // take into account Jacobian
574  const double alpha = t_w * beta;
575  // loop over rows base functions
576  auto a_mat_ptr = &*OpBase::locMat.data().begin();
577  int rr = 0;
578  for (; rr != OpBase::nbRows; rr++) {
579  // get column base functions gradient at gauss point gg
580  auto t_col_base = col_data.getFTensor0N(gg, 0);
581  // loop over columns
582  for (int cc = 0; cc != OpBase::nbCols; cc++) {
583  // calculate element of local matrix
584  *a_mat_ptr += alpha * (t_row_base * t_col_base);
585  ++t_col_base;
586  ++a_mat_ptr;
587  }
588  ++t_row_base;
589  }
590  for (; rr < OpBase::nbRowBaseFunctions; ++rr)
591  ++t_row_base;
592  ++t_coords;
593  ++t_w; // move to another integration weight
594  }
595 
596  OpBase::locMat *= vol;
597 
599 };

Member Data Documentation

◆ betaCoeff

template<typename OpBase >
ScalarFun MoFEM::OpMassImpl< 1, 1, GAUSS, OpBase >::betaCoeff = [](double, double, double) constexpr { return 1; }
protected

Definition at line 81 of file BiLinearFormsIntegratorsImpl.hpp.


The documentation for this struct was generated from the following file:
MoFEM::OpBaseImpl::nbIntegrationPts
int nbIntegrationPts
number of integration points
Definition: FormsIntegrators.hpp:238
MoFEM::OpBaseImpl::locMat
MatrixDouble locMat
local entity block matrix
Definition: FormsIntegrators.hpp:249
MoFEM::OpMassImpl< 1, 1, GAUSS, OpBase >::betaCoeff
ScalarFun betaCoeff
Definition: BiLinearFormsIntegratorsImpl.hpp:81
OpBase
OpBaseImpl< PETSC, EdgeEleOp > OpBase
Definition: radiation.cpp:29
MoFEM::OpMassImpl< 1, 1, GAUSS, OpBase >::integrateImpl
MoFEMErrorCode integrateImpl(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data, double vol)
Definition: BiLinearFormsIntegratorsImpl.hpp:525
MoFEM::OpBaseImpl::colSide
int colSide
column side number
Definition: FormsIntegrators.hpp:242
MoFEM::OpBaseImpl::nbRowBaseFunctions
int nbRowBaseFunctions
number or row base functions
Definition: FormsIntegrators.hpp:239
MoFEM::OpBaseImpl::rowSide
int rowSide
row side number
Definition: FormsIntegrators.hpp:241
MoFEM::OpBaseImpl::nbCols
int nbCols
number if dof on column
Definition: FormsIntegrators.hpp:237
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:236
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEM::OpBaseImpl::rowType
EntityType rowType
row type
Definition: FormsIntegrators.hpp:243
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
MoFEM::OpBaseImpl::colType
EntityType colType
column type
Definition: FormsIntegrators.hpp:244