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) {
87 typedef 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);
853 #endif // __REF_ENTSMULTIINDICES_HPP__