v0.14.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MoFEM::OpSourceImpl< 1, 1, GAUSS, SourceFunctionSpecialization::S< OpBase > > Struct Template Reference

Integrate source. More...

#include <src/finite_elements/LinearFormsIntegratorsImpl.hpp>

Inheritance diagram for MoFEM::OpSourceImpl< 1, 1, GAUSS, SourceFunctionSpecialization::S< OpBase > >:
[legend]
Collaboration diagram for MoFEM::OpSourceImpl< 1, 1, GAUSS, SourceFunctionSpecialization::S< OpBase > >:
[legend]

Public Member Functions

 OpSourceImpl (const std::string field_name, ScalarFun source_fun, boost::shared_ptr< Range > ents_ptr=nullptr)
 Construct a new Op Source Impl object. More...
 
 OpSourceImpl (const std::string field_name, TimeFun time_fun, ScalarFun source_fun, boost::shared_ptr< Range > ents_ptr=nullptr)
 Construct a new Op Source Impl object. More...
 

Protected Member Functions

MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &data)
 

Protected Attributes

ScalarFun sourceFun
 

Detailed Description

template<typename OpBase>
struct MoFEM::OpSourceImpl< 1, 1, GAUSS, SourceFunctionSpecialization::S< OpBase > >

Integrate source.

Template Parameters
OpBase

Definition at line 31 of file LinearFormsIntegratorsImpl.hpp.

Constructor & Destructor Documentation

◆ OpSourceImpl() [1/2]

template<typename OpBase >
MoFEM::OpSourceImpl< 1, 1, GAUSS, SourceFunctionSpecialization::S< OpBase > >::OpSourceImpl ( const std::string  field_name,
ScalarFun  source_fun,
boost::shared_ptr< Range ents_ptr = nullptr 
)
inline

Construct a new Op Source Impl object.

Parameters
field_name
source_fun
ents_ptr

Definition at line 41 of file LinearFormsIntegratorsImpl.hpp.

43  : OpBase(field_name, field_name, OpBase::OPROW, ents_ptr),
44  sourceFun(source_fun) {}

◆ OpSourceImpl() [2/2]

template<typename OpBase >
MoFEM::OpSourceImpl< 1, 1, GAUSS, SourceFunctionSpecialization::S< OpBase > >::OpSourceImpl ( const std::string  field_name,
TimeFun  time_fun,
ScalarFun  source_fun,
boost::shared_ptr< Range ents_ptr = nullptr 
)
inline

Construct a new Op Source Impl object.

Parameters
field_name
time_fun
source_fun
ents_ptr

Definition at line 54 of file LinearFormsIntegratorsImpl.hpp.

57  : OpBase(field_name, field_name, OpBase::OPROW, time_fun, ents_ptr),
58  sourceFun(source_fun) {}

Member Function Documentation

◆ iNtegrate()

template<typename OpBase >
MoFEMErrorCode MoFEM::OpSourceImpl< 1, 1, GAUSS, SourceFunctionSpecialization::S< OpBase > >::iNtegrate ( EntitiesFieldData::EntData data)
protected

Definition at line 492 of file LinearFormsIntegratorsImpl.hpp.

493  {
495 
496  // get element volume
497  const double vol = OpBase::getMeasure();
498  // get integration weights
499  auto t_w = OpBase::getFTensor0IntegrationWeight();
500  // get base function gradient on rows
501  auto t_row_base = row_data.getFTensor0N();
502  // get coordinate at integration points
503  auto t_coords = OpBase::getFTensor1CoordsAtGaussPts();
504  // loop over integration points
505  for (int gg = 0; gg != OpBase::nbIntegrationPts; gg++) {
506  // take into account Jacobian
507  const double alpha =
508  t_w * vol * sourceFun(t_coords(0), t_coords(1), t_coords(2));
509  // loop over rows base functions
510  int rr = 0;
511  for (; rr != OpBase::nbRows; ++rr) {
512  OpBase::locF[rr] += alpha * t_row_base;
513  ++t_row_base;
514  }
515  for (; rr < OpBase::nbRowBaseFunctions; ++rr)
516  ++t_row_base;
517  ++t_coords;
518  ++t_w; // move to another integration weight
519  }
521 }

Member Data Documentation

◆ sourceFun

template<typename OpBase >
ScalarFun MoFEM::OpSourceImpl< 1, 1, GAUSS, SourceFunctionSpecialization::S< OpBase > >::sourceFun
protected

Definition at line 61 of file LinearFormsIntegratorsImpl.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::OpSourceImpl< 1, 1, GAUSS, SourceFunctionSpecialization::S< OpBase > >::sourceFun
ScalarFun sourceFun
Definition: LinearFormsIntegratorsImpl.hpp:61
OpBase
OpBaseImpl< PETSC, EdgeEleOp > OpBase
Definition: radiation.cpp:29
MoFEM::OpBaseImpl::locF
VectorDouble locF
local entity vector
Definition: FormsIntegrators.hpp:251
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
MoFEM::OpBaseImpl::nbRowBaseFunctions
int nbRowBaseFunctions
number or row base functions
Definition: FormsIntegrators.hpp:239
MoFEM::OpBaseImpl::nbRows
int nbRows
number of dofs on rows
Definition: FormsIntegrators.hpp:236
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