v0.15.0
Loading...
Searching...
No Matches
MoFEM::ForcesAndSourcesCore::UserDataOperator Struct Reference

#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 , OPSPACE = 1 << 3 ,
  OPLAST = 1 << 3
}
 Controls loop over entities on element. More...
 
- Public Types inherited from MoFEM::DataOperator
using DoWorkLhsHookFunType
 
using DoWorkRhsHookFunType
 

Public Member Functions

 UserDataOperator (const FieldSpace space, const char type=OPSPACE, 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)
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement.
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle.
 
int getFEDim () const
 Get dimension of finite element.
 
EntityType getFEType () const
 Get dimension of finite element.
 
boost::weak_ptr< SideNumbergetSideNumberPtr (const int side_number, const EntityType type)
 Get the side number pointer.
 
EntityHandle getSideEntity (const int side_number, const EntityType type)
 Get the side entity.
 
int getNumberOfNodesOnElement () const
 Get the number of nodes on finite element.
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices.
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices.
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object.
 
int getOpType () const
 Get operator types.
 
void setOpType (const OpType type)
 Set operator type.
 
void addOpType (const OpType type)
 Add operator type.
 
int getNinTheLoop () const
 get number of finite element in the loop
 
int getLoopSize () const
 get size of elements in the loop
 
std::string getFEName () const
 Get name of the element.
 
ForcesAndSourcesCoregetPtrFE () const
 
ForcesAndSourcesCoregetSidePtrFE () const
 
ForcesAndSourcesCoregetRefinePtrFE () const
 
Accessing KSP
const PetscData::SwitchesgetDataCtx () const
 
const KspMethod::KSPContext getKSPCtx () const
 
const SnesMethod::SNESContext getSNESCtx () const
 
const TSMethod::TSContext getTSCtx () const
 
Vec getKSPf () const
 
Mat getKSPA () const
 
Mat getKSPB () const
 
Accessing SNES
Vec getSNESf () const
 
Vec getSNESx () const
 
Mat getSNESA () const
 
Mat getSNESB () const
 
Accessing TS
Vec getTSu () const
 
Vec getTSu_t () const
 
Vec getTSu_tt () const
 
Vec getTSf () const
 
Mat getTSA () const
 
Mat getTSB () const
 
int getTSstep () const
 
double getTStime () const
 
double getTStimeStep () const
 
double getTSa () const
 
double getTSaa () const
 
Base funtions and integration points
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element
 
auto getFTensor0IntegrationWeight ()
 Get integration weights.
 
Coordinates and access to internal data
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3)
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry.
 
Measures (area, volume, length, etc.)
double getMeasure () const
 get measure of element
 
doublegetMeasure ()
 get measure of element
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true)
 
virtual ~DataOperator ()=default
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side.
 
virtual MoFEMErrorCode opLhs (EntitiesFieldData &row_data, EntitiesFieldData &col_data)
 
virtual MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 Operator for linear form, usually to calculate values on right hand side.
 
virtual MoFEMErrorCode opRhs (EntitiesFieldData &data, const bool error_if_no_base=false)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not.
 
void setSymm ()
 set if operator is executed taking in account symmetry
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem
 

Public Attributes

char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- Public Attributes inherited from MoFEM::DataOperator
DoWorkLhsHookFunType doWorkLhsHook
 
DoWorkRhsHookFunType doWorkRhsHook
 
bool sYmm
 If true assume that matrix is symmetric structure.
 
std::array< bool, MBMAXTYPE > doEntities
 If true operator is executed for entity.
 
booldoVertices
 \deprectaed If false skip vertices
 
booldoEdges
 \deprectaed If false skip edges
 
booldoQuads
 \deprectaed
 
booldoTris
 \deprectaed
 
booldoTets
 \deprectaed
 
booldoPrisms
 \deprectaed
 

Static Public Attributes

static const char *const OpTypeNames []
 

Protected Member Functions

virtual MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 

Protected Attributes

ForcesAndSourcesCoreptrFE
 

Friends

class ForcesAndSourcesCore
 
class EdgeElementForcesAndSourcesCore
 
class FaceElementForcesAndSourcesCore
 
class ContactPrismElementForcesAndSourcesCore
 

Loops

}

using AdjCache
 
MoFEMErrorCode loopSide (const string &fe_name, ForcesAndSourcesCore *side_fe, const size_t dim, const EntityHandle ent_for_side=0, boost::shared_ptr< Range > fe_range=nullptr, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy, AdjCache *adj_cache=nullptr)
 User calls this function to loop over elements on the side of face. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopThis (const string &fe_name, ForcesAndSourcesCore *this_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over the same element using a different set of integration points. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopParent (const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopChildren (const string &fe_name, ForcesAndSourcesCore *child_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopRange (const string &fe_name, ForcesAndSourcesCore *range_fe, boost::shared_ptr< Range > fe_range, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 Iterate over range of elements.
 

Detailed Description

Examples
mesh_smoothing.cpp.

Definition at line 546 of file ForcesAndSourcesCore.hpp.

Member Typedef Documentation

◆ AdjCache

using MoFEM::ForcesAndSourcesCore::UserDataOperator::AdjCache
Initial value:
std::map<EntityHandle,
std::vector<boost::weak_ptr<NumeredEntFiniteElement>>>

Definition at line 899 of file ForcesAndSourcesCore.hpp.

Member Enumeration Documentation

◆ OpType

enum MoFEM::ForcesAndSourcesCore::UserDataOperator::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.
  • OPSPACE no field is defined for such operator. Is usually used to modify base

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 

operator doWork function is executed on FE rows

OPCOL 

operator doWork function is executed on FE columns

OPROWCOL 

operator doWork is executed on FE rows &columns

OPSPACE 

operator do Work is execute on space data

OPLAST 
Deprecated
would be removed

Definition at line 563 of file ForcesAndSourcesCore.hpp.

563 {
564 OPROW = 1 << 0, ///< operator doWork function is executed on FE rows
565 OPCOL = 1 << 1, ///< operator doWork function is executed on FE columns
566 OPROWCOL = 1 << 2, ///< operator doWork is executed on FE rows &columns
567 OPSPACE = 1 << 3, ///< operator do Work is execute on space data
568 OPLAST = 1 << 3 ///< @deprecated would be removed
569 };
@ OPCOL
operator doWork function is executed on FE columns
@ OPROW
operator doWork function is executed on FE rows
@ OPROWCOL
operator doWork is executed on FE rows &columns
@ OPSPACE
operator do Work is execute on space data

Constructor & Destructor Documentation

◆ UserDataOperator() [1/3]

ForcesAndSourcesCore::UserDataOperator::UserDataOperator ( const FieldSpace space,
const char type = OPSPACE,
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 2125 of file ForcesAndSourcesCore.cpp.

◆ UserDataOperator() [2/3]

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

Definition at line 2130 of file ForcesAndSourcesCore.cpp.

2132 : DataOperator(symm), opType(type), rowFieldName(field_name),
@ LASTSPACE
FieldSpace in [ 0, LASTSPACE )
Definition definitions.h:89
constexpr auto field_name

◆ UserDataOperator() [3/3]

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

2138 : DataOperator(symm), opType(type), rowFieldName(row_field_name),
2139 colFieldName(col_field_name), sPace(LASTSPACE), ptrFE(nullptr) {}

Member Function Documentation

◆ addOpType()

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

Add operator type.

Definition at line 1066 of file ForcesAndSourcesCore.hpp.

1066 {
1067 opType |= type;
1068}

◆ getCoordsAtGaussPts()

MatrixDouble & ForcesAndSourcesCore::UserDataOperator::getCoordsAtGaussPts ( )
inline

◆ getDataCtx()

const PetscData::Switches & ForcesAndSourcesCore::UserDataOperator::getDataCtx ( ) const
inline

Definition at line 1083 of file ForcesAndSourcesCore.hpp.

1083 {
1084 return getFEMethod()->data_ctx;
1085}
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.

◆ getFEDim()

int ForcesAndSourcesCore::UserDataOperator::getFEDim ( ) const
inline

Get dimension of finite element.

Returns
int

Definition at line 1022 of file ForcesAndSourcesCore.hpp.

1022 {
1024};
auto dimension_from_handle(const EntityHandle h)
get entity dimension form handle
EntityHandle getFEEntityHandle() const
Return finite element entity handle.

◆ getFEEntityHandle()

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

Return finite element entity handle.

Returns
Finite element entity handle
Examples
UnsaturatedFlow.hpp.

Definition at line 1018 of file ForcesAndSourcesCore.hpp.

1018 {
1019 return getNumeredEntFiniteElementPtr()->getEnt();
1020}
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.

◆ getFEMethod()

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

◆ getFEName()

std::string ForcesAndSourcesCore::UserDataOperator::getFEName ( ) const
inline

Get name of the element.

Definition at line 1078 of file ForcesAndSourcesCore.hpp.

1078 {
1079 return getFEMethod()->getFEName();
1080}
auto getFEName() const
get finite element name

◆ getFEType()

EntityType ForcesAndSourcesCore::UserDataOperator::getFEType ( ) const
inline

Get dimension of finite element.

Returns
int

Definition at line 1026 of file ForcesAndSourcesCore.hpp.

1026 {
1028};
auto type_from_handle(const EntityHandle h)
get type from entity handle

◆ getFTensor0IntegrationWeight()

auto ForcesAndSourcesCore::UserDataOperator::getFTensor0IntegrationWeight ( )
inline

Get integration weights.

for(int gg = 0; gg!=getGaussPts.size2(); ++gg) {
// integrate something
++t_w;
}
auto getFTensor0IntegrationWeight()
Get integration weights.
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
Returns
FTensor::Tensor0<FTensor::PackPtr<double *, 1>>
Examples
EshelbianOperators.cpp, UnsaturatedFlow.hpp, hcurl_divergence_operator_2d.cpp, phase.cpp, prism_polynomial_approximation.cpp, quad_polynomial_approximation.cpp, reaction_diffusion.cpp, simple_elasticity.cpp, and simple_interface.cpp.

Definition at line 1254 of file ForcesAndSourcesCore.hpp.

1254 {
1256 &(getGaussPts()(getGaussPts().size1() - 1, 0)));
1257}

◆ getFTensor1CoordsAtGaussPts()

auto ForcesAndSourcesCore::UserDataOperator::getFTensor1CoordsAtGaussPts ( )
inline

Get coordinates at integration points assuming linear geometry.

auto t_coords = getFTensor1CoordsAtGaussPts();
for(int gg = 0;gg!=nb_int_ptrs;gg++) {
// do something
++t_coords;
}
auto getFTensor1CoordsAtGaussPts()
Get coordinates at integration points assuming linear geometry.
Examples
UnsaturatedFlow.hpp, prism_polynomial_approximation.cpp, quad_polynomial_approximation.cpp, and simple_interface.cpp.

Definition at line 1283 of file ForcesAndSourcesCore.hpp.

1283 {
1285 &getCoordsAtGaussPts()(0, 0), &getCoordsAtGaussPts()(0, 1),
1286 &getCoordsAtGaussPts()(0, 2));
1287}
MatrixDouble & getCoordsAtGaussPts()
Gauss points and weight, matrix (nb. of points x 3)

◆ getGaussPts()

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

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
EshelbianOperators.cpp, MagneticElement.hpp, UnsaturatedFlow.hpp, continuity_check_on_skeleton_3d.cpp, hdiv_check_approx_in_3d.cpp, phase.cpp, reaction_diffusion.cpp, and simple_interface.cpp.

Definition at line 1250 of file ForcesAndSourcesCore.hpp.

1250 {
1251 return static_cast<ForcesAndSourcesCore *>(ptrFE)->gaussPts;
1252}
MatrixDouble gaussPts
Matrix of integration points.

◆ getKSPA()

Mat ForcesAndSourcesCore::UserDataOperator::getKSPA ( ) const
inline

Definition at line 1110 of file ForcesAndSourcesCore.hpp.

1110 {
1111#ifndef NDEBUG
1112 if (getFEMethod()->ksp_A == PETSC_NULLPTR)
1113 THROW_MESSAGE("KSP not set A vector");
1114#endif
1115 return getFEMethod()->ksp_A;
1116}
#define THROW_MESSAGE(msg)
Throw MoFEM exception.

◆ getKSPB()

Mat ForcesAndSourcesCore::UserDataOperator::getKSPB ( ) const
inline

Definition at line 1118 of file ForcesAndSourcesCore.hpp.

1118 {
1119#ifndef NDEBUG
1120 if (getFEMethod()->ksp_B == PETSC_NULLPTR)
1121 THROW_MESSAGE("KSP not set B vector");
1122#endif
1123 return getFEMethod()->ksp_B;
1124}

◆ getKSPCtx()

const KspMethod::KSPContext ForcesAndSourcesCore::UserDataOperator::getKSPCtx ( ) const
inline

Definition at line 1088 of file ForcesAndSourcesCore.hpp.

1088 {
1089 return getFEMethod()->ksp_ctx;
1090}
KSPContext ksp_ctx
Context.

◆ getKSPf()

Vec ForcesAndSourcesCore::UserDataOperator::getKSPf ( ) const
inline

Definition at line 1102 of file ForcesAndSourcesCore.hpp.

1102 {
1103#ifndef NDEBUG
1104 if (getFEMethod()->ksp_f == PETSC_NULLPTR)
1105 THROW_MESSAGE("KSP not set F vector");
1106#endif
1107 return getFEMethod()->ksp_f;
1108}

◆ getLoopSize()

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

get size of elements in the loop

Returns
loop size

Definition at line 1074 of file ForcesAndSourcesCore.hpp.

1074 {
1075 return getFEMethod()->getLoopSize();
1076}
int getLoopSize() const
get loop size

◆ getMeasure() [1/2]

double & ForcesAndSourcesCore::UserDataOperator::getMeasure ( )
inline

get measure of element

Returns
volume

Definition at line 1293 of file ForcesAndSourcesCore.hpp.

1293 {
1294 return static_cast<ForcesAndSourcesCore *>(ptrFE)->elementMeasure;
1295}

◆ getMeasure() [2/2]

double ForcesAndSourcesCore::UserDataOperator::getMeasure ( ) const
inline

get measure of element

Returns
volume
Examples
hcurl_divergence_operator_2d.cpp, plastic.cpp, quad_polynomial_approximation.cpp, and reaction_diffusion.cpp.

Definition at line 1289 of file ForcesAndSourcesCore.hpp.

1289 {
1290 return static_cast<ForcesAndSourcesCore *>(ptrFE)->elementMeasure;
1291}

◆ getNinTheLoop()

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

get number of finite element in the loop

Returns
number of finite element

Definition at line 1070 of file ForcesAndSourcesCore.hpp.

1070 {
1071 return getFEMethod()->getNinTheLoop();
1072}
int getNinTheLoop() const
get number of evaluated element in the loop

◆ getNumberOfNodesOnElement()

int ForcesAndSourcesCore::UserDataOperator::getNumberOfNodesOnElement ( ) const
inline

Get the number of nodes on finite element.

Returns
int
Examples
boundary_marker.cpp.

Definition at line 1052 of file ForcesAndSourcesCore.hpp.

1052 {
1053 return ptrFE->getNumberOfNodes();
1054}
auto getNumberOfNodes() const

◆ getNumeredEntFiniteElementPtr()

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

Return raw pointer to NumeredEntFiniteElement.

Examples
ElasticityMixedFormulation.hpp, NavierStokesElement.cpp, and UnsaturatedFlow.hpp.

Definition at line 1014 of file ForcesAndSourcesCore.hpp.

1014 {
1016};
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr

◆ getOpType()

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

Get operator types.

Returns
Return operator type

Definition at line 1060 of file ForcesAndSourcesCore.hpp.

1060{ return opType; }

◆ getProblemColIndices()

MoFEMErrorCode 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 1701 of file ForcesAndSourcesCore.cpp.

1703 {
1705 if (ptrFE == NULL)
1706 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1707
1708 switch (type) {
1709 case MBVERTEX:
1711 break;
1712 default:
1713 CHKERR ptrFE->getProblemTypeColIndices(field_name, type, side, indices);
1714 }
1716}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
MoFEMErrorCode getProblemTypeColIndices(const std::string &field_name, EntityType type, int side_number, VectorInt &indices) const
MoFEMErrorCode getProblemNodesColIndices(const std::string &field_name, VectorInt &nodes_indices) const

◆ getProblemRowIndices()

MoFEMErrorCode 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 1684 of file ForcesAndSourcesCore.cpp.

1686 {
1688 if (ptrFE == NULL)
1689 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1690
1691 switch (type) {
1692 case MBVERTEX:
1694 break;
1695 default:
1696 CHKERR ptrFE->getProblemTypeRowIndices(field_name, type, side, indices);
1697 }
1699}
MoFEMErrorCode getProblemNodesRowIndices(const std::string &field_name, VectorInt &nodes_indices) const
MoFEMErrorCode getProblemTypeRowIndices(const std::string &field_name, EntityType type, int side_number, VectorInt &indices) const

◆ getPtrFE()

ForcesAndSourcesCore * ForcesAndSourcesCore::UserDataOperator::getPtrFE ( ) const
inline

Definition at line 1265 of file ForcesAndSourcesCore.hpp.

1265 {
1266 return ptrFE;
1267}

◆ getRefinePtrFE()

ForcesAndSourcesCore * ForcesAndSourcesCore::UserDataOperator::getRefinePtrFE ( ) const
inline

Definition at line 1275 of file ForcesAndSourcesCore.hpp.

1275 {
1276 return ptrFE->refinePtrFE;
1277}
ForcesAndSourcesCore * refinePtrFE
Element to integrate parent or child.

◆ getSideEntity()

EntityHandle ForcesAndSourcesCore::UserDataOperator::getSideEntity ( const int side_number,
const EntityType type )
inline

Get the side entity.

Note
For vertex is expectation. Side basses in argument of function doWork is zero. For other entity types side can be used as argument of this function.
MoFEMErrorCode doWork(int side, EntityType type,
if (type == MBVERTEX) {
for (int n = 0; n != number_of_nodes; ++n)
// Do somthing
} else {
EntityHandle ent = getSideEntity(side, type);
// Do somthing
}
}
const double n
refractive index of diffusive medium
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
virtual MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
Operator for bi-linear form, usually to calculate values on left hand side.
Data on single entity (This is passed as argument to DataOperator::doWork)
EntityHandle getSideEntity(const int side_number, const EntityType type)
Get the side entity.
Parameters
side_number
type
Examples
boundary_marker.cpp.

Definition at line 1044 of file ForcesAndSourcesCore.hpp.

1045 {
1046 if (auto side_ptr = getSideNumberPtr(side_number, type).lock())
1047 return side_ptr->ent;
1048 else
1049 return 0;
1050}
boost::weak_ptr< SideNumber > getSideNumberPtr(const int side_number, const EntityType type)
Get the side number pointer.

◆ getSideNumberPtr()

boost::weak_ptr< SideNumber > ForcesAndSourcesCore::UserDataOperator::getSideNumberPtr ( const int side_number,
const EntityType type )
inline

Get the side number pointer.

Note
For vertex is expectation. Side basses in argument of function doWork is zero. For other entity types side can be used as argument of this function.
Parameters
side_number
type
Returns
boost::weak_ptr<SideNumber>

Definition at line 1031 of file ForcesAndSourcesCore.hpp.

1032 {
1033 auto &side_table_by_side_and_type =
1034 ptrFE->numeredEntFiniteElementPtr->getSideNumberTable().get<1>();
1035 auto side_it =
1036 side_table_by_side_and_type.find(boost::make_tuple(type, side_number));
1037 if (side_it != side_table_by_side_and_type.end())
1038 return *side_it;
1039 else
1040 return boost::weak_ptr<SideNumber>();
1041}

◆ getSidePtrFE()

ForcesAndSourcesCore * ForcesAndSourcesCore::UserDataOperator::getSidePtrFE ( ) const
inline

Definition at line 1270 of file ForcesAndSourcesCore.hpp.

1270 {
1271 return ptrFE->sidePtrFE;
1272}
ForcesAndSourcesCore * sidePtrFE
Element to integrate on the sides.

◆ getSNESA()

Mat ForcesAndSourcesCore::UserDataOperator::getSNESA ( ) const
inline

Definition at line 1142 of file ForcesAndSourcesCore.hpp.

1142 {
1143#ifndef NDEBUG
1144 if (getFEMethod()->snes_A == PETSC_NULLPTR)
1145 THROW_MESSAGE("SNES not set A vector");
1146#endif
1147 return getFEMethod()->snes_A;
1148}
Mat & snes_A
jacobian matrix

◆ getSNESB()

Mat ForcesAndSourcesCore::UserDataOperator::getSNESB ( ) const
inline

Definition at line 1150 of file ForcesAndSourcesCore.hpp.

1150 {
1151#ifndef NDEBUG
1152 if (getFEMethod()->snes_B == PETSC_NULLPTR)
1153 THROW_MESSAGE("SNES not set A matrix");
1154#endif
1155 return getFEMethod()->snes_B;
1156}
Mat & snes_B
preconditioner of jacobian matrix

◆ getSNESCtx()

const SnesMethod::SNESContext ForcesAndSourcesCore::UserDataOperator::getSNESCtx ( ) const
inline

Definition at line 1093 of file ForcesAndSourcesCore.hpp.

1093 {
1094 return getFEMethod()->snes_ctx;
1095}
SNESContext snes_ctx

◆ getSNESf()

Vec ForcesAndSourcesCore::UserDataOperator::getSNESf ( ) const
inline

Definition at line 1126 of file ForcesAndSourcesCore.hpp.

1126 {
1127#ifndef NDEBUG
1128 if (getFEMethod()->snes_f == PETSC_NULLPTR)
1129 THROW_MESSAGE("SNES not set F vector");
1130#endif
1131 return getFEMethod()->snes_f;
1132}
Vec & snes_f
residual

◆ getSNESx()

Vec ForcesAndSourcesCore::UserDataOperator::getSNESx ( ) const
inline

Definition at line 1134 of file ForcesAndSourcesCore.hpp.

1134 {
1135#ifndef NDEBUG
1136 if (getFEMethod()->snes_x == PETSC_NULLPTR)
1137 THROW_MESSAGE("SNESnot set X vector");
1138#endif
1139 return getFEMethod()->snes_x;
1140}
Vec & snes_x
state vector

◆ getTSA()

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

Definition at line 1190 of file ForcesAndSourcesCore.hpp.

1190 {
1191#ifndef NDEBUG
1192 if (getFEMethod()->ts_A == PETSC_NULLPTR)
1193 THROW_MESSAGE("TS not set A matrix");
1194#endif
1195 return getFEMethod()->ts_A;
1196}

◆ getTSa()

double ForcesAndSourcesCore::UserDataOperator::getTSa ( ) const
inline
Examples
EshelbianOperators.cpp.

Definition at line 1230 of file ForcesAndSourcesCore.hpp.

1230 {
1231#ifndef NDEBUG
1233 .none() ||
1235 THROW_MESSAGE("TS not set B matrix");
1236#endif
1237 return getFEMethod()->ts_a;
1238}
static constexpr Switches CtxSetA
static constexpr Switches CtxSetX_T
static constexpr Switches CtxSetB
PetscReal ts_a
shift for U_t (see PETSc Time Solver)

◆ getTSaa()

double ForcesAndSourcesCore::UserDataOperator::getTSaa ( ) const
inline
Examples
EshelbianOperators.cpp.

Definition at line 1240 of file ForcesAndSourcesCore.hpp.

1240 {
1241#ifndef NDEBUG
1243 .none() ||
1245 THROW_MESSAGE("TS not set B matrix");
1246#endif
1247 return getFEMethod()->ts_aa;
1248}
static constexpr Switches CtxSetX_TT
PetscReal ts_aa
shift for U_tt shift for U_tt

◆ getTSB()

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

Definition at line 1198 of file ForcesAndSourcesCore.hpp.

1198 {
1199#ifndef NDEBUG
1200 if (getFEMethod()->ts_B == PETSC_NULLPTR)
1201 THROW_MESSAGE("TS not set B matrix");
1202#endif
1203 return getFEMethod()->ts_B;
1204}
Mat & ts_B
Preconditioner for ts_A.

◆ getTSCtx()

const TSMethod::TSContext ForcesAndSourcesCore::UserDataOperator::getTSCtx ( ) const
inline

Definition at line 1098 of file ForcesAndSourcesCore.hpp.

1098 {
1099 return getFEMethod()->ts_ctx;
1100}

◆ getTSf()

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

Definition at line 1182 of file ForcesAndSourcesCore.hpp.

1182 {
1183#ifndef NDEBUG
1184 if (getFEMethod()->ts_F == PETSC_NULLPTR)
1185 THROW_MESSAGE("TS not set F vector");
1186#endif
1187 return getFEMethod()->ts_F;
1188}
Vec & ts_F
residual vector

◆ getTSstep()

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

Definition at line 1206 of file ForcesAndSourcesCore.hpp.

1206 {
1207#ifndef NDEBUG
1208 if ((getFEMethod()->data_ctx & PetscData::PetscData::CtxSetTime).none())
1209 THROW_MESSAGE("TS not set time");
1210#endif
1211 return getFEMethod()->ts_step;
1212}
PetscInt ts_step
time step number

◆ getTStime()

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

Definition at line 1214 of file ForcesAndSourcesCore.hpp.

1214 {
1215#ifndef NDEBUG
1216 if ((getFEMethod()->data_ctx & PetscData::PetscData::CtxSetTime).none())
1217 THROW_MESSAGE("TS not set time");
1218#endif
1219 return getFEMethod()->ts_t;
1220}
PetscReal ts_t
time

◆ getTStimeStep()

double ForcesAndSourcesCore::UserDataOperator::getTStimeStep ( ) const
inline
Examples
EshelbianOperators.cpp.

Definition at line 1222 of file ForcesAndSourcesCore.hpp.

1222 {
1223#ifndef NDEBUG
1224 if ((getFEMethod()->data_ctx & PetscData::PetscData::CtxSetTime).none())
1225 THROW_MESSAGE("TS not set time");
1226#endif
1227 return getFEMethod()->ts_dt;
1228}
PetscReal ts_dt
time step size

◆ getTSu()

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

Definition at line 1158 of file ForcesAndSourcesCore.hpp.

1158 {
1159#ifndef NDEBUG
1160 if (getFEMethod()->ts_u == PETSC_NULLPTR)
1161 THROW_MESSAGE("TS not set U vector");
1162#endif
1163 return getFEMethod()->ts_u;
1164}
Vec & ts_u
state vector

◆ getTSu_t()

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

Definition at line 1166 of file ForcesAndSourcesCore.hpp.

1166 {
1167#ifndef NDEBUG
1168 if (getFEMethod()->ts_u_t == PETSC_NULLPTR)
1169 THROW_MESSAGE("TS not set U_t vector");
1170#endif
1171 return getFEMethod()->ts_u_t;
1172}
Vec & ts_u_t
time derivative of state vector

◆ getTSu_tt()

Vec ForcesAndSourcesCore::UserDataOperator::getTSu_tt ( ) const
inline

Definition at line 1174 of file ForcesAndSourcesCore.hpp.

1174 {
1175#ifndef NDEBUG
1176 if (getFEMethod()->ts_u_tt == PETSC_NULLPTR)
1177 THROW_MESSAGE("TS not set U_tt vector");
1178#endif
1179 return getFEMethod()->ts_u_tt;
1180}
Vec & ts_u_tt
second time derivative of state vector

◆ loopChildren()

MoFEMErrorCode ForcesAndSourcesCore::UserDataOperator::loopChildren ( const string & fe_name,
ForcesAndSourcesCore * child_fe,
const int verb = QUIET,
const LogManager::SeverityLevel sev = Sev::noisy )

User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations.

Parameters
fe_name
child_fe
verb
sev
Returns
MoFEMErrorCode

Definition at line 1960 of file ForcesAndSourcesCore.cpp.

1962 {
1964
1965 auto fe_miit = ptrFE->mField.get_finite_elements()
1966 ->get<FiniteElement_name_mi_tag>()
1967 .find(fe_name);
1968 if (fe_miit != ptrFE->mField.get_finite_elements()
1969 ->get<FiniteElement_name_mi_tag>()
1970 .end()) {
1971
1972 const auto *problem_ptr = getFEMethod()->problemPtr;
1973 auto &ref_ents = *getPtrFE()->mField.get_ref_ents();
1974 auto &numered_fe =
1975 problem_ptr->numeredFiniteElementsPtr->get<Unique_mi_tag>();
1976
1977 const auto parent_ent = getNumeredEntFiniteElementPtr()->getEnt();
1978 const auto parent_type = getNumeredEntFiniteElementPtr()->getEntType();
1979 auto range =
1980 ref_ents.get<Composite_ParentEnt_And_EntType_mi_tag>().equal_range(
1981 boost::make_tuple(parent_type, parent_ent));
1982
1983 if (auto size = std::distance(range.first, range.second)) {
1984
1985 std::vector<EntityHandle> childs_vec;
1986 childs_vec.reserve(size);
1987 for (; range.first != range.second; ++range.first)
1988 childs_vec.emplace_back((*range.first)->getEnt());
1989
1990 Range childs;
1991
1992 if ((childs_vec.back() - childs_vec.front() + 1) == size)
1993 childs = Range(childs_vec.front(), childs_vec.back());
1994 else
1995 childs.insert_list(childs_vec.begin(), childs_vec.end());
1996
1997 child_fe->feName = fe_name;
1998
1999 CHKERR child_fe->setRefineFEPtr(ptrFE);
2000 CHKERR child_fe->copyBasicMethod(*getFEMethod());
2001 CHKERR child_fe->copyPetscData(*getFEMethod());
2002 CHKERR child_fe->copyKsp(*getFEMethod());
2003 CHKERR child_fe->copySnes(*getFEMethod());
2004 CHKERR child_fe->copyTs(*getFEMethod());
2005
2006 child_fe->cacheWeakPtr = getFEMethod()->cacheWeakPtr;
2007
2008 CHKERR child_fe->preProcess();
2009
2010 int nn = 0;
2011 child_fe->loopSize = size;
2012
2013 for (auto p = childs.pair_begin(); p != childs.pair_end(); ++p) {
2014
2015 auto miit =
2016 numered_fe.lower_bound(EntFiniteElement::getLocalUniqueIdCalculate(
2017 p->first, (*fe_miit)->getFEUId()));
2018 auto hi_miit =
2019 numered_fe.upper_bound(EntFiniteElement::getLocalUniqueIdCalculate(
2020 p->second, (*fe_miit)->getFEUId()));
2021
2022 for (; miit != hi_miit; ++miit) {
2023
2024 if (verb >= VERBOSE)
2025 MOFEM_LOG("SELF", sev)
2026 << "Child finite element " << "(" << nn << "): " << **miit;
2027
2028 child_fe->nInTheLoop = nn++;
2029 child_fe->numeredEntFiniteElementPtr = *miit;
2030 CHKERR (*child_fe)();
2031 }
2032 }
2033 }
2034
2035 CHKERR child_fe->postProcess();
2036 }
2037
2039}
@ VERBOSE
virtual const FiniteElement_multiIndex * get_finite_elements() const =0
Get the finite elements object.
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
#define MOFEM_LOG(channel, severity)
Log.
const Problem * problemPtr
raw pointer to problem
boost::weak_ptr< CacheTuple > cacheWeakPtr
UId getLocalUniqueIdCalculate() const
Generate UId for finite element entity.

◆ loopParent()

MoFEMErrorCode ForcesAndSourcesCore::UserDataOperator::loopParent ( const string & fe_name,
ForcesAndSourcesCore * parent_fe,
const int verb = QUIET,
const LogManager::SeverityLevel sev = Sev::noisy )

User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations.

Parameters
fe_name
parent_fe
verb
sev
Returns
MoFEMErrorCode

Definition at line 1911 of file ForcesAndSourcesCore.cpp.

1913 {
1915
1916 auto &fes =
1917 ptrFE->mField.get_finite_elements()->get<FiniteElement_name_mi_tag>();
1918 auto fe_miit = fes.find(fe_name);
1919 if (fe_miit != fes.end()) {
1920
1921 const auto *problem_ptr = getFEMethod()->problemPtr;
1922 auto &numered_fe =
1923 problem_ptr->numeredFiniteElementsPtr->get<Unique_mi_tag>();
1924
1925 parent_fe->feName = fe_name;
1926 CHKERR parent_fe->setRefineFEPtr(ptrFE);
1927 CHKERR parent_fe->copyBasicMethod(*getFEMethod());
1928 CHKERR parent_fe->copyPetscData(*getFEMethod());
1929 CHKERR parent_fe->copyKsp(*getFEMethod());
1930 CHKERR parent_fe->copySnes(*getFEMethod());
1931 CHKERR parent_fe->copyTs(*getFEMethod());
1932
1933 parent_fe->cacheWeakPtr = getFEMethod()->cacheWeakPtr;
1934
1935 const auto parent_ent = getNumeredEntFiniteElementPtr()->getParentEnt();
1936 auto miit = numered_fe.find(EntFiniteElement::getLocalUniqueIdCalculate(
1937 parent_ent, (*fe_miit)->getFEUId()));
1938 if (miit != numered_fe.end()) {
1939 if (verb >= VERBOSE)
1940 MOFEM_LOG("SELF", sev) << "Parent finite element: " << **miit;
1941 parent_fe->loopSize = 1;
1942 parent_fe->nInTheLoop = 0;
1943 parent_fe->numeredEntFiniteElementPtr = *miit;
1944 CHKERR parent_fe->preProcess();
1945 CHKERR (*parent_fe)();
1946 CHKERR parent_fe->postProcess();
1947 } else {
1948 if (verb >= VERBOSE)
1949 MOFEM_LOG("SELF", sev) << "Parent finite element: no parent";
1950 parent_fe->loopSize = 0;
1951 parent_fe->nInTheLoop = 0;
1952 CHKERR parent_fe->preProcess();
1953 CHKERR parent_fe->postProcess();
1954 }
1955 }
1956
1958}
boost::shared_ptr< NumeredEntFiniteElement_multiIndex > numeredFiniteElementsPtr
store finite elements

◆ loopRange()

MoFEMErrorCode ForcesAndSourcesCore::UserDataOperator::loopRange ( const string & fe_name,
ForcesAndSourcesCore * range_fe,
boost::shared_ptr< Range > fe_range,
const int verb = QUIET,
const LogManager::SeverityLevel sev = Sev::noisy )

Iterate over range of elements.

Parameters
fe_name
range_fe
fe_range
verb
sev
Returns
* MoFEMErrorCode

Definition at line 2041 of file ForcesAndSourcesCore.cpp.

2044 {
2046
2047 auto &fes =
2048 ptrFE->mField.get_finite_elements()->get<FiniteElement_name_mi_tag>();
2049 auto fe_miit = fes.find(fe_name);
2050 if (fe_miit != fes.end()) {
2051
2052 const auto *problem_ptr = getFEMethod()->problemPtr;
2053 auto &numered_fe =
2054 problem_ptr->numeredFiniteElementsPtr->get<Unique_mi_tag>();
2055
2056 range_fe->feName = fe_name;
2057 CHKERR range_fe->setRefineFEPtr(ptrFE);
2058 CHKERR range_fe->copyBasicMethod(*getFEMethod());
2059 CHKERR range_fe->copyPetscData(*getFEMethod());
2060 CHKERR range_fe->copyKsp(*getFEMethod());
2061 CHKERR range_fe->copySnes(*getFEMethod());
2062 CHKERR range_fe->copyTs(*getFEMethod());
2063
2064 range_fe->cacheWeakPtr = getFEMethod()->cacheWeakPtr;
2065
2066 auto get_numered_fe_ptr = [&](auto &fe_uid, auto fe_range, auto execute) {
2068 if (fe_range) {
2069 int nn = 0;
2070 for (auto p = fe_range->pair_begin(); p != fe_range->pair_end(); ++p) {
2071 auto first = p->first;
2072 auto second = p->second;
2073 auto lo = numered_fe.lower_bound(
2075 auto hi = numered_fe.upper_bound(
2077 for (; lo != hi; ++lo) {
2078 CHKERR execute(lo, nn++);
2079 }
2080 }
2081 }
2083 };
2084
2085 auto execute = [&](auto lo, auto nn) {
2087 if (verb >= VERBOSE)
2088 MOFEM_LOG("SELF", sev) << "Range finite element: " << **lo;
2089 range_fe->nInTheLoop = nn;
2090 range_fe->numeredEntFiniteElementPtr = *lo;
2091 CHKERR range_fe->preProcess();
2092 CHKERR (*range_fe)();
2093 CHKERR range_fe->postProcess();
2095 };
2096
2097 CHKERR get_numered_fe_ptr((*fe_miit)->getFEUId(), fe_range, execute);
2098 }
2099
2101}

◆ loopSide()

MoFEMErrorCode ForcesAndSourcesCore::UserDataOperator::loopSide ( const string & fe_name,
ForcesAndSourcesCore * side_fe,
const size_t dim,
const EntityHandle ent_for_side = 0,
boost::shared_ptr< Range > fe_range = nullptr,
const int verb = QUIET,
const LogManager::SeverityLevel sev = Sev::noisy,
AdjCache * adj_cache = nullptr )

User calls this function to loop over elements on the side of face. This function calls finite element with its operator to do calculations.

Parameters
fe_namename of the side element
side_fepointer to the side element instance
dimdimension the of side element
ent_for_sideentity handle for which adjacent volume or face will be accessed
verb
sev
adj_cache
Returns
MoFEMErrorCode

Definition at line 1732 of file ForcesAndSourcesCore.cpp.

1735 {
1737
1738 const auto *problem_ptr = getFEMethod()->problemPtr;
1739 auto &numered_fe =
1740 problem_ptr->numeredFiniteElementsPtr->get<Unique_mi_tag>();
1741
1742 auto fe_miit = ptrFE->mField.get_finite_elements()
1743 ->get<FiniteElement_name_mi_tag>()
1744 .find(fe_name);
1745 if (fe_miit != ptrFE->mField.get_finite_elements()
1746 ->get<FiniteElement_name_mi_tag>()
1747 .end()) {
1748
1749 const auto ent = ent_for_side ? ent_for_side : getFEEntityHandle();
1750
1751 side_fe->feName = fe_name;
1752
1753 CHKERR side_fe->setSideFEPtr(ptrFE);
1754 CHKERR side_fe->copyBasicMethod(*getFEMethod());
1755 CHKERR side_fe->copyPetscData(*getFEMethod());
1756 CHKERR side_fe->copyKsp(*getFEMethod());
1757 CHKERR side_fe->copySnes(*getFEMethod());
1758 CHKERR side_fe->copyTs(*getFEMethod());
1759
1760 side_fe->cacheWeakPtr = getFEMethod()->cacheWeakPtr;
1761
1762 CHKERR side_fe->preProcess();
1763
1764 std::vector<boost::weak_ptr<NumeredEntFiniteElement>> fe_vec;
1765 auto get_numered_fe_ptr = [&](auto &fe_uid, Range &&adjacent_ents)
1766 -> std::vector<boost::weak_ptr<NumeredEntFiniteElement>> & {
1767 fe_vec.reserve(adjacent_ents.size());
1768 for (auto fe_ent : adjacent_ents) {
1769 auto miit = numered_fe.find(
1771 if (miit != numered_fe.end()) {
1772 fe_vec.emplace_back(*miit);
1773 }
1774 }
1775 return fe_vec;
1776 };
1777
1778 auto get_bit_entity_adjacency = [&]() {
1779 Range adjacent_ents;
1781 ptrFE->mField.getInterface<BitRefManager>()->getAdjacenciesAny(
1782 ent, side_dim, adjacent_ents),
1783 "getAdjacenciesAny failed");
1784 return adjacent_ents;
1785 };
1786
1787 auto get_bit_meshset_entities = [&]() {
1788 auto &bit = getFEMethod()->numeredEntFiniteElementPtr->getBitRefLevel();
1789 Range ents = *fe_range;
1791 ptrFE->mField.getInterface<BitRefManager>()->filterEntitiesByRefLevel(
1792 bit, BitRefLevel().set(), ents),
1793 "filterEntitiesByRefLevel failed");
1794 return ents;
1795 };
1796
1797 auto get_adj = [&](auto &fe_uid, auto get_adj_fun)
1798 -> std::vector<boost::weak_ptr<NumeredEntFiniteElement>> & {
1799 if (adj_cache) {
1800 try {
1801 return (*adj_cache).at(ent);
1802 } catch (const std::out_of_range &) {
1803 return (*adj_cache)[ent] = get_numered_fe_ptr(fe_uid, get_adj_fun());
1804 }
1805 } else {
1806 return get_numered_fe_ptr(fe_uid, get_adj_fun());
1807 }
1808 };
1809
1810 if (type_from_handle(ent) == MBENTITYSET) {
1811 if (!fe_range)
1812 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1813 "No range of finite elements");
1814 }
1815 auto adj = (!fe_range)
1816 ? get_adj((*fe_miit)->getFEUId(), get_bit_entity_adjacency)
1817 : get_adj((*fe_miit)->getFEUId(), get_bit_meshset_entities);
1818
1819 if (verb >= VERBOSE && !adj.empty())
1820 MOFEM_LOG("SELF", sev) << "Number of side finite elements " << adj.size();
1821
1822 int nn = 0;
1823 side_fe->loopSize = adj.size();
1824 for (auto fe_weak_ptr : adj) {
1825 if (auto fe_ptr = fe_weak_ptr.lock()) {
1826 if (verb >= VERBOSE)
1827 MOFEM_LOG("SELF", sev)
1828 << "Side finite element " << "(" << nn << "): " << *fe_ptr;
1829 side_fe->nInTheLoop = nn;
1830 side_fe->numeredEntFiniteElementPtr = fe_ptr;
1831 CHKERR (*side_fe)();
1832 }
1833 ++nn;
1834 }
1835
1836 CHKERR side_fe->postProcess();
1837 }
1838
1840}
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
auto bit
set bit
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

◆ loopThis()

MoFEMErrorCode ForcesAndSourcesCore::UserDataOperator::loopThis ( const string & fe_name,
ForcesAndSourcesCore * this_fe,
const int verb = QUIET,
const LogManager::SeverityLevel sev = Sev::noisy )

User calls this function to loop over the same element using a different set of integration points. This function calls finite element with its operator to do calculations.

Parameters
fe_name
this_fe
verb
sev
Returns
MoFEMErrorCode

Definition at line 1842 of file ForcesAndSourcesCore.cpp.

1844 {
1846
1847
1848
1849 auto &fes =
1850 ptrFE->mField.get_finite_elements()->get<FiniteElement_name_mi_tag>();
1851 auto fe_miit = fes.find(fe_name);
1852 if (fe_miit != fes.end()) {
1853
1854 this_fe->feName = fe_name;
1855
1856 CHKERR this_fe->setRefineFEPtr(ptrFE);
1857 CHKERR this_fe->copyBasicMethod(*getFEMethod());
1858 CHKERR this_fe->copyPetscData(*getFEMethod());
1859 CHKERR this_fe->copyKsp(*getFEMethod());
1860 CHKERR this_fe->copySnes(*getFEMethod());
1861 CHKERR this_fe->copyTs(*getFEMethod());
1862
1863 this_fe->cacheWeakPtr = getFEMethod()->cacheWeakPtr;
1864
1865 this_fe->nInTheLoop = getNinTheLoop();
1866 this_fe->loopSize = getLoopSize();
1867
1868 CHKERR this_fe->preProcess();
1869
1870 if (fe_name == getFEName()) {
1871
1872 if (verb >= VERBOSE)
1873 MOFEM_LOG("SELF", sev)
1874 << "This finite element: " << *getNumeredEntFiniteElementPtr();
1875
1876 this_fe->numeredEntFiniteElementPtr = getNumeredEntFiniteElementPtr();
1877 CHKERR (*this_fe)();
1878 } else {
1879
1880 auto get_numered_fe_ptr = [&](auto &fe_uid, auto fe_ent) {
1881 auto &numered_fe =
1882 getFEMethod()
1883 ->problemPtr->numeredFiniteElementsPtr->get<Unique_mi_tag>();
1884 auto it = numered_fe.find(
1886 boost::shared_ptr<const NumeredEntFiniteElement> this_numered_fe_ptr;
1887 if (it != numered_fe.end()) {
1888 this_numered_fe_ptr = *it;
1889 }
1890 return this_numered_fe_ptr;
1891 };
1892
1893 auto this_numered_fe_ptr = get_numered_fe_ptr(
1894 (*fe_miit)->getFEUId(), getNumeredEntFiniteElementPtr()->getEnt());
1895 if (this_numered_fe_ptr) {
1896
1897 if (verb >= VERBOSE)
1898 MOFEM_LOG("SELF", sev)
1899 << "This finite element: " << *this_numered_fe_ptr;
1900
1901 this_fe->numeredEntFiniteElementPtr = this_numered_fe_ptr;
1902 CHKERR (*this_fe)();
1903 }
1904 }
1905 CHKERR this_fe->postProcess();
1906 }
1907
1909}
int getLoopSize() const
get size of elements in the loop
int getNinTheLoop() const
get number of finite element in the loop
std::string getFEName() const
Get name of the element.

◆ setOpType()

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

Set operator type.

Parameters
Operatortype

Definition at line 1062 of file ForcesAndSourcesCore.hpp.

1062 {
1063 opType = type;
1064}

◆ setPtrFE()

MoFEMErrorCode ForcesAndSourcesCore::UserDataOperator::setPtrFE ( ForcesAndSourcesCore * ptr)
protectedvirtual

Reimplemented in MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator, MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator, MoFEM::FaceElementForcesAndSourcesCoreOnSide::UserDataOperator, MoFEM::FatPrismElementForcesAndSourcesCore::UserDataOperator, MoFEM::FlatPrismElementForcesAndSourcesCore::UserDataOperator, MoFEM::VertexElementForcesAndSourcesCore::UserDataOperator, MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator, and MoFEM::VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator.

Definition at line 2174 of file ForcesAndSourcesCore.cpp.

2174 {
2176 if (!(ptrFE = dynamic_cast<ForcesAndSourcesCore *>(ptr)))
2177 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2178 "User operator and finite element do not work together");
2180}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...

Friends And Related Symbol Documentation

◆ ContactPrismElementForcesAndSourcesCore

Definition at line 1007 of file ForcesAndSourcesCore.hpp.

◆ EdgeElementForcesAndSourcesCore

friend class EdgeElementForcesAndSourcesCore
friend

Definition at line 1005 of file ForcesAndSourcesCore.hpp.

◆ FaceElementForcesAndSourcesCore

friend class FaceElementForcesAndSourcesCore
friend

Definition at line 1006 of file ForcesAndSourcesCore.hpp.

◆ ForcesAndSourcesCore

friend class ForcesAndSourcesCore
friend

Definition at line 1004 of file ForcesAndSourcesCore.hpp.

Member Data Documentation

◆ colFieldName

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

Definition at line 575 of file ForcesAndSourcesCore.hpp.

◆ opType

char MoFEM::ForcesAndSourcesCore::UserDataOperator::opType

Definition at line 573 of file ForcesAndSourcesCore.hpp.

◆ OpTypeNames

const char *const ForcesAndSourcesCore::UserDataOperator::OpTypeNames
static
Initial value:
= {
"OPROW", " OPCOL", "OPROWCOL", "OPSPACE", "OPLAST"}

Definition at line 571 of file ForcesAndSourcesCore.hpp.

◆ ptrFE

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

Definition at line 999 of file ForcesAndSourcesCore.hpp.

◆ rowFieldName

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

Definition at line 574 of file ForcesAndSourcesCore.hpp.

◆ sPace

FieldSpace MoFEM::ForcesAndSourcesCore::UserDataOperator::sPace

Definition at line 576 of file ForcesAndSourcesCore.hpp.


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