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

#include <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...
 
virtual MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &data)=0
 Class dedicated to integrate operator. More...
 
virtual MoFEMErrorCode aSsemble (EntitiesFieldData::EntData &data)=0
 Class dedicated to assemble operator to global system vector. More...
 

Protected Member Functions

MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &data)
 Integrate local entity vector. More...
 
- Protected Member Functions inherited from PoissonExample::OpF
MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &data)
 Integrate local entity vector. More...
 
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 662 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

Definition at line 664 of file PoissonOperators.hpp.

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

Member Function Documentation

◆ iNtegrate()

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

Integrate local entity vector.

Parameters
dataentity data on element row
Returns
error code

Definition at line 677 of file PoissonOperators.hpp.

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

Member Data Documentation

◆ A

boost::function<double(const double)> PoissonExample::OpResF_Domain::A
protected

Definition at line 724 of file PoissonOperators.hpp.

◆ fieldVals

boost::shared_ptr<VectorDouble> PoissonExample::OpResF_Domain::fieldVals
protected

Definition at line 725 of file PoissonOperators.hpp.

◆ gradVals

boost::shared_ptr<MatrixDouble> PoissonExample::OpResF_Domain::gradVals
protected

Definition at line 726 of file PoissonOperators.hpp.

◆ i

FTensor::Index<'i', 3> PoissonExample::OpResF_Domain::i
protected

Definition at line 670 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:670
PoissonExample::OpF::NZ
FTensor::Number< 2 > NZ
Definition: PoissonOperators.hpp:232
MoFEM::EntitiesFieldData::EntData::getFTensor0N
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
Definition: EntitiesFieldData.hpp:1502
PoissonExample::OpF::locVec
VectorDouble locVec
Definition: PoissonOperators.hpp:235
PoissonExample::OpF::NY
FTensor::Number< 1 > NY
Definition: PoissonOperators.hpp:231
a
constexpr double a
Definition: approx_sphere.cpp:30
PoissonExample::OpResF_Domain::A
boost::function< double(const double)> A
Definition: PoissonOperators.hpp:724
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:233
PoissonExample::OpF::OpF
OpF(FSource f_source)
Definition: PoissonOperators.hpp:225
PoissonExample::OpResF_Domain::fieldVals
boost::shared_ptr< VectorDouble > fieldVals
Definition: PoissonOperators.hpp:725
PoissonExample::OpResF_Domain::gradVals
boost::shared_ptr< MatrixDouble > gradVals
Definition: PoissonOperators.hpp:726
MoFEM::EntitiesFieldData::EntData::getFTensor1DiffN
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
Definition: EntitiesFieldData.cpp:526
FTensor::Tensor0
Definition: Tensor0.hpp:16
PoissonExample::OpF::NX
FTensor::Number< 0 > NX
Definition: PoissonOperators.hpp:230
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
PoissonExample::OpBaseRhs< VolumeElementForcesAndSourcesCore::UserDataOperator >::nbRows
int nbRows
< error code
Definition: PoissonOperators.hpp:207
PoissonExample::OpBaseRhs< VolumeElementForcesAndSourcesCore::UserDataOperator >::nbIntegrationPts
int nbIntegrationPts
number of integration points
Definition: PoissonOperators.hpp:208