v0.16.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PoissonExample::OpKt Struct Reference

#include "tutorials/cor-2to5_analytical_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, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Do calculations for give operator.
 

Protected Member Functions

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

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
 
int nbCols
 number if dof on column
 
int nbIntegrationPts
 number of integration points
 
bool isDiag
 true if this block is on diagonal
 
FTensor::Index< 'i', 3 > i
 summit Index
 
MatrixDouble locMat
 local entity block matrix
 

Detailed Description

Definition at line 588 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

Definition at line 590 of file PoissonOperators.hpp.

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

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
mofem/tutorials/cor-2to5_analytical_poisson/src/PoissonOperators.hpp.

Definition at line 604 of file PoissonOperators.hpp.

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

Member Data Documentation

◆ A

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

◆ diffA

boost::function<double(const double)> PoissonExample::OpKt::diffA
protected

◆ fieldVals

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

◆ gradVals

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

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