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));
651 if (hint != dofs_view.end())
660 template <
typename MOFEM_DOFS,
typename MOFEM_DOFS_VIEW>
662 MOFEM_DOFS_VIEW &dofs_view) {
664 auto hint = dofs_view.end();
665 using ValType =
typename std::remove_reference<
decltype(**hint)>
::type;
666 using IndexType = MOFEM_DOFS_VIEW;
669 using Idx = IndexType;
670 using It =
typename Idx::iterator;
671 It operator()(Idx &dofs_view, It &hint,
672 boost::shared_ptr<ValType> &&dof) {
673 return dofs_view.emplace_hint(hint, dof);
680 template <
typename MOFEM_DOFS,
typename MOFEM_DOFS_VIEW>
683 const int operation_type = moab::Interface::UNION) {
685 auto hint = dofs_view.end();
686 using ValType =
typename std::remove_reference<
decltype(**hint)>
::type;
687 using IndexType = MOFEM_DOFS_VIEW;
690 using Idx = IndexType;
691 using It =
typename Idx::iterator;
692 It operator()(Idx &dofs_view, It &hint,
693 boost::shared_ptr<ValType> &&dof) {
694 return dofs_view.emplace_hint(hint, dof);
702 std::vector<EntityHandle> &adjacency);
724 return this->
sPtr->getDataVectorDofsPtr();
728 return this->
sPtr->getDataFieldEnts();
732 return this->
sPtr->getDataFieldEntsPtr();
736 return this->
sPtr->getRowFieldEnts();
739 inline boost::shared_ptr<FieldEntity_vector_view> &
741 return this->
sPtr->getRowFieldEntsPtr();
745 return this->
sPtr->getColFieldEnts();
748 inline boost::shared_ptr<FieldEntity_vector_view> &
750 return this->
sPtr->getColFieldEntsPtr();
760 return this->
sPtr->getSideNumberTable();
769 return this->
sPtr->getRefElement();
812 boost::shared_ptr<FENumeredDofEntity_multiIndex>
getRowDofsPtr()
const;
817 boost::shared_ptr<FENumeredDofEntity_multiIndex>
getColDofsPtr()
const;
822 boost::weak_ptr<FENumeredDofEntity>
828 boost::weak_ptr<FENumeredDofEntity>
831 friend std::ostream &
operator<<(std::ostream &os,
842 boost::shared_ptr<EntFiniteElement>,
845 ordered_unique<tag<Unique_mi_tag>,
846 const_mem_fun<EntFiniteElement,
UId,
862 boost::shared_ptr<NumeredEntFiniteElement>,
869 ordered_non_unique<tag<Part_mi_tag>,
870 member<NumeredEntFiniteElement,
unsigned int,
877 tag<Composite_Name_And_Part_mi_tag>,
879 NumeredEntFiniteElement,
883 member<NumeredEntFiniteElement,
unsigned int,
891typedef multi_index_container<
892 boost::shared_ptr<FiniteElement>,
893 indexed_by<hashed_unique<tag<FiniteElement_Meshset_mi_tag>,
894 member<FiniteElement, EntityHandle,
898 const_mem_fun<FiniteElement, BitFEId, &FiniteElement::getId>,
899 HashBit<BitFEId>, EqBit<BitFEId>>,
900 ordered_unique<tag<FiniteElement_name_mi_tag>,
901 const_mem_fun<FiniteElement, boost::string_ref,
915 void operator()(boost::shared_ptr<NumeredEntFiniteElement> &fe) {
930 void operator()(boost::shared_ptr<FiniteElement> &fe);
942 void operator()(boost::shared_ptr<FiniteElement> &fe);
954 void operator()(boost::shared_ptr<FiniteElement> &fe);
966 void operator()(boost::shared_ptr<FiniteElement> &fe);
978 void operator()(boost::shared_ptr<FiniteElement> &fe);
990 void operator()(boost::shared_ptr<FiniteElement> &fe);
1000 void operator()(boost::shared_ptr<FiniteElement> &fe);
1010 void operator()(boost::shared_ptr<FiniteElement> &fe);
1020 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
Field data structure for finite element 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.
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.
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
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< REFENT > interface_type_RefEntity
boost::shared_ptr< REFENT > & getRefElement() const
boost::shared_ptr< T > sPtr
EntityHandle getEnt() const