8#ifndef __REF_ENTSMULTIINDICES_HPP__
9#define __REF_ENTSMULTIINDICES_HPP__
43 rval = moab.tag_get_by_ptr(
th, &ent, 1, (
const void **)&ret_val, tag_size);
44 if (
rval != MB_SUCCESS) {
87typedef multi_index_container<
88 boost::shared_ptr<SideNumber>,
90 ordered_unique<member<SideNumber, EntityHandle, &SideNumber::ent>>,
95 const_mem_fun<SideNumber, EntityType, &SideNumber::getEntType>,
96 member<SideNumber, signed char, &SideNumber::side_number>
143 RefEntityTmp(
const boost::shared_ptr<BasicEntityData> &basic_data_ptr,
146 RefEntityTmp(
const boost::shared_ptr<BasicEntityData> &basic_data_ptr,
163 int getSideNumber()
const;
170 boost::shared_ptr<SideNumber> getSideNumberPtr()
const;
209 boost::shared_ptr<BasicEntityData> basic_ent_data) {
211 ParallelComm::get_pcomm(&basic_ent_data->moab, basic_ent_data->pcommID);
213 auto get_owner_ent = [&](
auto tag) {
216 return owner_ent_ptr[0];
223 basic_ent_data->moab, pcomm->pstatus_tag(), ent, NULL))) {
224 if (!(*pstat_ptr & PSTATUS_NOT_OWNED)) {
226 }
else if (*pstat_ptr & PSTATUS_MULTISHARED) {
227 return get_owner_ent(pcomm->sharedhs_tag());
228 }
else if (*pstat_ptr & PSTATUS_SHARED) {
229 return get_owner_ent(pcomm->sharedh_tag());
246 boost::shared_ptr<BasicEntityData> basic_ent_data) {
248 ParallelComm::get_pcomm(&basic_ent_data->moab, basic_ent_data->pcommID);
250 auto get_owner_proc = [&](
auto tag) {
251 if (
auto owner_proc =
static_cast<int *
>(
253 return owner_proc[0];
260 basic_ent_data->moab, pcomm->pstatus_tag(), ent, NULL))) {
261 if (!(*pstat_ptr & PSTATUS_NOT_OWNED)) {
262 return pcomm->rank();
263 }
else if (*pstat_ptr & PSTATUS_MULTISHARED) {
264 return get_owner_proc(pcomm->sharedps_tag());
265 }
else if (*pstat_ptr & PSTATUS_SHARED) {
266 return get_owner_proc(pcomm->sharedp_tag());
281 const boost::shared_ptr<BasicEntityData> &basic_ptr) {
282 if (
auto part_ptr =
static_cast<int *
>(
284 return *part_ptr >= 0 ? *part_ptr : 0;
292 if (PetscUnlikely(getEntType() == MBENTITYSET)) {
298 return getPartProc(ent, pcomm->partition_tag(), this->getBasicDataPtr());
308 if (PetscUnlikely(getEntType() == MBENTITYSET)) {
370 int *sharing_procs_ptr = NULL;
371 ParallelComm *pcomm =
373 if (getPStatus() & PSTATUS_MULTISHARED) {
375 rval = moab.tag_get_by_ptr(pcomm->sharedps_tag(), &this->ent, 1,
376 (
const void **)&sharing_procs_ptr);
378 }
else if (getPStatus() & PSTATUS_SHARED) {
380 rval = moab.tag_get_by_ptr(pcomm->sharedp_tag(), &this->ent, 1,
381 (
const void **)&sharing_procs_ptr);
384 return sharing_procs_ptr;
413 ParallelComm *pcomm =
415 if (getPStatus() & PSTATUS_MULTISHARED) {
417 rval = moab.tag_get_by_ptr(pcomm->sharedhs_tag(), &this->ent, 1,
418 (
const void **)&sharing_handlers_ptr);
420 }
else if (getPStatus() & PSTATUS_SHARED) {
422 rval = moab.tag_get_by_ptr(pcomm->sharedh_tag(), &this->ent, 1,
423 (
const void **)&sharing_handlers_ptr);
426 return sharing_handlers_ptr;
430 std::vector<EntityHandle> vec_patent_ent);
434 std::vector<BitRefLevel> &vec_bit_ref_level) {
436 Tag th_ref_bit_level;
437 CHKERR moab.tag_get_handle(
"_RefBitLevel", th_ref_bit_level);
438 vec_bit_ref_level.resize(ents.size());
439 CHKERR moab.tag_get_data(th_ref_bit_level, ents,
440 &*vec_bit_ref_level.begin());
446 std::vector<const BitRefLevel *> &vec_ptr_bit_ref_level) {
448 Tag th_ref_bit_level;
449 CHKERR moab.tag_get_handle(
"_RefBitLevel", th_ref_bit_level);
450 vec_ptr_bit_ref_level.resize(ents.size());
451 CHKERR moab.tag_get_by_ptr(
452 th_ref_bit_level, ents,
453 reinterpret_cast<const void **
>(&*vec_ptr_bit_ref_level.begin()));
459 std::vector<const BitRefLevel *> &vec_ptr_bit_ref_level) {
461 Tag th_ref_bit_level;
462 CHKERR moab.tag_get_handle(
"_RefBitLevel", th_ref_bit_level);
463 vec_ptr_bit_ref_level.resize(ents.size());
464 CHKERR moab.tag_get_by_ptr(
465 th_ref_bit_level, &*ents.begin(), ents.size(),
466 reinterpret_cast<const void **
>(&*vec_ptr_bit_ref_level.begin()));
510 return *getBitRefLevelPtr();
516 return getBitRefLevel().to_ulong();
534 if (
auto ptr = refElementPtr.lock())
552 :
RefEntityTmp<0>(basic_data_ptr, ent, ent_parent_tag_ptr),
590 return this->
sPtr->getSideNumberPtr();
597 return this->
sPtr->getBasicDataPtr();
609 return this->
sPtr->getParentEntType();
616 return this->
sPtr->getParentEnt();
623 return this->
sPtr->getBitRefLevelPtr();
630 return this->
sPtr->getBitRefLevel();
637 return this->
sPtr->getBitRefLevelULong();
654 return this->
sPtr->getEntTypeName();
696 return this->
sPtr->getSharingProcsPtr();
703 return this->
sPtr->getSharingHandlersPtr();
711 mutable boost::shared_ptr<T>
sPtr;
725 boost::shared_ptr<RefEntity>,
726 indexed_by<ordered_unique<
729 const_mem_fun<RefEntity, EntityHandle, &RefEntity::getEnt>
741 tag<Composite_EntType_and_ParentEntType_mi_tag>,
751 tag<Composite_ParentEnt_And_EntType_mi_tag>,
766 boost::shared_ptr<RefEntity>,
769 const_mem_fun<RefEntity, EntityHandle, &RefEntity::getParentEnt>>,
770 hashed_unique<tag<Composite_EntType_and_ParentEntType_mi_tag>,
771 composite_key<boost::shared_ptr<RefEntity>,
780 multi_index_container<
781 boost::shared_ptr<RefEntity>,
785 tag<Composite_EntType_and_ParentEntType_mi_tag>,
786 composite_key<boost::shared_ptr<RefEntity>,
795 boost::shared_ptr<RefEntity>,
816 rval = e->getBasicDataPtr()->moab.tag_set_data(
817 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, signed 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
auto type_from_handle(const EntityHandle h)
get type from entity handle
EntityHandle get_id_for_max_type()
EntityHandle get_id_for_min_type()
auto id_from_handle(const EntityHandle h)
RefEntityTmp< 0 > RefEntity
auto dimension_from_handle(const EntityHandle h)
get entity dimension form handle
auto type_name_from_handle(const EntityHandle h)
get entity type name from handle
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
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< 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
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.
static int getPartProc(const EntityHandle ent, const Tag th, const boost::shared_ptr< BasicEntityData > &basic_ptr)
const char * getEntTypeName() const
Get the Ent Type Name.
static MoFEMErrorCode getBitRefLevel(Interface &moab, Range ents, std::vector< const BitRefLevel * > &vec_ptr_bit_ref_level)
virtual ~RefEntityTmp()=default
int * getSharingProcsPtr() const
get shared processors
EntityType getParentEntType() const
Get patent entity.
int getPartProc() const
Get processor.
EntityHandle * getParentEntPtr() const
Get pointer to parent entity tag.
static boost::weak_ptr< RefElement > refElementPtr
EntityID getEntId() const
get entity id
BitRefLevel * getBitRefLevelPtr() const
Get pointer to bit ref level tag.
const BitRefLevel & getBitRefLevel() const
Get entity ref bit refinement signature.
const boost::shared_ptr< RefElement > getRefElementPtr() const
Get the pointer to reference element.
unsigned char getPStatus() const
get pstatus This tag stores various aspects of parallel status in bits; see also define following,...
unsigned long int getBitRefLevelULong() const
Get entity ref bit refinement as ulong.
virtual const boost::shared_ptr< BasicEntityData > getBasicDataPtr() const
Get pointer to basic data struture.
EntityType getEntType() const
Get entity type.
static MoFEMErrorCode getBitRefLevel(Interface &moab, Range ents, std::vector< BitRefLevel > &vec_bit_ref_level)
int * getPartProcPtr() const
Get pointer to partition tag.
EntityHandle getParentEnt() const
Get parent entity, i.e. entity form one refinement level up.
EntityHandle * entParentTagPtr
Tag ptr to parent entity handle.
EntityHandle * getSharingHandlersPtr() const
get sharid entity handlers
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)
friend std::ostream & operator<<(std::ostream &os, const RefEntityTmp &e)
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)
static MoFEMErrorCode getBitRefLevel(Interface &moab, std::vector< EntityHandle > &ents, std::vector< const BitRefLevel * > &vec_ptr_bit_ref_level)
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)
signed char brother_side_number
const BitRefLevel & getBitRefLevel() const
virtual ~interface_RefEntity()=default
EntityType getParentEntType() const
const char * getEntTypeName() const
interface_RefEntity(const interface_RefEntity< T > &interface)
EntityHandle * getSharingHandlersPtr() const
boost::shared_ptr< T > sPtr
int * getSharingProcsPtr() const
EntityHandle getParentEnt() const
EntityHandle getOwnerEnt() const
int getSideNumber() const
int getEntDimension() const
EntityType getEntType() const
const boost::shared_ptr< BasicEntityData > getBasicDataPtr() const
int * getPartProcPtr() const
boost::shared_ptr< SideNumber > getSideNumberPtr() const
boost::shared_ptr< T > & getRefEntityPtr() const
unsigned char getPStatus() const
EntityHandle & getOwnerEnt()
EntityID getEntId() const
BitRefLevel * getBitRefLevelPtr() const
unsigned long int getBitRefLevelULong() const
interface_RefEntity(const boost::shared_ptr< T > &sptr)
EntityHandle getEnt() const