53#ifndef __LOOPMETHODS_HPP__
54#define __LOOPMETHODS_HPP__
528 return (*field_it)->getBitNumber();
675 *iface =
const_cast<FEMethod *
>(
this);
686 boost::shared_ptr<const NumeredEntFiniteElement>
743 inline boost::shared_ptr<FieldEntity_vector_view> &
840 const bool reset_dofs =
true);
multi_index_container< FieldEntityEntFiniteElementAdjacencyMap, indexed_by< ordered_unique< tag< Composite_Unique_mi_tag >, composite_key< FieldEntityEntFiniteElementAdjacencyMap, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, UId, &FieldEntityEntFiniteElementAdjacencyMap::getEntUniqueId >, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, UId, &FieldEntityEntFiniteElementAdjacencyMap::getFeUniqueId > > >, ordered_non_unique< tag< Unique_mi_tag >, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, UId, &FieldEntityEntFiniteElementAdjacencyMap::getEntUniqueId > >, ordered_non_unique< tag< FE_Unique_mi_tag >, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, UId, &FieldEntityEntFiniteElementAdjacencyMap::getFeUniqueId > >, ordered_non_unique< tag< FEEnt_mi_tag >, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, EntityHandle, &FieldEntityEntFiniteElementAdjacencyMap::getFeHandle > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, EntityHandle, &FieldEntityEntFiniteElementAdjacencyMap::getEntHandle > > > > FieldEntityEntFiniteElementAdjacencyMap_multiIndex
MultiIndex container keeps Adjacencies Element and dof entities adjacencies and vice versa.
multi_index_container< boost::shared_ptr< Field >, indexed_by< hashed_unique< tag< BitFieldId_mi_tag >, const_mem_fun< Field, const BitFieldId &, &Field::getId >, HashBit< BitFieldId >, EqBit< BitFieldId > >, ordered_unique< tag< Meshset_mi_tag >, member< Field, EntityHandle, &Field::meshSet > >, ordered_unique< tag< FieldName_mi_tag >, const_mem_fun< Field, boost::string_ref, &Field::getNameRef > >, ordered_non_unique< tag< BitFieldId_space_mi_tag >, const_mem_fun< Field, FieldSpace, &Field::getSpace > > > > Field_multiIndex
Multi-index container for field storage and retrieval.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(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 ...
#define BITFEID_SIZE
max number of finite elements
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
multi_index_container< boost::shared_ptr< DofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< DofEntity, UId, &DofEntity::getLocalUniqueId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt > > > > DofEntity_multiIndex
MultiIndex container keeps DofEntity.
multi_index_container< boost::shared_ptr< EntFiniteElement >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< EntFiniteElement, UId, &EntFiniteElement::getLocalUniqueId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< EntFiniteElement::interface_type_RefEntity, EntityHandle, &EntFiniteElement::getEnt > > > > EntFiniteElement_multiIndex
MultiIndex container for EntFiniteElement.
multi_index_container< boost::shared_ptr< FiniteElement >, indexed_by< hashed_unique< tag< FiniteElement_Meshset_mi_tag >, member< FiniteElement, EntityHandle, &FiniteElement::meshset > >, hashed_unique< tag< BitFEId_mi_tag >, const_mem_fun< FiniteElement, BitFEId, &FiniteElement::getId >, HashBit< BitFEId >, EqBit< BitFEId > >, ordered_unique< tag< FiniteElement_name_mi_tag >, const_mem_fun< FiniteElement, boost::string_ref, &FiniteElement::getNameRef > > > > FiniteElement_multiIndex
MultiIndex for entities for FiniteElement.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
UBlasVector< double > VectorDouble
implementation of Data Operators for Forces and Sources
DEPRECATED typedef DofMethod EntMethod
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getEnt > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > > >, ordered_non_unique< tag< Composite_ParentEnt_And_EntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
std::vector< boost::weak_ptr< FieldEntity > > FieldEntity_vector_view
Field_multiIndex::index< FieldName_mi_tag >::type::iterator field_it
multi_index_container< boost::shared_ptr< RefElement >, indexed_by< ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefElement::interface_type_RefEntity, EntityHandle, &RefElement::getEnt > > > > RefElement_multiIndex
multi_index_container< boost::shared_ptr< FieldEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, member< FieldEntity, UId, &FieldEntity::localUId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FieldEntity::interface_type_RefEntity, EntityHandle, &FieldEntity::getEnt > > > > FieldEntity_multiIndex
constexpr auto field_name
Data structure to exchange data between MoFEM and User Loop Methods.
int loopSize
Total number of methods to process in the loop.
boost::movelib::unique_ptr< bool > matAssembleSwitch
Switch for matrix assembly operations.
const FieldEntity_multiIndex * entitiesPtr
Raw pointer to container of field entities.
BasicMethod()
Default constructor.
unsigned int getFieldBitNumber(std::string field_name) const
Get bit number for a specific field by name.
virtual ~BasicMethod()=default
Virtual destructor.
MoFEMErrorCode copyBasicMethod(const BasicMethod &basic)
Copy data from another BasicMethod instance.
auto getHiFERank() const
Get upper processor rank for finite element iteration.
const FiniteElement_multiIndex * finiteElementsPtr
Raw pointer to container of finite elements.
const RefElement_multiIndex * refinedFiniteElementsPtr
Pointer to container of refined finite element entities.
int getLoopSize() const
Get total loop size.
std::pair< int, int > loHiFERank
Processor rank range for distributed finite element iteration.
boost::function< MoFEMErrorCode()> preProcessHook
Hook function for pre-processing operations.
const DofEntity_multiIndex * dofsPtr
Raw pointer to container of degree of freedom entities.
int rAnk
Current processor rank in MPI communicator.
boost::weak_ptr< CacheTuple > getCacheWeakPtr() const
Get the cache weak pointer object.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Query interface for type casting.
const Field_multiIndex * fieldsPtr
Raw pointer to fields multi-index container.
int nInTheLoop
Current index of processed method in the loop.
auto getLoHiFERank() const
Get processor rank range for finite element iteration.
const RefEntity_multiIndex * refinedEntitiesPtr
Pointer to container of refined MoFEM DOF entities.
boost::movelib::unique_ptr< bool > vecAssembleSwitch
Switch for vector assembly operations.
virtual MoFEMErrorCode postProcess()
Post-processing function executed at loop completion.
const FieldEntityEntFiniteElementAdjacencyMap_multiIndex * adjacenciesPtr
Raw pointer to container of adjacencies between DOFs and finite elements.
virtual MoFEMErrorCode operator()()
Main operator function executed for each loop iteration.
virtual MoFEMErrorCode preProcess()
Pre-processing function executed at loop initialization.
const EntFiniteElement_multiIndex * finiteElementsEntitiesPtr
Raw pointer to container of finite element entities.
const Problem * problemPtr
Raw pointer to current MoFEM problem instance.
auto getLoFERank() const
Get lower processor rank for finite element iteration.
boost::function< MoFEMErrorCode()> operatorHook
Hook function for main operator execution.
int sIze
Total number of processors in MPI communicator.
boost::weak_ptr< CacheTuple > cacheWeakPtr
Weak pointer to cached entity data.
int getNinTheLoop() const
Get current loop iteration index.
boost::function< MoFEMErrorCode()> postProcessHook
Hook function for post-processing operations.
Data structure for user loop methods on degrees of freedom (DOFs)
boost::shared_ptr< DofEntity > dofPtr
Shared pointer to DOF entity data.
DofMethod()=default
Default constructor.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Query interface for type casting.
boost::shared_ptr< NumeredDofEntity > dofNumeredPtr
Shared pointer to numbered DOF entity data.
boost::shared_ptr< Field > fieldPtr
Shared pointer to field information.
Data structure for user loop methods on entities.
EntityMethod()=default
Default constructor.
boost::shared_ptr< Field > fieldPtr
Shared pointer to field information.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Query interface for type casting.
boost::shared_ptr< FieldEntity > entPtr
Shared pointer to field entity data.
Structure for user loop methods on finite elements.
std::string feName
Name of the finite element being processed.
auto & getColFieldEntsPtr() const
Get shared pointer to column field entities for the current finite element.
FEMethod()=default
Default constructor.
auto & getRowFieldEnts() const
Get reference to row field entities for the current finite element.
auto getFEName() const
Get the name of the current finite element.
MoFEMErrorCode getNodeData(const std::string field_name, VectorDouble &data, const bool reset_dofs=true)
Get nodal data for a specific field.
auto getDataDofsPtr() const
Get pointer to DOF data for the current finite element.
const FieldEntity_vector_view & getDataFieldEnts() const
Get reference to data field entities for the current finite element.
auto getDataVectorDofsPtr() const
Get pointer to vector DOF data for the current finite element.
boost::shared_ptr< FieldEntity_vector_view > & getDataFieldEntsPtr() const
Get shared pointer to data field entities for the current finite element.
auto getColDofsPtr() const
Get pointer to column DOFs for the current finite element.
EntityHandle getFEEntityHandle() const
Get the entity handle of the current finite element.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Query interface for type casting.
auto & getRowFieldEntsPtr() const
Get shared pointer to row field entities for the current finite element.
auto getNumberOfNodes() const
Get the number of nodes in the current finite element.
auto getRowDofsPtr() const
Get pointer to row DOFs for the current finite element.
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
Shared pointer to finite element database structure.
auto & getColFieldEnts() const
Get reference to column field entities for the current finite element.
boost::function< bool(FEMethod *fe_method_ptr)> exeTestHook
Test function to determine if element should be skipped.
MultiIndex Tag for field name.
Data structure for KSP (linear solver) context.
MoFEMErrorCode copyKsp(const KspMethod &ksp)
Copy data from another KSP method.
Mat & ksp_B
Reference to preconditioner matrix in KSP context.
KSPContext ksp_ctx
Current KSP computation context.
virtual ~KspMethod()=default
Virtual destructor.
KSPContext
Context enumeration for KSP solver phases.
@ CTX_KSPNONE
No specific KSP context.
@ CTX_SETFUNCTION
Setting up the linear system function.
@ CTX_OPERATORS
Setting up linear operators.
KspMethod()
Default constructor.
KSP ksp
PETSc KSP linear solver object.
Mat & ksp_A
Reference to system matrix in KSP context.
Vec & ksp_f
Reference to residual vector in KSP context.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Query interface for type casting.
Partitioned (Indexed) Finite Element in Problem.
Base data structure for PETSc-related contexts.
static constexpr Switches CtxSetA
Jacobian matrix switch.
static constexpr Switches CtxSetX
Solution vector switch.
Vec f
PETSc residual vector.
static constexpr Switches CtxSetX_TT
Second time derivative switch.
static constexpr Switches CtxSetNone
No data switch.
static constexpr Switches CtxSetF
Residual vector switch.
Vec x_t
PETSc first time derivative vector.
std::bitset< 8 > Switches
Bitset type for context switches.
virtual ~PetscData()=default
Virtual destructor.
Vec x_tt
PETSc second time derivative vector.
Vec dx
PETSc solution increment vector.
Switches data_ctx
Current data context switches.
static constexpr Switches CtxSetDX
Solution increment switch.
static constexpr Switches CtxSetX_T
First time derivative switch.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Query interface for type casting.
DataContext
Enumeration for data context flags.
@ CTX_SET_NONE
No data set.
@ CTX_SET_X_T
Time derivative X_t is set.
@ CTX_SET_A
Jacobian matrix A is set.
@ CTX_SET_TIME
Time value is set.
@ CTX_SET_DX
Solution increment DX is set.
@ CTX_SET_X
Solution vector X is set.
@ CTX_SET_F
Residual vector F is set.
@ CTX_SET_X_TT
Second time derivative X_tt is set.
@ CTX_SET_B
Preconditioner matrix B is set.
Vec x
PETSc solution vector.
Mat B
PETSc preconditioner matrix.
static constexpr Switches CtxSetB
Preconditioner matrix switch.
PetscData()
Default constructor.
static constexpr Switches CtxSetTime
Time value switch.
MoFEMErrorCode copyPetscData(const PetscData &petsc_data)
Copy PETSc data from another instance.
Mat A
PETSc Jacobian matrix.
keeps basic data about problem
Data structure for SNES (nonlinear solver) context.
SNESContext
Context enumeration for SNES solver phases.
@ CTX_SNESSETJACOBIAN
Setting up Jacobian matrix computation.
@ CTX_SNESSETFUNCTION
Setting up nonlinear function evaluation.
@ CTX_SNESNONE
No specific SNES context.
MoFEMErrorCode copySnes(const SnesMethod &snes)
Copy SNES data from another instance.
Vec & snes_f
Reference to residual vector.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Query interface for type casting.
Vec & snes_x
Reference to current solution state vector.
SnesMethod()
Default constructor.
virtual ~SnesMethod()=default
Virtual destructor.
Vec & snes_dx
Reference to solution update/increment vector.
Mat & snes_B
Reference to preconditioner of Jacobian matrix.
SNESContext snes_ctx
Current SNES computation context.
Mat & snes_A
Reference to Jacobian matrix.
SNES snes
PETSc SNES nonlinear solver object.
Data structure for TS (time stepping) context.
TS ts
PETSc time stepping solver object.
TSContext
Context enumeration for TS solver phases.
@ CTX_TSSETIFUNCTION
Setting up implicit function.
@ CTX_TSSETRHSFUNCTION
Setting up right-hand side function.
@ CTX_TSSETRHSJACOBIAN
Setting up right-hand side Jacobian.
@ CTX_TSTSMONITORSET
Setting up time step monitoring.
@ CTX_TSSETIJACOBIAN
Setting up implicit Jacobian.
@ CTX_TSNONE
No specific TS context.
TSMethod()
Default constructor.
PetscReal ts_t
Current time value.
Mat & ts_A
Reference to Jacobian matrix: dF/dU + a*dF/dU_t + aa*dF/dU_tt.
Vec & ts_F
Reference to residual vector F(t,U,U_t,U_tt)
PetscReal ts_dt
Current time step size.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Query interface for type casting.
Vec & ts_u_tt
Reference to second time derivative of state vector d²U/dt²
TSContext ts_ctx
Current TS computation context.
PetscReal ts_a
Shift parameter for U_t (see PETSc Time Solver documentation)
Vec & ts_u_t
Reference to first time derivative of state vector dU/dt.
PetscInt ts_step
Current time step number.
Vec & ts_u
Reference to current state vector U(t)
virtual ~TSMethod()=default
Virtual destructor.
PetscReal ts_aa
Shift parameter for U_tt (second time derivative)
MoFEMErrorCode copyTs(const TSMethod &ts)
Copy TS solver data from another instance.
Mat & ts_B
Reference to preconditioner matrix for ts_A.
Data structure for TAO (optimization) context.
Mat & tao_B
Reference to preconditioner matrix for Hessian.
TAOContext tao_ctx
Current TAO computation context.
virtual ~TaoMethod()=default
Virtual destructor.
Tao tao
PETSc TAO optimization solver object.
Mat & tao_A
Reference to Hessian matrix.
TaoMethod()
Default constructor.
TAOContext
Context enumeration for TAO solver phases.
@ CTX_TAO_HESSIAN
Assembling Hessian matrix.
@ CTX_TAO_NONE
No specific TAO context.
@ CTX_TAO_GRADIENT
Computing gradient vector.
@ CTX_TAO_OBJECTIVE
Evaluating objective function.
MoFEMErrorCode copyTao(const TaoMethod &tao)
Copy TAO data from another instance.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Query interface for type casting.
Vec & tao_x
Reference to optimization variables vector.
Vec & tao_f
Reference to gradient vector.
base class for all interface classes