v0.15.0
Loading...
Searching...
No Matches
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)
 
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 ()
 
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.
 
virtual MoFEMErrorCode aSsemble (EntData &data)
 
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
 
- Public Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
TimeFun timeScalingFun
 assumes that time variable is set
 
FEFun feScalingFun
 assumes that time variable is set
 
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 85 of file BiLinearFormsIntegratorsImpl.hpp.

86 {
87 return integrateImpl(row_data, col_data, OpBase::getMeasure());
88 }
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 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 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
541 "Wrong number of base functions on rows %lu < %d",
542 row_data.getN().size2(), OpBase::nbRows);
543 }
544 if (col_data.getN().size2() < OpBase::nbCols) {
545 log_error();
546 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
547 "Wrong number of base functions on cols %lu < %d",
548 col_data.getN().size2(), OpBase::nbCols);
549 }
550 if (row_data.getN().size1() != OpBase::nbIntegrationPts) {
551 log_error();
552 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
553 "Wrong number of integration points on rows %lu != %d",
554 row_data.getN().size1(), OpBase::nbIntegrationPts);
555 }
556 if (col_data.getN().size1() != OpBase::nbIntegrationPts) {
557 log_error();
558 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
559 "Wrong number of integration points on cols %lu != %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};
#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 81 of file BiLinearFormsIntegratorsImpl.hpp.

81{ return 1; };

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