21 #ifndef __REF_ENTSMULTIINDICES_HPP__
22 #define __REF_ENTSMULTIINDICES_HPP__
56 rval = moab.tag_get_by_ptr(
th, &ent, 1, (
const void **)&ret_val, tag_size);
57 if (
rval != MB_SUCCESS) {
100 typedef multi_index_container<
101 boost::shared_ptr<SideNumber>,
103 ordered_unique<member<SideNumber, EntityHandle, &SideNumber::ent>>,
108 const_mem_fun<SideNumber, EntityType, &SideNumber::getEntType>,
109 member<SideNumber, char, &SideNumber::side_number>
159 RefEntityTmp(
const boost::shared_ptr<BasicEntityData> &basic_data_ptr,
162 RefEntityTmp(
const boost::shared_ptr<BasicEntityData> &basic_data_ptr,
179 int getSideNumber()
const;
186 boost::shared_ptr<SideNumber> getSideNumberPtr()
const;
207 return moab::CN::Dimension(getEntType());
216 return moab::CN::EntityTypeName(getEntType());
227 boost::shared_ptr<BasicEntityData> basic_ent_data) {
229 ParallelComm::get_pcomm(&basic_ent_data->moab, basic_ent_data->pcommID);
231 auto get_owner_ent = [&](
auto tag) {
234 return owner_ent_ptr[0];
241 basic_ent_data->moab, pcomm->pstatus_tag(), ent, NULL))) {
242 if (!(*pstat_ptr & PSTATUS_NOT_OWNED)) {
244 }
else if (*pstat_ptr & PSTATUS_MULTISHARED) {
245 return get_owner_ent(pcomm->sharedhs_tag());
246 }
else if (*pstat_ptr & PSTATUS_SHARED) {
247 return get_owner_ent(pcomm->sharedh_tag());
264 boost::shared_ptr<BasicEntityData> basic_ent_data) {
266 ParallelComm::get_pcomm(&basic_ent_data->moab, basic_ent_data->pcommID);
268 auto get_owner_proc = [&](
auto tag) {
269 if (
auto owner_proc =
static_cast<int *
>(
271 return owner_proc[0];
278 basic_ent_data->moab, pcomm->pstatus_tag(), ent, NULL))) {
279 if (!(*pstat_ptr & PSTATUS_NOT_OWNED)) {
280 return pcomm->rank();
281 }
else if (*pstat_ptr & PSTATUS_MULTISHARED) {
282 return get_owner_proc(pcomm->sharedps_tag());
283 }
else if (*pstat_ptr & PSTATUS_SHARED) {
284 return get_owner_proc(pcomm->sharedp_tag());
299 const boost::shared_ptr<BasicEntityData> &basic_ptr) {
300 if (
auto part_ptr =
static_cast<int *
>(
302 return *part_ptr >= 0 ? *part_ptr : 0;
310 if (PetscUnlikely(getEntType() == MBENTITYSET)) {
316 return getPartProc(ent, pcomm->partition_tag(), this->getBasicDataPtr());
326 if (PetscUnlikely(getEntType() == MBENTITYSET)) {
388 int *sharing_procs_ptr = NULL;
389 ParallelComm *pcomm =
391 if (getPStatus() & PSTATUS_MULTISHARED) {
393 rval = moab.tag_get_by_ptr(pcomm->sharedps_tag(), &this->ent, 1,
394 (
const void **)&sharing_procs_ptr);
396 }
else if (getPStatus() & PSTATUS_SHARED) {
398 rval = moab.tag_get_by_ptr(pcomm->sharedp_tag(), &this->ent, 1,
399 (
const void **)&sharing_procs_ptr);
402 return sharing_procs_ptr;
431 ParallelComm *pcomm =
433 if (getPStatus() & PSTATUS_MULTISHARED) {
435 rval = moab.tag_get_by_ptr(pcomm->sharedhs_tag(), &this->ent, 1,
436 (
const void **)&sharing_handlers_ptr);
438 }
else if (getPStatus() & PSTATUS_SHARED) {
440 rval = moab.tag_get_by_ptr(pcomm->sharedh_tag(), &this->ent, 1,
441 (
const void **)&sharing_handlers_ptr);
444 return sharing_handlers_ptr;
448 std::vector<EntityHandle> vec_patent_ent);
452 std::vector<BitRefLevel> &vec_bit_ref_level) {
454 Tag th_ref_bit_level;
455 CHKERR moab.tag_get_handle(
"_RefBitLevel", th_ref_bit_level);
456 vec_bit_ref_level.resize(ents.size());
457 CHKERR moab.tag_get_data(th_ref_bit_level, ents,
458 &*vec_bit_ref_level.begin());
464 std::vector<const BitRefLevel *> &vec_ptr_bit_ref_level) {
466 Tag th_ref_bit_level;
467 CHKERR moab.tag_get_handle(
"_RefBitLevel", th_ref_bit_level);
468 vec_ptr_bit_ref_level.resize(ents.size());
469 CHKERR moab.tag_get_by_ptr(
470 th_ref_bit_level, ents,
471 reinterpret_cast<const void **
>(&*vec_ptr_bit_ref_level.begin()));
515 return *getBitRefLevelPtr();
521 return getBitRefLevel().to_ulong();
539 if (
auto ptr = refElementPtr.lock())
557 :
RefEntityTmp<0>(basic_data_ptr, ent, ent_parent_tag_ptr),
595 return this->
sPtr->getSideNumberPtr();
602 return this->
sPtr->getBasicDataPtr();
614 return this->
sPtr->getParentEntType();
621 return this->
sPtr->getParentEnt();
628 return this->
sPtr->getBitRefLevelPtr();
635 return this->
sPtr->getBitRefLevel();
642 return this->
sPtr->getBitRefLevelULong();
659 return this->
sPtr->getEntTypeName();
701 return this->
sPtr->getSharingProcsPtr();
708 return this->
sPtr->getSharingHandlersPtr();
716 mutable boost::shared_ptr<T>
sPtr;
730 boost::shared_ptr<RefEntity>,
731 indexed_by<ordered_unique<
734 const_mem_fun<RefEntity, EntityHandle, &RefEntity::getEnt>
746 tag<Composite_EntType_and_ParentEntType_mi_tag>,
756 tag<Composite_ParentEnt_And_EntType_mi_tag>,
771 boost::shared_ptr<RefEntity>,
774 const_mem_fun<RefEntity, EntityHandle, &RefEntity::getParentEnt>>,
775 hashed_unique<tag<Composite_EntType_and_ParentEntType_mi_tag>,
776 composite_key<boost::shared_ptr<RefEntity>,
785 multi_index_container<
786 boost::shared_ptr<RefEntity>,
790 tag<Composite_EntType_and_ParentEntType_mi_tag>,
791 composite_key<boost::shared_ptr<RefEntity>,
800 boost::shared_ptr<RefEntity>,
821 rval = e->getBasicDataPtr()->moab.tag_set_data(
822 e->getBasicDataPtr()->th_RefParentHandle, &e->ent, 1, &
pArent);
#define MOAB_THROW(err)
Check error code of MoAB function and throw MoFEM exception.
#define MYPCOMM_INDEX
default communicator number PCOMM
#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 CHKERR
Inline error check.
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< hashed_non_unique< const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, hashed_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< boost::shared_ptr< RefEntity >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getEnt >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >> > > RefEntity_multiIndex_view_by_hashed_parent_entity
multi-index view of RefEntity by parent entity
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< 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, char, &SideNumber::side_number > > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
implementation of Data Operators for Forces and Sources
EntityHandle get_id_for_max_type()
EntityHandle get_id_for_min_type()
RefEntityTmp< 0 > RefEntity
void * get_tag_ptr(moab::Interface &moab, Tag th, EntityHandle ent, int *tag_size)
Get the tag ptr object.
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< sequenced<>, ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getEnt > >> > RefEntity_multiIndex_view_sequence_ordered_view
DeprecatedCoreInterface Interface
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_non_unique< const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, hashed_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< boost::shared_ptr< RefEntity >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getEnt >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >> > > RefEntity_multiIndex_view_by_ordered_parent_entity
PipelineManager data. like access to moab interface and basic tag handlers.
virtual ~BasicEntityData()=default
BasicEntityData(const moab::Interface &mfield, const int pcomm_id=MYPCOMM_INDEX)
Deprecated interface functions.
Finite element data for entity.
Partitioned (Indexed) Finite Element in Problem.
keeps data about abstract refined finite element
ref mofem entity, left shift
RefEntity_change_left_shift(const int _shift, const BitRefLevel _mask=BitRefLevel().set())
void operator()(boost::shared_ptr< RefEntity > &e)
RefEntity_change_parent(EntityHandle parent)
void operator()(boost::shared_ptr< RefEntity > &e)
ref mofem entity, right shift
void operator()(boost::shared_ptr< RefEntity > &e)
RefEntity_change_right_shift(const int _shift, const BitRefLevel _mask=BitRefLevel().set())
boost::weak_ptr< BasicEntityData > basicDataPtr
RefEntityTmp(const boost::shared_ptr< BasicEntityData > &basic_data_ptr, const EntityHandle ent)
virtual const boost::shared_ptr< BasicEntityData > getBasicDataPtr() const
Get pointer to basic data struture.
RefEntityTmp(const boost::shared_ptr< BasicEntityData > &basic_data_ptr, const EntityHandle ent, EntityHandle *ent_parent_tag_ptr)
Struct keeps handle to refined handle.
EntityHandle * getParentEntPtr() const
Get pointer to parent entity tag.
static int getPartProc(const EntityHandle ent, const Tag th, const boost::shared_ptr< BasicEntityData > &basic_ptr)
static MoFEMErrorCode getBitRefLevel(Interface &moab, Range ents, std::vector< const BitRefLevel * > &vec_ptr_bit_ref_level)
virtual ~RefEntityTmp()=default
EntityType getParentEntType() const
Get patent entity.
int getPartProc() const
Get processor.
static boost::weak_ptr< RefElement > refElementPtr
int * getSharingProcsPtr() const
get shared processors
virtual const boost::shared_ptr< BasicEntityData > getBasicDataPtr() const
Get pointer to basic data struture.
BitRefLevel * getBitRefLevelPtr() const
Get pointer to bit ref level tag.
EntityID getEntId() const
get entity id
unsigned char getPStatus() const
get pstatus This tag stores various aspects of parallel status in bits; see also define following,...
const char * getEntTypeName() const
Get the Ent Type Name.
const BitRefLevel & getBitRefLevel() const
Get entity ref bit refinement signature.
EntityHandle * getSharingHandlersPtr() const
get sharid entity handlers
unsigned long int getBitRefLevelULong() const
Get entity ref bit refinement as ulong.
EntityType getEntType() const
Get entity type.
static MoFEMErrorCode getBitRefLevel(Interface &moab, Range ents, std::vector< BitRefLevel > &vec_bit_ref_level)
EntityHandle getParentEnt() const
Get parent entity, i.e. entity form one refinement level up.
int * getPartProcPtr() const
Get pointer to partition tag.
EntityHandle * entParentTagPtr
Tag ptr to parent entity handle.
friend std::ostream & operator<<(std::ostream &os, const RefEntityTmp &e)
int getEntDimension() const
Get the Ent Dimension.
static boost::weak_ptr< BasicEntityData > basicDataPtr
static EntityHandle getOwnerEnt(const EntityHandle ent, boost::shared_ptr< BasicEntityData > basic_ent_data)
EntityHandle getOwnerEnt() const
Owner handle on this or other processors.
EntityHandle getEnt() const
Get the entity handle.
static int getOwnerProc(const EntityHandle ent, boost::shared_ptr< BasicEntityData > basic_ent_data)
static MoFEMErrorCode getParentEnt(Interface &moab, Range ents, std::vector< EntityHandle > vec_patent_ent)
const boost::shared_ptr< RefElement > getRefElementPtr() const
Get the pointer to reference element.
virtual const boost::shared_ptr< BasicEntityData > getBasicDataPtr() const
static boost::weak_ptr< BasicEntityData > basicDataPtr
keeps information about side number for the finite element
int getEntDimension() const
const char * getEntTypeName() const
EntityType getEntType() const
SideNumber(EntityHandle ent, int side_number, int sense, int offset)
virtual ~interface_RefEntity()=default
EntityType getParentEntType() const
Get patent entity.
boost::shared_ptr< SideNumber > getSideNumberPtr() const
Get the Side number.
interface_RefEntity(const interface_RefEntity< T > &interface)
int * getPartProcPtr() const
Get pointer to partition tag.
boost::shared_ptr< T > sPtr
EntityHandle getParentEnt() const
EntityHandle getOwnerEnt() const
EntityHandle & getOwnerEnt()
const char * getEntTypeName() const
Get the Ent Type Name.
int getSideNumber() const
EntityHandle * getSharingHandlersPtr() const
get sharid entity handlers
const BitRefLevel & getBitRefLevel() const
boost::shared_ptr< T > & getRefEntityPtr() const
int getEntDimension() const
Get the Ent Dimension.
EntityType getEntType() const
Get entity type.
BitRefLevel * getBitRefLevelPtr() const
Get pointer to bit ref level tag.
const boost::shared_ptr< BasicEntityData > getBasicDataPtr() const
Get pointer to basic data struture.
unsigned char getPStatus() const
EntityID getEntId() const
get entity id
unsigned long int getBitRefLevelULong() const
Get entity ref bit refinement as ulong.
interface_RefEntity(const boost::shared_ptr< T > &sptr)
EntityHandle getEnt() const
Get the entity handle.
int * getSharingProcsPtr() const
get shared processors