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

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

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

Public Member Functions

 OpKt (boost::function< double(const double)> a, boost::function< double(const double)> diff_a, boost::shared_ptr< VectorDouble > &field_vals, boost::shared_ptr< MatrixDouble > &grad_vals)
 
- Public Member Functions inherited from PoissonExample::OpK
 OpK (bool symm=true)
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Do calculations for give operator. More...
 

Protected Member Functions

MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Integrate grad-grad operator. More...
 
- Protected Member Functions inherited from PoissonExample::OpK
virtual MoFEMErrorCode aSsemble (EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Assemble local entity block matrix. More...
 

Protected Attributes

boost::function< double(const double)> A
 
boost::function< double(const double)> diffA
 
boost::shared_ptr< VectorDouble > fieldVals
 
boost::shared_ptr< MatrixDouble > gradVals
 
- Protected Attributes inherited from PoissonExample::OpK
int nbRows
 < error code More...
 
int nbCols
 number if dof on column More...
 
int nbIntegrationPts
 number of integration points More...
 
bool isDiag
 true if this block is on diagonal More...
 
FTensor::Index< 'i', 3 > i
 summit Index More...
 
MatrixDouble locMat
 local entity block matrix More...
 

Detailed Description

Definition at line 585 of file PoissonOperators.hpp.

Constructor & Destructor Documentation

◆ OpKt()

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

Definition at line 587 of file PoissonOperators.hpp.

591  : OpK(false), A(a), diffA(diff_a), fieldVals(field_vals),
592  gradVals(grad_vals) {}

Member Function Documentation

◆ iNtegrate()

MoFEMErrorCode PoissonExample::OpKt::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 PoissonExample::OpK.

Examples
PoissonOperators.hpp.

Definition at line 601 of file PoissonOperators.hpp.

602  {
604  // set size of local entity bock
605  locMat.resize(nbRows, nbCols, false);
606  // clear matrix
607  locMat.clear();
608  // get element volume
609  double vol = getVolume();
610  // get integration weights
611  auto t_w = getFTensor0IntegrationWeight();
612  // get solution at integration point
613  auto t_u = getFTensor0FromVec(*fieldVals);
614  // get solution at integration point
615  auto t_grad = getFTensor1FromMat<3>(*gradVals);
616  // get base function gradient on rows
617  auto t_row_grad = row_data.getFTensor1DiffN<3>();
618  // loop over integration points
619  for (int gg = 0; gg != nbIntegrationPts; gg++) {
620  // take into account Jacobian
621  const double alpha = t_w * vol;
622  const double beta = alpha * A(t_u);
624  t_gamma(i) = (alpha * diffA(t_u)) * t_grad(i);
625  // take fist element to local matrix
627  &*locMat.data().begin());
628  // loop over rows base functions
629  for (int rr = 0; rr != nbRows; rr++) {
630  // get column base function
631  auto t_col = col_data.getFTensor0N(gg, 0);
632  // get column base functions gradient at gauss point gg
633  auto t_col_grad = col_data.getFTensor1DiffN<3>(gg, 0);
634  // loop over columns
635  for (int cc = 0; cc != nbCols; cc++) {
636  // calculate element of local matrix
637  a += (t_row_grad(i) * beta) * t_col_grad(i) +
638  t_row_grad(i) * (t_gamma(i) * t_col);
639  ++t_col; // move to next base function
640  ++t_col_grad; // move to another gradient of base function on column
641  ++a; // move to another element of local matrix in column
642  }
643  ++t_row_grad; // move to another element of gradient of base function on
644  // row
645  }
646  ++t_w; // move to another integration weight
647  ++t_u; // move to next value at integration point
648  ++t_grad; // move to next gradient value
649  }
651  }

Member Data Documentation

◆ A

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

Definition at line 653 of file PoissonOperators.hpp.

◆ diffA

boost::function<double(const double)> PoissonExample::OpKt::diffA
protected
Examples
PoissonOperators.hpp.

Definition at line 654 of file PoissonOperators.hpp.

◆ fieldVals

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

Definition at line 655 of file PoissonOperators.hpp.

◆ gradVals

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

Definition at line 656 of file PoissonOperators.hpp.


The documentation for this struct was generated from the following file:
FTensor::Tensor1< double, 3 >
PoissonExample::OpKt::fieldVals
boost::shared_ptr< VectorDouble > fieldVals
Definition: PoissonOperators.hpp:655
PoissonExample::OpK::nbIntegrationPts
int nbIntegrationPts
number of integration points
Definition: PoissonOperators.hpp:76
a
constexpr double a
Definition: approx_sphere.cpp:30
PoissonExample::OpK::locMat
MatrixDouble locMat
local entity block matrix
Definition: PoissonOperators.hpp:80
PoissonExample::OpK::nbCols
int nbCols
number if dof on column
Definition: PoissonOperators.hpp:75
PoissonExample::OpKt::A
boost::function< double(const double)> A
Definition: PoissonOperators.hpp:653
MoFEM::getFTensor0FromVec
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:135
PoissonExample::OpK::i
FTensor::Index< 'i', 3 > i
summit Index
Definition: PoissonOperators.hpp:79
PoissonExample::OpK::OpK
OpK(bool symm=true)
Definition: PoissonOperators.hpp:27
PoissonExample::OpKt::gradVals
boost::shared_ptr< MatrixDouble > gradVals
Definition: PoissonOperators.hpp:656
PoissonExample::OpKt::diffA
boost::function< double(const double)> diffA
Definition: PoissonOperators.hpp:654
PoissonExample::OpK::nbRows
int nbRows
< error code
Definition: PoissonOperators.hpp:74
FTensor::Tensor0
Definition: Tensor0.hpp:16
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