19 #ifndef __LOOPMETHODS_HPP__
20 #define __LOOPMETHODS_HPP__
291 return (*field_it)->getBitNumber();
375 *iface =
const_cast<FEMethod *
>(
this);
388 boost::shared_ptr<const NumeredEntFiniteElement>
404 inline boost::shared_ptr<FieldEntity_vector_view> &
441 const bool reset_dofs =
true);
443 template <
class MULTIINDEX>
444 typename MULTIINDEX::iterator
get_begin(
const MULTIINDEX &index,
445 const std::string &field_name,
446 const EntityType
type)
const {
447 return index.lower_bound(boost::make_tuple(field_name,
type));
450 template <
class MULTIINDEX>
451 typename MULTIINDEX::iterator
get_end(
const MULTIINDEX &index,
452 const std::string &field_name,
453 const EntityType
type)
const {
454 return index.upper_bound(boost::make_tuple(field_name,
type));
460 #define _IT_GET_FEDATA_BY_TYPE_DOFS_FOR_LOOP_(FE, NAME, TYPE, IT) \
461 auto IT = FE->get_begin<FEDofEntityByNameAndEnt>( \
462 FE->dataPtr->get<FEDofEntityByNameAndEnt>(), NAME, \
463 get_id_for_min_type(TYPE)); \
464 IT != FE->get_end<FEDofEntityByNameAndEnt>( \
465 FE->dataPtr->get<FEDofEntityByNameAndEnt>(), NAME, \
466 get_id_for_max_type(TYPE)); \
469 template <
class MULTIINDEX>
470 typename MULTIINDEX::iterator
get_begin(
const MULTIINDEX &index,
471 const std::string &field_name)
const {
472 return index.lower_bound(field_name);
474 template <
class MULTIINDEX>
475 typename MULTIINDEX::iterator
get_end(
const MULTIINDEX &index,
476 const std::string &field_name)
const {
477 return index.upper_bound(field_name);
483 #define _IT_GET_FEROW_BY_NAME_DOFS_FOR_LOOP_(FE, NAME, IT) \
484 auto IT = FE->get_begin<FENumeredDofEntityByUId>( \
485 FE->getRowDofs().get<Unique_mi_tag>(), \
486 FieldEntity::getLoBitNumberUId(FE->getFieldBitNumber(NAME))); \
487 IT != FE->get_end<FENumeredDofEntityByUId>( \
488 FE->getRowDofs()->get<Unique_mi_tag>(), \
489 FieldEntity::getHiBitNumberUId(FE->getFieldBitNumber(NAME))); \
495 #define _IT_GET_FECOL_BY_NAME_DOFS_FOR_LOOP_(FE, NAME, IT) \
496 auto IT = FE->get_begin<FENumeredDofEntityByUId>( \
497 FE->getColDofs().get<Unique_mi_tag>(), \
498 FieldEntity::getLoBitNumberUId(FE->getFieldBitNumber(NAME))); \
499 IT != FE->get_end<FENumeredDofEntityByUId>( \
500 FE->getColDofs()->get<Unique_mi_tag>(), \
501 FieldEntity::getHiBitNumberUId(FE->getFieldBitNumber(NAME))); \
507 #define _IT_GET_FEDATA_BY_NAME_DOFS_FOR_LOOP_(FE, NAME, IT) \
508 auto IT = FE->get_begin<FEDofEntityByUId>( \
509 FE->dataPtr->get<Unique_mi_tag>(), \
510 FieldEntity::getLoBitNumberUId(FE->getFieldBitNumber(NAME))); \
511 IT != FE->get_end<FEDofEntityByUId>( \
512 FE->dataPtr->get<Unique_mi_tag>(), \
513 FieldEntity::getHiBitNumberUId(FE->getFieldBitNumber(NAME))); \
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
Field_multiIndex for Field.
#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 CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#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(a)
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< 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
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
MultiIndex container keeps FieldEntity.
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< 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 > >, ordered_non_unique< tag< FiniteElement_name_mi_tag >, const_mem_fun< EntFiniteElement::interface_type_FiniteElement, boost::string_ref, &EntFiniteElement::getNameRef > >, ordered_non_unique< tag< Composite_Name_And_Ent_mi_tag >, composite_key< EntFiniteElement, const_mem_fun< EntFiniteElement::interface_type_FiniteElement, boost::string_ref, &EntFiniteElement::getNameRef >, 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.
const FTensor::Tensor2< T, Dim, Dim > Vec
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITINTERFACEUID_SIZE > BitIntefaceId
ublas::vector< double, DoubleAllocator > VectorDouble
implementation of Data Operators for Forces and Sources
DEPRECATED typedef DofMethod EntMethod
static const MOFEMuuid IDD_MOFEMSnesMethod
static const MOFEMuuid IDD_MOFEMKspMethod
static const MOFEMuuid IDD_MOFEMDofMethod
static const MOFEMuuid IDD_MOFEMTsMethod
static const MOFEMuuid IDD_MOFEMPetscDataMethod
static const MOFEMuuid IDD_MOFEMFEMethod
std::vector< boost::weak_ptr< FieldEntity > > FieldEntity_vector_view
static const MOFEMuuid IDD_MOFEMBasicMethod
static const MOFEMuuid IDD_MOFEMEntityMethod
Data structure to exchange data between mofem and User Loop Methods.
int loopSize
local number oe methods to process
boost::movelib::unique_ptr< bool > matAssembleSwitch
const FieldEntity_multiIndex * entitiesPtr
raw pointer to container of field entities
unsigned int getFieldBitNumber(std::string field_name) const
virtual ~BasicMethod()=default
MoFEMErrorCode copyBasicMethod(const BasicMethod &basic)
Copy data from other base method to this base method.
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
const FiniteElement_multiIndex * finiteElementsPtr
raw pointer to container finite elements
const RefElement_multiIndex * refinedFiniteElementsPtr
container of mofem finite element entities
int getLoopSize() const
get loop size
boost::function< MoFEMErrorCode()> preProcessHook
Hook function for pre-processing.
const DofEntity_multiIndex * dofsPtr
raw pointer container of dofs
const Field_multiIndex * fieldsPtr
raw pointer to fields container
int nInTheLoop
number currently of processed method
const RefEntity_multiIndex * refinedEntitiesPtr
container of mofem dof entities
boost::movelib::unique_ptr< bool > vecAssembleSwitch
virtual MoFEMErrorCode postProcess()
function is run at the end of loop
const FieldEntityEntFiniteElementAdjacencyMap_multiIndex * adjacenciesPtr
virtual MoFEMErrorCode operator()()
function is run for every finite element
virtual MoFEMErrorCode preProcess()
function is run at the beginning of loop
const EntFiniteElement_multiIndex * finiteElementsEntitiesPtr
const Problem * problemPtr
raw pointer to problem
boost::function< MoFEMErrorCode()> operatorHook
Hook function for operator.
int sIze
number of processors in communicator
int getNinTheLoop() const
get number of evaluated element in the loop
boost::function< MoFEMErrorCode()> postProcessHook
Hook function for post-processing.
Data structure to exchange data between mofem and User Loop Methods on entities.
boost::shared_ptr< DofEntity > dofPtr
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
boost::shared_ptr< NumeredDofEntity > dofNumeredPtr
boost::shared_ptr< Field > fieldPtr
Data structure to exchange data between mofem and User Loop Methods on entities.
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
boost::shared_ptr< Field > fieldPtr
boost::shared_ptr< FieldEntity > entPtr
structure for User Loop Methods on finite elements
std::string feName
Name of finite element.
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
MULTIINDEX::iterator get_begin(const MULTIINDEX &index, const std::string &field_name, const EntityType type) const
MULTIINDEX::iterator get_begin(const MULTIINDEX &index, const std::string &field_name) const
MoFEMErrorCode getNodeData(const std::string field_name, VectorDouble &data, const bool reset_dofs=true)
auto getDataDofsPtr() const
auto & getColFieldEntsPtr() const
MoFEMErrorCode getNumberOfNodes(int &num_nodes) const
Get number of DOFs on element.
auto getDataVectorDofsPtr() const
MULTIINDEX::iterator get_end(const MULTIINDEX &index, const std::string &field_name, const EntityType type) const
auto & getColFieldEnts() const
auto getColDofsPtr() const
EntityHandle getFEEntityHandle() const
MULTIINDEX::iterator get_end(const MULTIINDEX &index, const std::string &field_name) const
const FieldEntity_vector_view & getDataFieldEnts() const
boost::shared_ptr< FieldEntity_vector_view > & getDataFieldEntsPtr() const
auto & getRowFieldEntsPtr() const
auto getRowDofsPtr() const
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
auto & getRowFieldEnts() const
MultiIndex Tag for field name.
data structure for ksp (linear solver) context
MoFEMErrorCode copyKsp(const KspMethod &ksp)
copy data form another method
KSPContext ksp_ctx
Context.
virtual ~KspMethod()=default
KSPContext
pass information about context of KSP/DM for with finite element is computed
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
MoFEM interface unique ID.
Partitioned (Indexed) Finite Element in Problem.
static constexpr Switches CtxSetA
static constexpr Switches CtxSetX
static constexpr Switches CtxSetX_TT
static constexpr Switches CtxSetNone
static constexpr Switches CtxSetF
std::bitset< 8 > Switches
virtual ~PetscData()=default
static constexpr Switches CtxSetX_T
static constexpr Switches CtxSetB
static constexpr Switches CtxSetTime
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
keeps basic data about problem
data structure for snes (nonlinear solver) context
MoFEMErrorCode copySnes(const SnesMethod &snes)
Copy snes data.
DEPRECATED MoFEMErrorCode setSnesCtx(SNESContext ctx)
virtual ~SnesMethod()=default
Mat & snes_B
preconditioner of jacobian matrix
Mat & snes_A
jacobian matrix
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
data structure for TS (time stepping) context
Vec & ts_F
residual vector
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
Vec & ts_u_tt
second time derivative of state vector
PetscReal ts_a
shift for U_t (see PETSc Time Solver)
Vec & ts_u_t
time derivative of state vector
PetscInt ts_step
time step
virtual ~TSMethod()=default
PetscReal ts_aa
shift for U_tt shift for U_tt
MoFEMErrorCode copyTs(const TSMethod &ts)
Copy TS solver data.
DEPRECATED MoFEMErrorCode setTsCtx(TSContext ctx)
Mat & ts_B
Preconditioner for ts_A.
base class for all interface classes