v0.14.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PoissonExample::OpResF_Domain Struct Reference

#include <users_modules/tutorials/cor-2to5/src/PoissonOperators.hpp>

Inheritance diagram for PoissonExample::OpResF_Domain:
[legend]
Collaboration diagram for PoissonExample::OpResF_Domain:
[legend]

Public Member Functions

 OpResF_Domain (FSource f_source, boost::function< double(const double)> a, boost::shared_ptr< VectorDouble > &field_vals, boost::shared_ptr< MatrixDouble > &grad_vals)
 
- Public Member Functions inherited from PoissonExample::OpF
 OpF (FSource f_source)
 
- Public Member Functions inherited from PoissonExample::OpBaseRhs< VolumeElementForcesAndSourcesCore::UserDataOperator >
 OpBaseRhs (const std::string field_name)
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
 This function is called by finite element. More...
 

Protected Member Functions

MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &data)
 Integrate local entity vector. More...
 
- Protected Member Functions inherited from PoissonExample::OpF
MoFEMErrorCode aSsemble (EntitiesFieldData::EntData &data)
 assemble local entity vector to the global right hand side More...
 

Protected Attributes

FTensor::Index< 'i', 3 > i
 
boost::function< double(const double)> A
 
boost::shared_ptr< VectorDouble > fieldVals
 
boost::shared_ptr< MatrixDouble > gradVals
 
- Protected Attributes inherited from PoissonExample::OpF
FTensor::Number< 0 > NX
 
FTensor::Number< 1 > NY
 
FTensor::Number< 2 > NZ
 
FSource fSource
 
VectorDouble locVec
 
- Protected Attributes inherited from PoissonExample::OpBaseRhs< VolumeElementForcesAndSourcesCore::UserDataOperator >
int nbRows
 < error code More...
 
int nbIntegrationPts
 number of integration points More...
 

Additional Inherited Members

- Public Types inherited from PoissonExample::OpF
typedef boost::function< double(const double, const double, const double)> FSource
 

Detailed Description

Definition at line 659 of file PoissonOperators.hpp.

Constructor & Destructor Documentation

◆ OpResF_Domain()

PoissonExample::OpResF_Domain::OpResF_Domain ( FSource  f_source,
boost::function< double(const double)>  a,
boost::shared_ptr< VectorDouble > &  field_vals,
boost::shared_ptr< MatrixDouble > &  grad_vals 
)
inline
Examples
PoissonOperators.hpp.

Definition at line 661 of file PoissonOperators.hpp.

664  : OpF(f_source), A(a), fieldVals(field_vals), gradVals(grad_vals) {}

Member Function Documentation

◆ iNtegrate()

MoFEMErrorCode PoissonExample::OpResF_Domain::iNtegrate ( EntitiesFieldData::EntData data)
inlineprotectedvirtual

Integrate local entity vector.

Parameters
dataentity data on element row
Returns
error code

Reimplemented from PoissonExample::OpF.

Examples
PoissonOperators.hpp.

Definition at line 674 of file PoissonOperators.hpp.

674  {
676  // set size of local vector
677  locVec.resize(nbRows, false);
678  // clear local entity vector
679  locVec.clear();
680  // get finite element volume
681  double vol = getVolume();
682  // get integration weights
683  auto t_w = getFTensor0IntegrationWeight();
684  // get solution at integration point
685  auto t_u = getFTensor0FromVec(*fieldVals);
686  // get solution at integration point
687  auto t_grad = getFTensor1FromMat<3>(*gradVals);
688  // get base functions on entity
689  auto t_v = data.getFTensor0N();
690  // get base function gradient on rows
691  auto t_v_grad = data.getFTensor1DiffN<3>();
692  // get coordinates at integration points
693  auto t_coords = getFTensor1CoordsAtGaussPts();
694  // loop over all integration points
695  for (int gg = 0; gg != nbIntegrationPts; gg++) {
696  // evaluate constant term
697  const double alpha = vol * t_w;
698  const double source_term =
699  alpha * fSource(t_coords(NX), t_coords(NY), t_coords(NZ));
700  FTensor::Tensor1<double, 3> grad_term;
701  grad_term(i) = (alpha * A(t_u)) * t_grad(i);
702  // get element of local vector
704  &*locVec.data().begin());
705  // loop over base functions
706  for (int rr = 0; rr != nbRows; rr++) {
707  // add to local vector source term
708  t_a += t_v_grad(i) * grad_term(i) + t_v * source_term;
709  ++t_a; // move to next element of local vector
710  ++t_v; // move to next base function
711  ++t_v_grad; // move to next gradient of base function
712  }
713  ++t_w; // move to next integration weights
714  ++t_u; // move to next value
715  ++t_grad; // move to next gradient value
716  ++t_coords; // move to next physical coordinates at integration point
717  }
719  }

Member Data Documentation

◆ A

boost::function<double(const double)> PoissonExample::OpResF_Domain::A
protected
Examples
PoissonOperators.hpp.

Definition at line 721 of file PoissonOperators.hpp.

◆ fieldVals

boost::shared_ptr<VectorDouble> PoissonExample::OpResF_Domain::fieldVals
protected
Examples
PoissonOperators.hpp.

Definition at line 722 of file PoissonOperators.hpp.

◆ gradVals

boost::shared_ptr<MatrixDouble> PoissonExample::OpResF_Domain::gradVals
protected
Examples
PoissonOperators.hpp.

Definition at line 723 of file PoissonOperators.hpp.

◆ i

FTensor::Index<'i', 3> PoissonExample::OpResF_Domain::i
protected
Examples
PoissonOperators.hpp.

Definition at line 667 of file PoissonOperators.hpp.


The documentation for this struct was generated from the following file:
FTensor::Tensor1< double, 3 >
PoissonExample::OpResF_Domain::i
FTensor::Index< 'i', 3 > i
Definition: PoissonOperators.hpp:667
PoissonExample::OpF::NZ
FTensor::Number< 2 > NZ
Definition: PoissonOperators.hpp:229
PoissonExample::OpF::locVec
VectorDouble locVec
Definition: PoissonOperators.hpp:232
PoissonExample::OpF::NY
FTensor::Number< 1 > NY
Definition: PoissonOperators.hpp:228
a
constexpr double a
Definition: approx_sphere.cpp:30
PoissonExample::OpResF_Domain::A
boost::function< double(const double)> A
Definition: PoissonOperators.hpp:721
MoFEM::getFTensor0FromVec
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:135
PoissonExample::OpF::fSource
FSource fSource
Definition: PoissonOperators.hpp:230
PoissonExample::OpF::OpF
OpF(FSource f_source)
Definition: PoissonOperators.hpp:222
PoissonExample::OpResF_Domain::fieldVals
boost::shared_ptr< VectorDouble > fieldVals
Definition: PoissonOperators.hpp:722
PoissonExample::OpResF_Domain::gradVals
boost::shared_ptr< MatrixDouble > gradVals
Definition: PoissonOperators.hpp:723
FTensor::Tensor0
Definition: Tensor0.hpp:16
PoissonExample::OpF::NX
FTensor::Number< 0 > NX
Definition: PoissonOperators.hpp:227
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
PoissonExample::OpBaseRhs< VolumeElementForcesAndSourcesCore::UserDataOperator >::nbRows
int nbRows
< error code
Definition: PoissonOperators.hpp:204
PoissonExample::OpBaseRhs< VolumeElementForcesAndSourcesCore::UserDataOperator >::nbIntegrationPts
int nbIntegrationPts
number of integration points
Definition: PoissonOperators.hpp:205