8#ifndef __FEMMULTIINDICES_HPP__
9 #define __FEMMULTIINDICES_HPP__
13struct EntFiniteElement;
20 std::vector<EntityHandle> &adjacency)>;
72 std::vector<EntityHandle> &fe_ents,
180 std::vector<EntityHandle> &adjacency);
183 std::vector<EntityHandle> &adjacency);
186 std::vector<EntityHandle> &adjacency);
189 std::vector<EntityHandle> &adjacency);
192 std::vector<EntityHandle> &adjacency);
195 std::vector<EntityHandle> &adjacency);
335 static constexpr std::array<const DefEntTypeMap *, MBMAXTYPE>
defTypeMap = {
353 const EntityType ent_type) {
355 return (*ptr)[ent_type];
356 THROW_MESSAGE(
"DefTypeMap is not defined by this element. This is propably "
357 "new implementation, and has to be implemented");
366template <
typename FE,
typename REFENT>
370 const boost::shared_ptr<REFENT> ref_ents_ptr)
375template <
typename FE,
typename REFENT>
378 const boost::shared_ptr<REFENT> ref_ents_ptr)
458 const boost::shared_ptr<T> ref_ents_ptr)
524 ->getFiniteElementPtr();
529 std::array<DofEntity_multiIndex::iterator, 2>
loHi;
533 std::array<NumeredDofEntity_multiIndex::iterator, 2>
loHi;
538 std::vector<EntityCacheDofs>, std::vector<EntityCacheNumeredDofs>,
539 std::vector<EntityCacheNumeredDofs>
559 const boost::shared_ptr<FiniteElement> &fe_ptr);
570 return fe_uid |= ent;
594 boost::shared_ptr<std::vector<boost::shared_ptr<FEDofEntity>>>
601 inline boost::shared_ptr<FieldEntity_vector_view> &
611 inline boost::shared_ptr<FieldEntity_vector_view> &
621 inline boost::shared_ptr<FieldEntity_vector_view> &
629 template <
typename FE_ENTS,
typename MOFEM_DOFS,
typename MOFEM_DOFS_VIEW,
632 getDofView(
const FE_ENTS &fe_ents_view,
const MOFEM_DOFS &mofem_dofs,
633 MOFEM_DOFS_VIEW &dofs_view, INSERTER &&inserter) {
636 auto hint = dofs_view.end();
637 using ValType =
typename std::remove_reference<
decltype(**hint)>::type;
639 for (
auto &it : fe_ents_view) {
640 if (
auto e = it.lock()) {
641 const auto &uid = e->getLocalUniqueId();
642 auto dit = mofem_dofs.lower_bound(uid);
643 if (dit != mofem_dofs.end()) {
644 const auto hi_dit = mofem_dofs.upper_bound(
646 for (; dit != hi_dit; ++dit)
647 hint = inserter(dofs_view, hint,
648 boost::reinterpret_pointer_cast<ValType>(*dit));
655 template <
typename MOFEM_DOFS,
typename MOFEM_DOFS_VIEW>
657 MOFEM_DOFS_VIEW &dofs_view) {
659 auto hint = dofs_view.end();
660 using ValType =
typename std::remove_reference<
decltype(**hint)>::type;
661 using IndexType = MOFEM_DOFS_VIEW;
664 using Idx = IndexType;
665 using It =
typename Idx::iterator;
666 It operator()(Idx &dofs_view, It &hint,
667 boost::shared_ptr<ValType> &&dof) {
668 return dofs_view.emplace_hint(hint, dof);
675 template <
typename MOFEM_DOFS,
typename MOFEM_DOFS_VIEW>
678 const int operation_type = moab::Interface::UNION) {
680 auto hint = dofs_view.end();
681 using ValType =
typename std::remove_reference<
decltype(**hint)>::type;
682 using IndexType = MOFEM_DOFS_VIEW;
685 using Idx = IndexType;
686 using It =
typename Idx::iterator;
687 It operator()(Idx &dofs_view, It &hint,
688 boost::shared_ptr<ValType> &&dof) {
689 return dofs_view.emplace_hint(hint, dof);
697 std::vector<EntityHandle> &adjacency);
719 return this->
sPtr->getDataVectorDofsPtr();
723 return this->
sPtr->getDataFieldEnts();
727 return this->
sPtr->getDataFieldEntsPtr();
731 return this->
sPtr->getRowFieldEnts();
734 inline boost::shared_ptr<FieldEntity_vector_view> &
736 return this->
sPtr->getRowFieldEntsPtr();
740 return this->
sPtr->getColFieldEnts();
743 inline boost::shared_ptr<FieldEntity_vector_view> &
745 return this->
sPtr->getColFieldEntsPtr();
755 return this->
sPtr->getSideNumberTable();
764 return this->
sPtr->getRefElement();
807 boost::shared_ptr<FENumeredDofEntity_multiIndex>
getRowDofsPtr()
const;
812 boost::shared_ptr<FENumeredDofEntity_multiIndex>
getColDofsPtr()
const;
817 boost::weak_ptr<FENumeredDofEntity>
823 boost::weak_ptr<FENumeredDofEntity>
826 friend std::ostream &
operator<<(std::ostream &os,
837 boost::shared_ptr<EntFiniteElement>,
840 ordered_unique<tag<Unique_mi_tag>,
841 const_mem_fun<EntFiniteElement,
UId,
857 boost::shared_ptr<NumeredEntFiniteElement>,
864 ordered_non_unique<tag<Part_mi_tag>,
865 member<NumeredEntFiniteElement,
unsigned int,
872 tag<Composite_Name_And_Part_mi_tag>,
874 NumeredEntFiniteElement,
878 member<NumeredEntFiniteElement,
unsigned int,
886typedef multi_index_container<
887 boost::shared_ptr<FiniteElement>,
888 indexed_by<hashed_unique<tag<FiniteElement_Meshset_mi_tag>,
893 const_mem_fun<FiniteElement, BitFEId, &FiniteElement::getId>,
894 HashBit<BitFEId>, EqBit<BitFEId>>,
895 ordered_unique<tag<FiniteElement_name_mi_tag>,
896 const_mem_fun<FiniteElement, boost::string_ref,
910 void operator()(boost::shared_ptr<NumeredEntFiniteElement> &fe) {
925 void operator()(boost::shared_ptr<FiniteElement> &fe);
937 void operator()(boost::shared_ptr<FiniteElement> &fe);
949 void operator()(boost::shared_ptr<FiniteElement> &fe);
961 void operator()(boost::shared_ptr<FiniteElement> &fe);
973 void operator()(boost::shared_ptr<FiniteElement> &fe);
985 void operator()(boost::shared_ptr<FiniteElement> &fe);
995 void operator()(boost::shared_ptr<FiniteElement> &fe);
1005 void operator()(boost::shared_ptr<FiniteElement> &fe);
1015 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.
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< 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.
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.
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
boost::weak_ptr< CacheTuple > CacheTupleWeakPtr
std::tuple< std::vector< EntityCacheDofs >, std::vector< EntityCacheNumeredDofs >, std::vector< EntityCacheNumeredDofs > > CacheTuple
std::vector< boost::weak_ptr< FieldEntity > > FieldEntity_vector_view
boost::shared_ptr< CacheTuple > CacheTupleSharedPtr
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.
EntFiniteElement(const boost::shared_ptr< RefElement > &ref_finite_element, const boost::shared_ptr< FiniteElement > &fe_ptr)
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
static MoFEMErrorCode setNoFieldTagField(moab::Interface &moab, Range &fe_ents, const Field &field, EntityHandle meshset)
Set the No Field meshset to finite element entities storing no field adjacencies to it.
static Tag getNoFieldTag(moab::Interface &moab, const Field &field)
Get the tag storing meshset with adjacent entities to finite element.
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.
FiniteElement(Interface &moab, const EntityHandle _meshset)
BitFieldId * tag_BitFieldId_row_data
tag stores row id_id for fields
static EntityHandle getNoFieldAdjacencyMeshset(moab::Interface &moab, EntityHandle fe_ent, const Field &field)
Get the No Field adjacency meshset from finite element entity.
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.
interface_FiniteElement< EntFiniteElement, EntFiniteElement > interface_type_FiniteElement
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
NumeredEntFiniteElement(const boost::shared_ptr< EntFiniteElement > &sptr)
boost::shared_ptr< EntFiniteElement > & getEntFiniteElement() const
unsigned int getPart() const
Get partition number.
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
interface_EntFiniteElement< EntFiniteElement > interface_type_EntFiniteElement
boost::shared_ptr< FENumeredDofEntity_multiIndex > getColDofsPtr() const
get FE dof on column
unsigned int part
Partition number.
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
interface_FiniteElementImpl(const boost::shared_ptr< FE > fe_ptr, const boost::shared_ptr< REFENT > ref_ents_ptr)
virtual ~interface_FiniteElementImpl()=default
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_RefEntity< EntFiniteElement > interface_type_RefEntity
boost::shared_ptr< REFENT > & getRefElement() const
boost::shared_ptr< T > sPtr
EntityHandle getEnt() const