v0.16.3
Loading...
Searching...
No Matches
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)
 
- 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)
 Constructor for base operator implementation.
 
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.
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntData &row_data)
 Do calculations for the right hand side.
 

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)
 Integrate grad-grad operator.
 
- Protected Member Functions inherited from MoFEM::OpBaseImpl< A, EleOp >
template<int DIM>
auto getNf ()
 Get local vector tensor for assembly.
 
template<int ROW_DIM, int COL_DIM = ROW_DIM>
FTensor::Tensor2< FTensor::PackPtr< double *, COL_DIM >, ROW_DIM, COL_DIM > getLocMat (const int rr)
 Get local matrix tensor for assembly.
 
virtual MoFEMErrorCode aSsemble (EntData &row_data, EntData &col_data, const bool trans)
 Assemble local matrix into global matrix.
 
virtual MoFEMErrorCode iNtegrate (EntData &)
 Class dedicated to integrate operator.
 
virtual MoFEMErrorCode aSsemble (EntData &data)
 Assemble local vector into global vector.
 
virtual size_t getNbOfBaseFunctions (EntitiesFieldData::EntData &data)
 Get number of base functions.
 

Protected Attributes

ScalarFun betaCoeff = [](double, double, double) constexpr { return 1; }
 
- Protected Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
int nbRows
 number of dofs on rows
 
int nbCols
 number if dof on column
 
int nbIntegrationPts
 number of integration points
 
int nbRowBaseFunctions
 number or row base functions
 
int rowSide
 row side number
 
int colSide
 column side number
 
EntityType rowType
 row type
 
EntityType colType
 column type
 
bool assembleTranspose
 
bool onlyTranspose
 
MatrixDouble locMat
 local entity block matrix
 
MatrixDouble locMatTranspose
 local entity block matrix
 
VectorDouble locF
 local entity vector
 

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
 
FEFun feScalingFun
 set by fe entity handle
 
boost::shared_ptr< Range > entsPtr
 Entities on which element is run.
 
- 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 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 = [](double, double, double) 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 &  ,
EntitiesFieldData::EntData &   
)
inlineprotectedvirtual

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 87 of file BiLinearFormsIntegratorsImpl.hpp.

88 {
89 return integrateImpl(row_data, col_data, OpBase::getMeasure());
90 }
MoFEMErrorCode integrateImpl(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data, double vol)

◆ 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 600 of file BiLinearFormsIntegratorsImpl.hpp.

602 {
604
605#ifndef NDEBUG
606 auto log_error = [&]() {
607 MOFEM_LOG("SELF", Sev::error) << "Row side " << OpBase::rowSide << " "
608 << CN::EntityTypeName(OpBase::rowType);
609 MOFEM_LOG("SELF", Sev::error) << "Col side " << OpBase::colSide << " "
610 << CN::EntityTypeName(OpBase::colType);
611 };
612
613 if (row_data.getN().size2() < OpBase::nbRows) {
614 log_error();
615 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
616 "Wrong number of base functions on rows %zu < %d",
617 row_data.getN().size2(), OpBase::nbRows);
618 }
619 if (col_data.getN().size2() < OpBase::nbCols) {
620 log_error();
621 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
622 "Wrong number of base functions on cols %zu < %d",
623 col_data.getN().size2(), OpBase::nbCols);
624 }
625 if (row_data.getN().size1() != OpBase::nbIntegrationPts) {
626 log_error();
627 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
628 "Wrong number of integration points on rows %zu != %d",
629 row_data.getN().size1(), OpBase::nbIntegrationPts);
630 }
631 if (col_data.getN().size1() != OpBase::nbIntegrationPts) {
632 log_error();
633 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
634 "Wrong number of integration points on cols %zu != %d",
635 col_data.getN().size1(), OpBase::nbIntegrationPts);
636 }
637#endif
638
639 // get integration weights
640 auto t_w = OpBase::getFTensor0IntegrationWeight();
641 // get base function gradient on rows
642 auto t_row_base = row_data.getFTensor0N();
643 // get coordinate at integration points
644 auto t_coords = OpBase::getFTensor1CoordsAtGaussPts();
645 // loop over integration points
646 for (int gg = 0; gg != OpBase::nbIntegrationPts; gg++) {
647 const double beta = betaCoeff(t_coords(0), t_coords(1), t_coords(2));
648 // take into account Jacobian
649 const double alpha = t_w * beta;
650 // loop over rows base functions
651 auto a_mat_ptr = &*OpBase::locMat.data().begin();
652 int rr = 0;
653 for (; rr != OpBase::nbRows; rr++) {
654 // get column base functions gradient at gauss point gg
655 auto t_col_base = col_data.getFTensor0N(gg, 0);
656 // loop over columns
657 for (int cc = 0; cc != OpBase::nbCols; cc++) {
658 // calculate element of local matrix
659 *a_mat_ptr += alpha * (t_row_base * t_col_base);
660 ++t_col_base;
661 ++a_mat_ptr;
662 }
663 ++t_row_base;
664 }
665 for (; rr < OpBase::nbRowBaseFunctions; ++rr)
666 ++t_row_base;
667 ++t_coords;
668 ++t_w; // move to another integration weight
669 }
670
671 OpBase::locMat *= vol;
672
674};
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MOFEM_LOG(channel, severity)
Log.
int rowSide
row side number
int colSide
column side number
int nbRows
number of dofs on rows
EntityType colType
column type
int nbIntegrationPts
number of integration points
MatrixDouble locMat
local entity block matrix
int nbCols
number if dof on column
int nbRowBaseFunctions
number or row base functions
EntityType rowType
row type

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 83 of file BiLinearFormsIntegratorsImpl.hpp.

83{ return 1; };

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