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

#include <users_modules/basic_finite_elements/poisson/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, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 Do calculations for give operator. More...
 

Protected Member Functions

MoFEMErrorCode iNtegrate (DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 Integrate grad-grad operator. More...
 
- Protected Member Functions inherited from PoissonExample::OpK
virtual MoFEMErrorCode aSsemble (DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::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 598 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 
)
Examples
PoissonOperators.hpp.

Definition at line 600 of file PoissonOperators.hpp.

604  : OpK(false), A(a), diffA(diff_a), fieldVals(field_vals),
605  gradVals(grad_vals) {}
boost::function< double(const double)> A
boost::function< double(const double)> diffA
boost::shared_ptr< VectorDouble > fieldVals
boost::shared_ptr< MatrixDouble > gradVals

Member Function Documentation

◆ iNtegrate()

MoFEMErrorCode PoissonExample::OpKt::iNtegrate ( DataForcesAndSourcesCore::EntData row_data,
DataForcesAndSourcesCore::EntData col_data 
)
protectedvirtual

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 614 of file PoissonOperators.hpp.

615  {
617  // set size of local entity bock
618  locMat.resize(nbRows, nbCols, false);
619  // clear matrix
620  locMat.clear();
621  // get element volume
622  double vol = getVolume();
623  // get integration weights
624  auto t_w = getFTensor0IntegrationWeight();
625  // get solution at integration point
626  auto t_u = getFTensor0FromVec(*fieldVals);
627  // get solution at integration point
628  auto t_grad = getFTensor1FromMat<3>(*gradVals);
629  // get base function gradient on rows
630  auto t_row_grad = row_data.getFTensor1DiffN<3>();
631  // loop over integration points
632  for (int gg = 0; gg != nbIntegrationPts; gg++) {
633  // take into account Jacobian
634  const double alpha = t_w * vol;
635  const double beta = alpha * A(t_u);
637  t_gamma(i) = (alpha * diffA(t_u)) * t_grad(i);
638  // take fist element to local matrix
640  &*locMat.data().begin());
641  // loop over rows base functions
642  for (int rr = 0; rr != nbRows; rr++) {
643  // get column base function
644  auto t_col = col_data.getFTensor0N(gg, 0);
645  // get column base functions gradient at gauss point gg
646  auto t_col_grad = col_data.getFTensor1DiffN<3>(gg, 0);
647  // loop over columns
648  for (int cc = 0; cc != nbCols; cc++) {
649  // calculate element of local matrix
650  a += (t_row_grad(i) * beta) * t_col_grad(i) +
651  t_row_grad(i) * (t_gamma(i) * t_col);
652  ++t_col; // move to next base function
653  ++t_col_grad; // move to another gradient of base function on column
654  ++a; // move to another element of local matrix in column
655  }
656  ++t_row_grad; // move to another element of gradient of base function on
657  // row
658  }
659  ++t_w; // move to another integration weight
660  ++t_u; // move to next value at integration point
661  ++t_grad; // move to next gradient value
662  }
664  }
static FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:142
boost::function< double(const double)> A
int nbIntegrationPts
number of integration points
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
int nbCols
number if dof on column
boost::function< double(const double)> diffA
boost::shared_ptr< VectorDouble > fieldVals
boost::shared_ptr< MatrixDouble > gradVals
FTensor::Index< 'i', 3 > i
summit Index
MatrixDouble locMat
local entity block matrix
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
int nbRows
< error code

Member Data Documentation

◆ A

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

Definition at line 666 of file PoissonOperators.hpp.

◆ diffA

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

Definition at line 667 of file PoissonOperators.hpp.

◆ fieldVals

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

Definition at line 668 of file PoissonOperators.hpp.

◆ gradVals

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

Definition at line 669 of file PoissonOperators.hpp.


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