v0.8.20
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...
 
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)
 
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...
 
Deprecated (do not use)
DEPRECATED MoFEMErrorCode getPorblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 
DEPRECATED MoFEMErrorCode getPorblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 
- 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 left 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 right 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 391 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 405 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 424 of file ForcesAndSourcesCore.hpp.

426  : 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 428 of file ForcesAndSourcesCore.hpp.

430  : DataOperator(symm), opType(type), rowFieldName(field_name),
431  colFieldName(field_name), sPace(LASTSPACE), ptrFE(NULL) {}
FieldSpace in [ 0, LASTSPACE )
Definition: definitions.h:173
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 433 of file ForcesAndSourcesCore.hpp.

436  : DataOperator(symm), opType(type), rowFieldName(row_field_name),
437  colFieldName(col_field_name), sPace(LASTSPACE), ptrFE(NULL) {}
FieldSpace in [ 0, LASTSPACE )
Definition: definitions.h:173
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 439 of file ForcesAndSourcesCore.hpp.

439 {}

Member Function Documentation

◆ addOpType()

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

Add operator type.

Definition at line 515 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 452 of file ForcesAndSourcesCore.hpp.

452  {
453  return getNumeredEntFiniteElementPtr()->getEnt();
454  }
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 498 of file ForcesAndSourcesCore.hpp.

498 { return ptrFE; }

◆ getFEName()

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

Get name of the element.

Definition at line 531 of file ForcesAndSourcesCore.hpp.

531  {
532  return getFEMethod()->feName;
533  }
std::string feName
Name of finite element.
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 603 of file ForcesAndSourcesCore.hpp.

603  {
605  &(getGaussPts()(getGaussPts().size1() - 1, 0)));
606  }
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 586 of file ForcesAndSourcesCore.hpp.

586  {
587  return static_cast<ForcesAndSourcesCore *>(ptrFE)->gaussPts;
588  }
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 527 of file ForcesAndSourcesCore.hpp.

527 { 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 521 of file ForcesAndSourcesCore.hpp.

521 { 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:
ElasticityMixedFormulation.hpp, HookeElement.hpp, and UnsaturatedFlow.hpp.

Definition at line 444 of file ForcesAndSourcesCore.hpp.

444  {
446  };
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr

◆ getOpType()

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

Get operator types.

Returns
Return operator type

Definition at line 504 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 623 of file ForcesAndSourcesCore.hpp.

624  {
625  return getProblemColIndices(filed_name, type, side, indices);
626  }
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 616 of file ForcesAndSourcesCore.hpp.

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

◆ getProblemColIndices()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::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 1119 of file ForcesAndSourcesCore.cpp.

1121  {
1123  if (ptrFE == NULL) {
1124  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1125  }
1126  CHKERR get_porblem_col_indices(ptrFE, type, side, field_name, indices);
1128 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:475
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:594
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:405

◆ getProblemRowIndices()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::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 1108 of file ForcesAndSourcesCore.cpp.

1110  {
1112  if (ptrFE == NULL) {
1113  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1114  }
1115  CHKERR get_porblem_row_indices(ptrFE, type, side, field_name, indices);
1117 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:475
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:594
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:405

◆ getSnesA()

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

Definition at line 543 of file ForcesAndSourcesCore.hpp.

543 { 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 545 of file ForcesAndSourcesCore.hpp.

545 { 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 539 of file ForcesAndSourcesCore.hpp.

539 { 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 541 of file ForcesAndSourcesCore.hpp.

541 { 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 559 of file ForcesAndSourcesCore.hpp.

559 { 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 567 of file ForcesAndSourcesCore.hpp.

567 { 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 561 of file ForcesAndSourcesCore.hpp.

561 { 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 557 of file ForcesAndSourcesCore.hpp.

557 { 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 563 of file ForcesAndSourcesCore.hpp.

563 { 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 565 of file ForcesAndSourcesCore.hpp.

565 { 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 553 of file ForcesAndSourcesCore.hpp.

553 { 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 555 of file ForcesAndSourcesCore.hpp.

555 { 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 510 of file ForcesAndSourcesCore.hpp.

◆ setPtrFE()

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

Definition at line 490 of file ForcesAndSourcesCore.hpp.

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

Member Data Documentation

◆ colFieldName

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

Definition at line 414 of file ForcesAndSourcesCore.hpp.

◆ opType

char MoFEM::ForcesAndSourcesCore::UserDataOperator::opType

Definition at line 412 of file ForcesAndSourcesCore.hpp.

◆ ptrFE

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

Definition at line 631 of file ForcesAndSourcesCore.hpp.

◆ rowFieldName

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

Definition at line 413 of file ForcesAndSourcesCore.hpp.

◆ sPace

FieldSpace MoFEM::ForcesAndSourcesCore::UserDataOperator::sPace

Definition at line 415 of file ForcesAndSourcesCore.hpp.


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