v0.8.15
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
MoFEM::ForcesAndSourcesCore::UserDataOperator Struct Reference

Data operator to do calculations at integration points.Is inherited and implemented by user to do calculations. It can be used in many different ways but typically is used to integrate matrices (f.e. stiffness matrix) and the right hand vector (f.e. force vector). More...

#include <src/finite_elements/ForcesAndSourcesCore.hpp>

Inheritance diagram for MoFEM::ForcesAndSourcesCore::UserDataOperator:
[legend]
Collaboration diagram for MoFEM::ForcesAndSourcesCore::UserDataOperator:
[legend]

Public Types

enum  OpType { OPROW = 1 << 0, OPCOL = 1 << 1, OPROWCOL = 1 << 2, OPLAST = 1 << 3 }
 Controls loop over entities on element. More...
 

Public Member Functions

 UserDataOperator (const FieldSpace space, const char type=OPLAST, const bool symm=true)
 
 UserDataOperator (const std::string &field_name, const char type, const bool symm=true)
 
 UserDataOperator (const std::string &row_field_name, const std::string &col_field_name, const char type, const bool symm=true)
 
virtual ~UserDataOperator ()
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement. More...
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle. More...
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices. More...
 
DEPRECATED MoFEMErrorCode getPorblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices. More...
 
virtual MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
DEPRECATED MoFEMErrorCode getPorblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object. More...
 
int getOpType () const
 Get operator types. More...
 
void setOpType (const OpType type)
 Set operator type. More...
 
void addOpType (const OpType type)
 Add operator type. More...
 
int getNinTheLoop () const
 get number of finite element in the loop More...
 
int getLoopSize () const
 get size of elements in the loop More...
 
const std::string & getFEName () const
 Get name of the element. More...
 
Accessing SNES
Vec getSnesF () const
 
Vec getSnesX () const
 
Mat getSnesA () const
 
Mat getSnesB () const
 
Accessing TS
Vec getTSu () const
 
Vec getTSu_t () const
 
Vec getTSf () const
 
Mat getTSA () const
 
Mat getTSB () const
 
int getTSstep () const
 
double getTStime () const
 
double getTSa () const
 
Base funtions and integration points
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element More...
 
auto getFTensor0IntegrationWeight ()
 Get integration weights. More...
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true, const bool do_vertices=true, const bool do_edges=true, const bool do_quads=true, const bool do_tris=true, const bool do_tets=true, const bool do_prisms=true)
 
virtual ~DataOperator ()
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on right hand side. More...
 
virtual MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data, bool symm=true)
 
virtual MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data)
 
virtual MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 Operator for linear form, usually to calculate values on left hand side. More...
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const bool do_vertices, const bool do_edges, const bool do_quads, const bool do_tris, const bool do_tets, const bool do_prisms, const bool error_if_no_base=true)
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const bool error_if_no_base=true)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not. More...
 
void setSymm ()
 set if operator is executed taking in account symmetry More...
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem More...
 

Public Attributes

char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- Public Attributes inherited from MoFEM::DataOperator
bool sYmm
 If true assume that matrix is symmetric structure. More...
 
bool doVertices
 If false skip vertices. More...
 
bool doEdges
 If false skip edges. More...
 
bool doQuads
 
bool doTris
 
bool doTets
 
bool doPrisms
 

Protected Attributes

ForcesAndSourcesCoreptrFE
 

Detailed Description

Data operator to do calculations at integration points.

Is inherited and implemented by user to do calculations. It can be used in many different ways but typically is used to integrate matrices (f.e. stiffness matrix) and the right hand vector (f.e. force vector).

Note: It is assumed that operator is executed for symmetric problem. That means that is executed for not repeating entities on finite element. For example on triangle we have nodes, 3 edges and one face. Because of symmetry calculations are for: nodes-nodes, nodes-edge0, nodes-edge_1, nodes-edge_2, nodes-face, edges_1-edges_1, edges_1-edge_1, edge_1-edge_2, edge_1-edge_1, edge_1-edge_2, edge_2-edge_2, edge_1-face, edge_1-face, edges_3-face, face - face

In case of non symmetric problem in addition calculations of lower off diagonal terms. F.e. edge_1-edge_0, esges_3-edge_0, edge_3-edge_1,

In that case class variable UserDataOperator::sYmm = false;

NoteL: By default sYmm is set for symmetric problems

Examples:
hello_world.cpp, and mesh_smoothing.cpp.

Definition at line 369 of file ForcesAndSourcesCore.hpp.

Member Enumeration Documentation

◆ OpType

Controls loop over entities on element.

OPROW is used if row vector is assembled OPCOL is usually used if column vector is assembled OPROWCOL is usually used for assemble matrices.

For typical problem like Bubnov-Galerkin OPROW and OPCOL are the same. In more general case for example for non-square matrices columns and rows could have different numeration and/or different set of fields.

Enumerator
OPROW 
OPCOL 
OPROWCOL 
OPLAST 

Definition at line 383 of file ForcesAndSourcesCore.hpp.

Constructor & Destructor Documentation

◆ UserDataOperator() [1/3]

MoFEM::ForcesAndSourcesCore::UserDataOperator::UserDataOperator ( const FieldSpace  space,
const char  type = OPLAST,
const bool  symm = true 
)

This Constructor is used typically when some modification base shape functions on some approx. space is applied. Operator is run for all data on space.

User has no access to field data from this operator.

Definition at line 402 of file ForcesAndSourcesCore.hpp.

404  : DataOperator(symm), opType(type), sPace(space), ptrFE(NULL) {}
DataOperator(const bool symm=true, const bool do_vertices=true, const bool do_edges=true, const bool do_quads=true, const bool do_tris=true, const bool do_tets=true, const bool do_prisms=true)

◆ UserDataOperator() [2/3]

MoFEM::ForcesAndSourcesCore::UserDataOperator::UserDataOperator ( const std::string &  field_name,
const char  type,
const bool  symm = true 
)

Definition at line 406 of file ForcesAndSourcesCore.hpp.

408  : DataOperator(symm), opType(type), rowFieldName(field_name),
409  colFieldName(field_name), sPace(LASTSPACE), ptrFE(NULL) {}
FieldSpace in [ 0, LASTSPACE )
Definition: definitions.h:172
DataOperator(const bool symm=true, const bool do_vertices=true, const bool do_edges=true, const bool do_quads=true, const bool do_tris=true, const bool do_tets=true, const bool do_prisms=true)

◆ UserDataOperator() [3/3]

MoFEM::ForcesAndSourcesCore::UserDataOperator::UserDataOperator ( const std::string &  row_field_name,
const std::string &  col_field_name,
const char  type,
const bool  symm = true 
)

Definition at line 411 of file ForcesAndSourcesCore.hpp.

414  : DataOperator(symm), opType(type), rowFieldName(row_field_name),
415  colFieldName(col_field_name), sPace(LASTSPACE), ptrFE(NULL) {}
FieldSpace in [ 0, LASTSPACE )
Definition: definitions.h:172
DataOperator(const bool symm=true, const bool do_vertices=true, const bool do_edges=true, const bool do_quads=true, const bool do_tris=true, const bool do_tets=true, const bool do_prisms=true)

◆ ~UserDataOperator()

virtual MoFEM::ForcesAndSourcesCore::UserDataOperator::~UserDataOperator ( )
virtual

Definition at line 417 of file ForcesAndSourcesCore.hpp.

417 {}

Member Function Documentation

◆ addOpType()

void MoFEM::ForcesAndSourcesCore::UserDataOperator::addOpType ( const OpType  type)

Add operator type.

Definition at line 507 of file ForcesAndSourcesCore.hpp.

◆ getFEEntityHandle()

EntityHandle MoFEM::ForcesAndSourcesCore::UserDataOperator::getFEEntityHandle ( ) const

Return finite element entity handle.

Returns
Finite element entity handle
Examples:
UnsaturatedFlow.hpp.

Definition at line 430 of file ForcesAndSourcesCore.hpp.

430  {
431  return getNumeredEntFiniteElementPtr()->getEnt();
432  }
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.

◆ getFEMethod()

const FEMethod* MoFEM::ForcesAndSourcesCore::UserDataOperator::getFEMethod ( ) const

Return raw pointer to Finite Element Method object.

Examples:
analytical_poisson_field_split.cpp, and UnsaturatedFlow.hpp.

Definition at line 490 of file ForcesAndSourcesCore.hpp.

490 { return ptrFE; }

◆ getFEName()

const std::string& MoFEM::ForcesAndSourcesCore::UserDataOperator::getFEName ( ) const

Get name of the element.

Definition at line 523 of file ForcesAndSourcesCore.hpp.

523  {
524  return getFEMethod()->feName;
525  }
std::string feName
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ getFTensor0IntegrationWeight()

auto MoFEM::ForcesAndSourcesCore::UserDataOperator::getFTensor0IntegrationWeight ( )

Get integration weights.

for(int gg = 0; gg!=getGaussPts.size2(); ++gg) {
// integrate something
++t_w;
}
Returns
FTensor::Tensor0<FTensor::PackPtr<double *, 1>>
Examples:
analytical_poisson_field_split.cpp, HookeElement.cpp, HookeElement.hpp, and UnsaturatedFlow.hpp.

Definition at line 595 of file ForcesAndSourcesCore.hpp.

595  {
597  &(getGaussPts()(getGaussPts().size1() - 1, 0)));
598  }
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element

◆ getGaussPts()

MatrixDouble& MoFEM::ForcesAndSourcesCore::UserDataOperator::getGaussPts ( )

matrix of integration (Gauss) points for Volume Element

For triangle: columns 0,1 are x,y coordinates respectively and column 2 is a weight value for example getGaussPts()(1,13) returns y coordinate of 13th Gauss point on particular volume element

For tetrahedron: columns 0,1,2 are x,y,z coordinates respectively and column 3 is a weight value for example getGaussPts()(1,13) returns y coordinate of 13th Gauss point on particular volume element

Examples:
analytical_poisson_field_split.cpp, HookeElement.cpp, HookeElement.hpp, MagneticElement.hpp, and UnsaturatedFlow.hpp.

Definition at line 578 of file ForcesAndSourcesCore.hpp.

578  {
579  return static_cast<ForcesAndSourcesCore *>(ptrFE)->gaussPts;
580  }
ForcesAndSourcesCore(Interface &m_field)
MatrixDouble gaussPts
Matrix of integration points.

◆ getLoopSize()

int MoFEM::ForcesAndSourcesCore::UserDataOperator::getLoopSize ( ) const

get size of elements in the loop

Returns
loop size

Definition at line 519 of file ForcesAndSourcesCore.hpp.

519 { return getFEMethod()->getLoopSize(); }
int getLoopSize() const
get loop size
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ getNinTheLoop()

int MoFEM::ForcesAndSourcesCore::UserDataOperator::getNinTheLoop ( ) const

get number of finite element in the loop

Returns
number of finite element

Definition at line 513 of file ForcesAndSourcesCore.hpp.

513 { return getFEMethod()->getNinTheLoop(); }
int getNinTheLoop() const
get number of evaluated element in the loop
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ getNumeredEntFiniteElementPtr()

boost::shared_ptr<const NumeredEntFiniteElement> MoFEM::ForcesAndSourcesCore::UserDataOperator::getNumeredEntFiniteElementPtr ( ) const

Return raw pointer to NumeredEntFiniteElement.

Examples:
HookeElement.hpp, and UnsaturatedFlow.hpp.

Definition at line 422 of file ForcesAndSourcesCore.hpp.

422  {
424  };
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr

◆ getOpType()

int MoFEM::ForcesAndSourcesCore::UserDataOperator::getOpType ( ) const

Get operator types.

Returns
Return operator type

Definition at line 496 of file ForcesAndSourcesCore.hpp.

◆ getPorblemColIndices()

DEPRECATED MoFEMErrorCode MoFEM::ForcesAndSourcesCore::UserDataOperator::getPorblemColIndices ( const std::string  filed_name,
const EntityType  type,
const int  side,
VectorInt indices 
) const

Definition at line 483 of file ForcesAndSourcesCore.hpp.

484  {
485  return getProblemColIndices(filed_name, type, side, indices);
486  }
MoFEMErrorCode getProblemColIndices(const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
Get col indices.

◆ getPorblemRowIndices()

DEPRECATED MoFEMErrorCode MoFEM::ForcesAndSourcesCore::UserDataOperator::getPorblemRowIndices ( const std::string  filed_name,
const EntityType  type,
const int  side,
VectorInt indices 
) const

Definition at line 453 of file ForcesAndSourcesCore.hpp.

454  {
455  return getProblemRowIndices(filed_name, type, side, indices);
456  }
MoFEMErrorCode getProblemRowIndices(const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
Get row indices.

◆ getProblemColIndices()

MoFEMErrorCode UserDataOperator::getProblemColIndices ( const std::string  filed_name,
const EntityType  type,
const int  side,
VectorInt indices 
) const

Get col indices.

Field could be or not declared for this element but is declared for problem

Parameters
field_name
typeentity type
sideside number, any number if type is MBVERTEX
Returns
indices

NOTE: Using those indices to assemble matrix will result in error if new non-zero values need to be created.

Definition at line 1156 of file ForcesAndSourcesCore.cpp.

1158  {
1160  if (ptrFE == NULL) {
1161  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1162  }
1163  CHKERR get_porblem_col_indices(ptrFE, type, side, field_name, indices);
1165 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
static MoFEMErrorCode get_porblem_col_indices(const ForcesAndSourcesCore *fe_ptr, const EntityType type, const int side, const std::string field_name, VectorInt &indices)
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ getProblemRowIndices()

MoFEMErrorCode UserDataOperator::getProblemRowIndices ( const std::string  filed_name,
const EntityType  type,
const int  side,
VectorInt indices 
) const

Get row indices.

Field could be or not declared for this element but is declared for problem

Parameters
field_name
typeentity type
sideside number, any number if type is MBVERTEX
Returns
indices

NOTE: Using those indices to assemble matrix will result in error if new non-zero values need to be created.

Definition at line 1145 of file ForcesAndSourcesCore.cpp.

1147  {
1149  if (ptrFE == NULL) {
1150  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1151  }
1152  CHKERR get_porblem_row_indices(ptrFE, type, side, field_name, indices);
1154 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
static MoFEMErrorCode get_porblem_row_indices(const ForcesAndSourcesCore *fe_ptr, const EntityType type, const int side, const std::string field_name, VectorInt &indices)
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ getSnesA()

Mat MoFEM::ForcesAndSourcesCore::UserDataOperator::getSnesA ( ) const

Definition at line 535 of file ForcesAndSourcesCore.hpp.

535 { return getFEMethod()->snes_A; }
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ getSnesB()

Mat MoFEM::ForcesAndSourcesCore::UserDataOperator::getSnesB ( ) const

Definition at line 537 of file ForcesAndSourcesCore.hpp.

537 { return getFEMethod()->snes_B; }
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ getSnesF()

Vec MoFEM::ForcesAndSourcesCore::UserDataOperator::getSnesF ( ) const

Definition at line 531 of file ForcesAndSourcesCore.hpp.

531 { return getFEMethod()->snes_f; }
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ getSnesX()

Vec MoFEM::ForcesAndSourcesCore::UserDataOperator::getSnesX ( ) const

Definition at line 533 of file ForcesAndSourcesCore.hpp.

533 { return getFEMethod()->snes_x; }
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ getTSA()

Mat MoFEM::ForcesAndSourcesCore::UserDataOperator::getTSA ( ) const

Definition at line 551 of file ForcesAndSourcesCore.hpp.

551 { return getFEMethod()->ts_A; }
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ getTSa()

double MoFEM::ForcesAndSourcesCore::UserDataOperator::getTSa ( ) const

Definition at line 559 of file ForcesAndSourcesCore.hpp.

559 { return getFEMethod()->ts_a; }
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ getTSB()

Mat MoFEM::ForcesAndSourcesCore::UserDataOperator::getTSB ( ) const

Definition at line 553 of file ForcesAndSourcesCore.hpp.

553 { return getFEMethod()->ts_B; }
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ getTSf()

Vec MoFEM::ForcesAndSourcesCore::UserDataOperator::getTSf ( ) const

Definition at line 549 of file ForcesAndSourcesCore.hpp.

549 { return getFEMethod()->ts_F; }
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ getTSstep()

int MoFEM::ForcesAndSourcesCore::UserDataOperator::getTSstep ( ) const

Definition at line 555 of file ForcesAndSourcesCore.hpp.

555 { return getFEMethod()->ts_step; }
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ getTStime()

double MoFEM::ForcesAndSourcesCore::UserDataOperator::getTStime ( ) const

Definition at line 557 of file ForcesAndSourcesCore.hpp.

557 { return getFEMethod()->ts_t; }
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ getTSu()

Vec MoFEM::ForcesAndSourcesCore::UserDataOperator::getTSu ( ) const

Definition at line 545 of file ForcesAndSourcesCore.hpp.

545 { return getFEMethod()->ts_u; }
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ getTSu_t()

Vec MoFEM::ForcesAndSourcesCore::UserDataOperator::getTSu_t ( ) const

Definition at line 547 of file ForcesAndSourcesCore.hpp.

547 { return getFEMethod()->ts_u_t; }
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ setOpType()

void MoFEM::ForcesAndSourcesCore::UserDataOperator::setOpType ( const OpType  type)

Set operator type.

Parameters
Operatortype

Definition at line 502 of file ForcesAndSourcesCore.hpp.

◆ setPtrFE()

virtual MoFEMErrorCode MoFEM::ForcesAndSourcesCore::UserDataOperator::setPtrFE ( ForcesAndSourcesCore ptr)
virtual

Definition at line 475 of file ForcesAndSourcesCore.hpp.

475  {
477  ptrFE = ptr;
479  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

Member Data Documentation

◆ colFieldName

std::string MoFEM::ForcesAndSourcesCore::UserDataOperator::colFieldName

Definition at line 392 of file ForcesAndSourcesCore.hpp.

◆ opType

char MoFEM::ForcesAndSourcesCore::UserDataOperator::opType

Definition at line 390 of file ForcesAndSourcesCore.hpp.

◆ ptrFE

ForcesAndSourcesCore* MoFEM::ForcesAndSourcesCore::UserDataOperator::ptrFE
protected

Definition at line 603 of file ForcesAndSourcesCore.hpp.

◆ rowFieldName

std::string MoFEM::ForcesAndSourcesCore::UserDataOperator::rowFieldName

Definition at line 391 of file ForcesAndSourcesCore.hpp.

◆ sPace

FieldSpace MoFEM::ForcesAndSourcesCore::UserDataOperator::sPace

Definition at line 393 of file ForcesAndSourcesCore.hpp.


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