8#ifndef __FEMMULTIINDICES_HPP__
9#define __FEMMULTIINDICES_HPP__
13struct EntFiniteElement;
20 std::vector<EntityHandle> &adjacency)>;
132 std::vector<EntityHandle> &adjacency);
135 std::vector<EntityHandle> &adjacency);
138 std::vector<EntityHandle> &adjacency);
141 std::vector<EntityHandle> &adjacency);
144 std::vector<EntityHandle> &adjacency);
147 std::vector<EntityHandle> &adjacency);
287 static constexpr std::array<const DefEntTypeMap *, MBMAXTYPE>
defTypeMap = {
307 return (*ptr)[ent_type];
308 THROW_MESSAGE(
"DefTypeMap is not defined by this element. This is propably "
309 "new implementation, and has to be implemented");
318template <
typename FE,
typename REFENT>
322 const boost::shared_ptr<REFENT> ref_ents_ptr)
327template <
typename FE,
typename REFENT>
330 const boost::shared_ptr<REFENT> ref_ents_ptr)
409 const boost::shared_ptr<T> ref_ents_ptr)
475 ->getFiniteElementPtr();
480 std::array<DofEntity_multiIndex::iterator, 2>
loHi;
484 std::array<NumeredDofEntity_multiIndex::iterator, 2>
loHi;
489 std::vector<EntityCacheDofs>, std::vector<EntityCacheNumeredDofs>,
490 std::vector<EntityCacheNumeredDofs>
510 const boost::shared_ptr<FiniteElement> &fe_ptr);
521 return fe_uid |= ent;
545 boost::shared_ptr<std::vector<boost::shared_ptr<FEDofEntity>>>
552 inline boost::shared_ptr<FieldEntity_vector_view> &
562 inline boost::shared_ptr<FieldEntity_vector_view> &
572 inline boost::shared_ptr<FieldEntity_vector_view> &
580 template <
typename FE_ENTS,
typename MOFEM_DOFS,
typename MOFEM_DOFS_VIEW,
583 getDofView(
const FE_ENTS &fe_ents_view,
const MOFEM_DOFS &mofem_dofs,
584 MOFEM_DOFS_VIEW &dofs_view, INSERTER &&inserter) {
587 auto hint = dofs_view.end();
588 using ValType =
typename std::remove_reference<
decltype(**hint)>::type;
590 for (
auto &it : fe_ents_view) {
591 if (
auto e = it.lock()) {
592 const auto &uid = e->getLocalUniqueId();
593 auto dit = mofem_dofs.lower_bound(uid);
594 if (dit != mofem_dofs.end()) {
595 const auto hi_dit = mofem_dofs.upper_bound(
597 for (; dit != hi_dit; ++dit)
598 hint = inserter(dofs_view, hint,
599 boost::reinterpret_pointer_cast<ValType>(*dit));
606 template <
typename MOFEM_DOFS,
typename MOFEM_DOFS_VIEW>
608 MOFEM_DOFS_VIEW &dofs_view) {
610 auto hint = dofs_view.end();
611 using ValType =
typename std::remove_reference<
decltype(**hint)>::type;
612 using IndexType = MOFEM_DOFS_VIEW;
615 using Idx = IndexType;
616 using It =
typename Idx::iterator;
617 It operator()(Idx &dofs_view, It &hint,
618 boost::shared_ptr<ValType> &&dof) {
619 return dofs_view.emplace_hint(hint, dof);
626 template <
typename MOFEM_DOFS,
typename MOFEM_DOFS_VIEW>
629 const int operation_type = moab::Interface::UNION) {
631 auto hint = dofs_view.end();
632 using ValType =
typename std::remove_reference<
decltype(**hint)>::type;
633 using IndexType = MOFEM_DOFS_VIEW;
636 using Idx = IndexType;
637 using It =
typename Idx::iterator;
638 It operator()(Idx &dofs_view, It &hint,
639 boost::shared_ptr<ValType> &&dof) {
640 return dofs_view.emplace_hint(hint, dof);
648 std::vector<EntityHandle> &adjacency);
670 return this->
sPtr->getDataVectorDofsPtr();
674 return this->
sPtr->getDataFieldEnts();
678 return this->
sPtr->getDataFieldEntsPtr();
682 return this->
sPtr->getRowFieldEnts();
685 inline boost::shared_ptr<FieldEntity_vector_view> &
687 return this->
sPtr->getRowFieldEntsPtr();
691 return this->
sPtr->getColFieldEnts();
694 inline boost::shared_ptr<FieldEntity_vector_view> &
696 return this->
sPtr->getColFieldEntsPtr();
706 return this->
sPtr->getSideNumberTable();
715 return this->
sPtr->getRefElement();
758 boost::shared_ptr<FENumeredDofEntity_multiIndex>
getRowDofsPtr()
const;
763 boost::shared_ptr<FENumeredDofEntity_multiIndex>
getColDofsPtr()
const;
768 boost::weak_ptr<FENumeredDofEntity>
774 boost::weak_ptr<FENumeredDofEntity>
777 friend std::ostream &
operator<<(std::ostream &os,
788 boost::shared_ptr<EntFiniteElement>,
791 ordered_unique<tag<Unique_mi_tag>,
792 const_mem_fun<EntFiniteElement,
UId,
808 boost::shared_ptr<NumeredEntFiniteElement>,
815 ordered_non_unique<tag<Part_mi_tag>,
816 member<NumeredEntFiniteElement,
unsigned int,
823 tag<Composite_Name_And_Part_mi_tag>,
825 NumeredEntFiniteElement,
829 member<NumeredEntFiniteElement,
unsigned int,
837typedef multi_index_container<
838 boost::shared_ptr<FiniteElement>,
839 indexed_by<hashed_unique<tag<FiniteElement_Meshset_mi_tag>,
844 const_mem_fun<FiniteElement, BitFEId, &FiniteElement::getId>,
845 HashBit<BitFEId>, EqBit<BitFEId>>,
846 ordered_unique<tag<FiniteElement_name_mi_tag>,
847 const_mem_fun<FiniteElement, boost::string_ref,
861 void operator()(boost::shared_ptr<NumeredEntFiniteElement> &fe) {
876 void operator()(boost::shared_ptr<FiniteElement> &fe);
888 void operator()(boost::shared_ptr<FiniteElement> &fe);
900 void operator()(boost::shared_ptr<FiniteElement> &fe);
912 void operator()(boost::shared_ptr<FiniteElement> &fe);
924 void operator()(boost::shared_ptr<FiniteElement> &fe);
936 void operator()(boost::shared_ptr<FiniteElement> &fe);
946 void operator()(boost::shared_ptr<FiniteElement> &fe);
956 void operator()(boost::shared_ptr<FiniteElement> &fe);
966 void operator()(boost::shared_ptr<FiniteElement> &fe);
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
#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 ...
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< ordered_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, signed char, &SideNumber::side_number > > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
multi_index_container< boost::shared_ptr< NumeredEntFiniteElement >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< NumeredEntFiniteElement::interface_type_EntFiniteElement, UId, &NumeredEntFiniteElement::getLocalUniqueId > >, ordered_non_unique< tag< Part_mi_tag >, member< NumeredEntFiniteElement, unsigned int, &NumeredEntFiniteElement::part > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< NumeredEntFiniteElement::interface_type_RefEntity, EntityHandle, &NumeredEntFiniteElement::getEnt > >, ordered_non_unique< tag< Composite_Name_And_Part_mi_tag >, composite_key< NumeredEntFiniteElement, const_mem_fun< NumeredEntFiniteElement::interface_type_FiniteElement, boost::string_ref, &NumeredEntFiniteElement::getNameRef >, member< NumeredEntFiniteElement, unsigned int, &NumeredEntFiniteElement::part > > > > > NumeredEntFiniteElement_multiIndex
MultiIndex for entities for NumeredEntFiniteElement.
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.
boost::function< MoFEMErrorCode(Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)> ElementAdjacencyFunct
user adjacency function
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.
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
implementation of Data Operators for Forces and Sources
std::vector< boost::weak_ptr< FieldEntity > > FieldEntity_vector_view
boost::shared_ptr< CacheTuple > CacheTupleSharedPtr
boost::weak_ptr< CacheTuple > CacheTupleWeakPtr
std::tuple< std::vector< EntityCacheDofs >, std::vector< EntityCacheNumeredDofs >, std::vector< EntityCacheNumeredDofs > > CacheTuple
static constexpr DefEntTypeMap defVertexTypeMap
static constexpr DefEntTypeMap defEdgeTypeMap
std::array< bool, MBMAXTYPE > DefEntTypeMap
static constexpr DefEntTypeMap defQuadTypeMap
static bool getDefTypeMap(const EntityType fe_type, const EntityType ent_type)
static constexpr DefEntTypeMap defTriTypeMap
static MoFEMErrorCode defaultMeshset(Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
static MoFEMErrorCode defaultVertex(Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
static MoFEMErrorCode defaultVolume(Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
static constexpr std::array< const DefEntTypeMap *, MBMAXTYPE > defTypeMap
static constexpr DefEntTypeMap defTetTypeMap
static constexpr DefEntTypeMap defHexTypeMap
static constexpr DefEntTypeMap defMeshsetTypeMap
static MoFEMErrorCode defaultEdge(Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
static MoFEMErrorCode defaultPrism(Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
static MoFEMErrorCode defaultFace(Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
static constexpr DefEntTypeMap defPrismTypeMap
Deprecated interface functions.
Finite element data for entity.
UId getLocalUniqueIdCalculate() const
Generate UId for finite element entity.
friend std::ostream & operator<<(std::ostream &os, const EntFiniteElement &e)
boost::shared_ptr< std::vector< boost::shared_ptr< FEDofEntity > > > getDataVectorDofsPtr() const
Get data data dos multi-index structure.
boost::shared_ptr< FieldEntity_vector_view > & getDataFieldEntsPtr() const
boost::shared_ptr< FieldEntity_vector_view > dataFieldEnts
boost::shared_ptr< FEDofEntity_multiIndex > getDataDofsPtr() const
Get the Data Dofs Ptr object.
boost::shared_ptr< FieldEntity_vector_view > & getColFieldEntsPtr() const
FieldEntity_vector_view & getRowFieldEnts() const
static MoFEMErrorCode getDofView(const FE_ENTS &fe_ents_view, const MOFEM_DOFS &mofem_dofs, MOFEM_DOFS_VIEW &dofs_view, INSERTER &&inserter)
static UId getLocalUniqueIdCalculate(const EntityHandle ent, UId fe_uid)
MoFEMErrorCode getColDofView(const MOFEM_DOFS &mofem_dofs, MOFEM_DOFS_VIEW &dofs_view, const int operation_type=moab::Interface::UNION)
UId getLocalUniqueId() const
Get unique UId for finite element entity.
interface_RefEntity< RefElement > interface_type_RefEntity
MoFEMErrorCode getRowDofView(const MOFEM_DOFS &mofem_dofs, MOFEM_DOFS_VIEW &dofs_view)
boost::shared_ptr< FieldEntity_vector_view > & getRowFieldEntsPtr() const
virtual ~EntFiniteElement()=default
boost::shared_ptr< FieldEntity_vector_view > colFieldEnts
FieldEntity_vector_view & getColFieldEnts() const
MoFEMErrorCode getElementAdjacency(const boost::shared_ptr< Field > field_ptr, std::vector< EntityHandle > &adjacency)
FieldEntity_vector_view & getDataFieldEnts() const
boost::shared_ptr< FieldEntity_vector_view > rowFieldEnts
std::array< DofEntity_multiIndex::iterator, 2 > loHi
std::array< NumeredDofEntity_multiIndex::iterator, 2 > loHi
Provide data structure for (tensor) field approximation.
FiniteElement_change_bit_add(const BitFieldId f_id_data)
void operator()(boost::shared_ptr< FiniteElement > &fe)
void operator()(boost::shared_ptr< FiniteElement > &fe)
FiniteElement_change_bit_off(const BitFieldId f_id_data)
FiniteElement_change_bit_reset()=default
void operator()(boost::shared_ptr< FiniteElement > &fe)
void operator()(boost::shared_ptr< FiniteElement > &fe)
FiniteElement_col_change_bit_add(const BitFieldId f_id_col)
void operator()(boost::shared_ptr< FiniteElement > &fe)
FiniteElement_col_change_bit_off(const BitFieldId f_id_col)
FiniteElement_col_change_bit_reset()=default
void operator()(boost::shared_ptr< FiniteElement > &fe)
FiniteElement_row_change_bit_add(const BitFieldId f_id_row)
void operator()(boost::shared_ptr< FiniteElement > &fe)
void operator()(boost::shared_ptr< FiniteElement > &fe)
FiniteElement_row_change_bit_off(const BitFieldId f_id_row)
FiniteElement_row_change_bit_reset()=default
void operator()(boost::shared_ptr< FiniteElement > &fe)
Finite element definition.
BitFieldId * tag_BitFieldId_col_data
tag stores col id_id for fields
void * tagName
ptr to tag storing FE name
unsigned int getBitNumber() const
Get bit identifying this element.
EntityHandle getMeshset() const
Get meshset containing element entities.
BitFieldId * tag_BitFieldId_data
tag stores data id_id for fields
BitFEId * tagId
ptr to tag storing FE id
BitFieldId getBitFieldIdRow() const
Get field ids on rows.
std::string getName() const
Get finite element name.
BitFEId getId() const
Get finite element id.
const UId & getFEUId() const
Get finite element uid.
BitFieldId * tag_BitFieldId_row_data
tag stores row id_id for fields
static constexpr int ent_shift
boost::string_ref getNameRef() const
Get finite element name.
friend std::ostream & operator<<(std::ostream &os, const FiniteElement &e)
print finite element
BitFieldId getBitFieldIdData() const
Get field ids on data.
BitFieldId getBitFieldIdCol() const
Get field ids on columns.
int tagNameSize
numer of characters in FE name
EntityHandle meshset
meshset stores FE ents
std::array< ElementAdjacencyFunct, MBMAXTYPE > elementAdjacencyTable
Table of functions retrieving adjacencies for finite element User can alter and change default behavi...
Change finite element part.
NumeredEntFiniteElement_change_part(unsigned int part)
void operator()(boost::shared_ptr< NumeredEntFiniteElement > &fe)
void operator()(NumeredEntFiniteElement &fe)
Partitioned (Indexed) Finite Element in Problem.
boost::weak_ptr< FENumeredDofEntity > getRowDofsByPetscGlobalDofIdx(const int idx) const
get FE dof by petsc index
boost::weak_ptr< FENumeredDofEntity > getColDofsByPetscGlobalDofIdx(const int idx) const
get FE dof by petsc index
boost::shared_ptr< EntFiniteElement > & getEntFiniteElement() const
unsigned int getPart() const
Get partition number.
interface_EntFiniteElement< EntFiniteElement > interface_type_EntFiniteElement
friend std::ostream & operator<<(std::ostream &os, const NumeredEntFiniteElement &e)
virtual ~NumeredEntFiniteElement()=default
boost::shared_ptr< FENumeredDofEntity_multiIndex > getRowDofsPtr() const
get FE dof on row
boost::shared_ptr< FENumeredDofEntity_multiIndex > getColDofsPtr() const
get FE dof on column
unsigned int part
Partition number.
interface_FiniteElement< EntFiniteElement, EntFiniteElement > interface_type_FiniteElement
interface to EntFiniteElement
boost::shared_ptr< FieldEntity_vector_view > & getDataFieldEntsPtr()
FieldEntity_vector_view & getDataFieldEnts() const
SideNumber_multiIndex & getSideNumberTable() const
virtual ~interface_EntFiniteElement()=default
auto getDataVectorDofsPtr() const
UId getLocalUniqueId() const
Get unique UId for finite element entity.
boost::shared_ptr< FieldEntity_vector_view > & getColFieldEntsPtr() const
MoFEMErrorCode getElementAdjacency(const Field *field_ptr, Range &adjacency)
auto getDataDofsPtr() const
FieldEntity_vector_view & getColFieldEnts() const
interface_EntFiniteElement(const boost::shared_ptr< T > &sptr)
FieldEntity_vector_view & getRowFieldEnts() const
boost::shared_ptr< FieldEntity_vector_view > & getRowFieldEntsPtr() const
const boost::shared_ptr< RefElement > & getRefElement() const
const UId & getFEUId() const
Get finite element uid.
boost::string_ref getNameRef() const
Get finite element name.
EntityHandle getMeshset() const
Get meshset containing element entities.
BitFieldId getBitFieldIdData() const
Get field ids on data.
unsigned int getBitNumber() const
Get bit identifying this element.
BitFEId getId() const
Get finite element id.
BitFieldId getBitFieldIdCol() const
Get field ids on columns.
BitFieldId getBitFieldIdRow() const
Get field ids on rows.
std::string getName() const
Get finite element name.
interface_FiniteElement(const boost::shared_ptr< T > fe_ptr, const boost::shared_ptr< T > ref_ents_ptr)
boost::shared_ptr< FiniteElement > & getFiniteElementPtr() const
std::string getName() const
Get finite element name.
const UId & getFEUId() const
Get finite element uid.
boost::shared_ptr< FE > & getFiniteElementPtr() const
virtual ~interface_FiniteElement()=default
boost::shared_ptr< FE > sFiniteElementPtr
BitFEId getId() const
Get finite element id.
interface_FiniteElement(const boost::shared_ptr< FE > fe_ptr, const boost::shared_ptr< REFENT > ref_ents_ptr)
BitFieldId getBitFieldIdData() const
Get field ids on data.
BitFieldId getBitFieldIdRow() const
Get field ids on rows.
unsigned int getBitNumber() const
Get bit identifying this element.
BitFieldId getBitFieldIdCol() const
Get field ids on columns.
EntityHandle getMeshset() const
Get meshset containing element entities.
boost::string_ref getNameRef() const
Get finite element name.
interface_FiniteElementImpl(const boost::shared_ptr< FE > fe_ptr, const boost::shared_ptr< REFENT > ref_ents_ptr)
virtual ~interface_FiniteElementImpl()=default
interface_RefEntity< REFENT > interface_type_RefEntity
boost::shared_ptr< REFENT > & getRefElement() const
boost::shared_ptr< T > sPtr
EntityHandle getEnt() const