v0.15.5
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>
FTensor::Tensor1< FTensor::PackPtr< double *, DIM >, DIM > getNf ()
 Get local vector tensor for assembly.
 
template<int DIM>
FTensor::Tensor2< FTensor::PackPtr< double *, DIM >, DIM, 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 &data)
 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< RangeentsPtr
 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 = [](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 
)
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 552 of file BiLinearFormsIntegratorsImpl.hpp.

554 {
556
557#ifndef NDEBUG
558 auto log_error = [&]() {
559 MOFEM_LOG("SELF", Sev::error) << "Row side " << OpBase::rowSide << " "
560 << CN::EntityTypeName(OpBase::rowType);
561 MOFEM_LOG("SELF", Sev::error) << "Col side " << OpBase::colSide << " "
562 << CN::EntityTypeName(OpBase::colType);
563 };
564
565 if (row_data.getN().size2() < OpBase::nbRows) {
566 log_error();
567 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
568 "Wrong number of base functions on rows %lu < %d",
569 row_data.getN().size2(), OpBase::nbRows);
570 }
571 if (col_data.getN().size2() < OpBase::nbCols) {
572 log_error();
573 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
574 "Wrong number of base functions on cols %lu < %d",
575 col_data.getN().size2(), OpBase::nbCols);
576 }
577 if (row_data.getN().size1() != OpBase::nbIntegrationPts) {
578 log_error();
579 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
580 "Wrong number of integration points on rows %lu != %d",
581 row_data.getN().size1(), OpBase::nbIntegrationPts);
582 }
583 if (col_data.getN().size1() != OpBase::nbIntegrationPts) {
584 log_error();
585 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
586 "Wrong number of integration points on cols %lu != %d",
587 col_data.getN().size1(), OpBase::nbIntegrationPts);
588 }
589#endif
590
591 // get integration weights
592 auto t_w = OpBase::getFTensor0IntegrationWeight();
593 // get base function gradient on rows
594 auto t_row_base = row_data.getFTensor0N();
595 // get coordinate at integration points
596 auto t_coords = OpBase::getFTensor1CoordsAtGaussPts();
597 // loop over integration points
598 for (int gg = 0; gg != OpBase::nbIntegrationPts; gg++) {
599 const double beta = betaCoeff(t_coords(0), t_coords(1), t_coords(2));
600 // take into account Jacobian
601 const double alpha = t_w * beta;
602 // loop over rows base functions
603 auto a_mat_ptr = &*OpBase::locMat.data().begin();
604 int rr = 0;
605 for (; rr != OpBase::nbRows; rr++) {
606 // get column base functions gradient at gauss point gg
607 auto t_col_base = col_data.getFTensor0N(gg, 0);
608 // loop over columns
609 for (int cc = 0; cc != OpBase::nbCols; cc++) {
610 // calculate element of local matrix
611 *a_mat_ptr += alpha * (t_row_base * t_col_base);
612 ++t_col_base;
613 ++a_mat_ptr;
614 }
615 ++t_row_base;
616 }
617 for (; rr < OpBase::nbRowBaseFunctions; ++rr)
618 ++t_row_base;
619 ++t_coords;
620 ++t_w; // move to another integration weight
621 }
622
623 OpBase::locMat *= vol;
624
626};
#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: