v0.8.13
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
 
- 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 432 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 446 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 465 of file ForcesAndSourcesCore.hpp.

467  : 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 469 of file ForcesAndSourcesCore.hpp.

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

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

480 {}

Member Function Documentation

◆ addOpType()

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

Add operator type.

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

493  {
494  return getNumeredEntFiniteElementPtr()->getEnt();
495  }
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 553 of file ForcesAndSourcesCore.hpp.

553 { return ptrFE; }

◆ getFEName()

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

Get name of the element.

Definition at line 586 of file ForcesAndSourcesCore.hpp.

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

◆ getLoopSize()

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

get size of elements in the loop

Returns
loop size

Definition at line 582 of file ForcesAndSourcesCore.hpp.

582 { 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 576 of file ForcesAndSourcesCore.hpp.

576 { 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:
UnsaturatedFlow.hpp.

Definition at line 485 of file ForcesAndSourcesCore.hpp.

485  {
487  };
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr

◆ getOpType()

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

Get operator types.

Returns
Return operator type

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

547  {
548  return getProblemColIndices(filed_name, type, side, indices);
549  }
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 516 of file ForcesAndSourcesCore.hpp.

517  {
518  return getProblemRowIndices(filed_name, type, side, indices);
519  }
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 1217 of file ForcesAndSourcesCore.cpp.

1219  {
1221  if (ptrFE == NULL) {
1222  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1223  }
1224  CHKERR get_porblem_col_indices(ptrFE, type, side, field_name, indices);
1226 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:495
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:614
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:439

◆ 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 1206 of file ForcesAndSourcesCore.cpp.

1208  {
1210  if (ptrFE == NULL) {
1211  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1212  }
1213  CHKERR get_porblem_row_indices(ptrFE, type, side, field_name, indices);
1215 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:495
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:614
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:439

◆ getSnesA()

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

Definition at line 598 of file ForcesAndSourcesCore.hpp.

598 { 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 600 of file ForcesAndSourcesCore.hpp.

600 { 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 594 of file ForcesAndSourcesCore.hpp.

594 { 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 596 of file ForcesAndSourcesCore.hpp.

596 { 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 614 of file ForcesAndSourcesCore.hpp.

614 { 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 622 of file ForcesAndSourcesCore.hpp.

622 { 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 616 of file ForcesAndSourcesCore.hpp.

616 { 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 612 of file ForcesAndSourcesCore.hpp.

612 { 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 618 of file ForcesAndSourcesCore.hpp.

618 { 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 620 of file ForcesAndSourcesCore.hpp.

620 { 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 608 of file ForcesAndSourcesCore.hpp.

608 { 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 610 of file ForcesAndSourcesCore.hpp.

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

◆ setPtrFE()

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

Definition at line 538 of file ForcesAndSourcesCore.hpp.

538  {
540  ptrFE = ptr;
542  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:519
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:526

Member Data Documentation

◆ colFieldName

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

Definition at line 455 of file ForcesAndSourcesCore.hpp.

◆ opType

char MoFEM::ForcesAndSourcesCore::UserDataOperator::opType

Definition at line 453 of file ForcesAndSourcesCore.hpp.

◆ ptrFE

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

Definition at line 627 of file ForcesAndSourcesCore.hpp.

◆ rowFieldName

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

Definition at line 454 of file ForcesAndSourcesCore.hpp.

◆ sPace

FieldSpace MoFEM::ForcesAndSourcesCore::UserDataOperator::sPace

Definition at line 456 of file ForcesAndSourcesCore.hpp.


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