v0.13.2
Loading...
Searching...
No Matches
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 iNtegrate (EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Integrate grad-grad operator. More...
 
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

Definition at line 587 of file PoissonOperators.hpp.

591 : OpK(false), A(a), diffA(diff_a), fieldVals(field_vals),
592 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
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 }
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
int nbRows
< error code
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
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: