v0.9.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OpTools< EleOp >::OpSource< DIM > Struct Template Reference

[Source operator] More...

#include <users_modules/basic_finite_elements/lessons/src/BaseOps.hpp>

Inheritance diagram for OpTools< EleOp >::OpSource< DIM >:
[legend]
Collaboration diagram for OpTools< EleOp >::OpSource< DIM >:
[legend]

Public Member Functions

 OpSource (const std::string field_name, ScalarFun source_fun, boost::shared_ptr< std::vector< bool >> boundary_marker=nullptr)
 
- Public Member Functions inherited from OpTools< EleOp >::OpBase
 OpBase (const std::string row_field_name, const std::string col_field_name, const typename EleOp::OpType type, boost::shared_ptr< std::vector< bool >> boundary_marker=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 (EntData &row_data)
 Class dedicated to integrate operator. More...
 
- Protected Member Functions inherited from OpTools< EleOp >::OpBase
MoFEMErrorCode applyBoundaryMarker (EntData &data)
 
virtual MoFEMErrorCode iNtegrate (EntData &row_data, EntData &col_data)
 Integrate grad-grad operator. More...
 
virtual MoFEMErrorCode aSsemble (EntData &row_data, EntData &col_data)
 Assemble local entity block matrix. More...
 
virtual MoFEMErrorCode aSsemble (EntData &data)
 Class dedicated to assemble operator to global system vector. More...
 

Protected Attributes

ScalarFun sourceFun
 
FTensor::Index< 'i', DIM > i
 summit Index More...
 
- Protected Attributes inherited from OpTools< EleOp >::OpBase
boost::shared_ptr< std::vector< bool > > boundaryMarker
 
int nbRows
 number of dofs on rows More...
 
int nbCols
 number if dof on column More...
 
int nbIntegrationPts
 number of integration points More...
 
MatrixDouble locMat
 local entity block matrix More...
 
VectorDouble locF
 local entity vector More...
 

Detailed Description

template<typename EleOp>
template<int DIM>
struct OpTools< EleOp >::OpSource< DIM >

[Source operator]

Examples
lesson2_approximaton.cpp, lesson3_poisson.cpp, and lesson5_helmholtz.cpp.

Definition at line 97 of file BaseOps.hpp.

Constructor & Destructor Documentation

◆ OpSource()

template<typename EleOp >
template<int DIM>
OpTools< EleOp >::OpSource< DIM >::OpSource ( const std::string  field_name,
ScalarFun  source_fun,
boost::shared_ptr< std::vector< bool >>  boundary_marker = nullptr 
)

Definition at line 99 of file BaseOps.hpp.

101  : OpBase(field_name, field_name, OpBase::OPROW, boundary_marker),
102  sourceFun(source_fun) {}
OpBase(const std::string row_field_name, const std::string col_field_name, const typename EleOp::OpType type, boost::shared_ptr< std::vector< bool >> boundary_marker=nullptr)
Definition: BaseOps.hpp:22
ScalarFun sourceFun
Definition: BaseOps.hpp:105

Member Function Documentation

◆ iNtegrate()

template<typename EleOp >
template<int DIM>
MoFEMErrorCode OpTools< EleOp >::OpSource< DIM >::iNtegrate ( EntData data)
protectedvirtual

Class dedicated to integrate operator.

Parameters
dataentity data on element row
Returns
error code

Reimplemented from OpTools< EleOp >::OpBase.

Definition at line 108 of file BaseOps.hpp.

108  {
110  // get element volume
111  const double vol = OpBase::getMeasure();
112  // get integration weights
113  auto t_w = OpBase::getFTensor0IntegrationWeight();
114  // get base function gradient on rows
115  auto t_row_base = row_data.getFTensor0N();
116  // get coordinate at integration points
117  auto t_coords = OpBase::getFTensor1CoordsAtGaussPts();
118  // loop over integration points
119  for (int gg = 0; gg != OpBase::nbIntegrationPts; gg++) {
120  // take into account Jacobean
121  const double alpha = t_w * vol;
122  // loop over rows base functions
123  for (int rr = 0; rr != OpBase::nbRows; ++rr) {
124  OpBase::locF[rr] += alpha * t_row_base *
125  sourceFun(t_coords(0), t_coords(1), t_coords(2));
126  ++t_row_base;
127  }
128  ++t_coords;
129  ++t_w; // move to another integration weight
130  }
132  }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
VectorDouble locF
local entity vector
Definition: BaseOps.hpp:61
ScalarFun sourceFun
Definition: BaseOps.hpp:105
int nbIntegrationPts
number of integration points
Definition: BaseOps.hpp:58
int nbRows
number of dofs on rows
Definition: BaseOps.hpp:56
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

Member Data Documentation

◆ i

template<typename EleOp >
template<int DIM>
FTensor::Index<'i', DIM> OpTools< EleOp >::OpSource< DIM >::i
protected

summit Index

Definition at line 106 of file BaseOps.hpp.

◆ sourceFun

template<typename EleOp >
template<int DIM>
ScalarFun OpTools< EleOp >::OpSource< DIM >::sourceFun
protected

Definition at line 105 of file BaseOps.hpp.


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