v0.5.86
Public Member Functions | Public Attributes | List of all members
MoFEM::BasicEntity Struct Reference

this struct keeps basic methods for moab entity More...

#include <src/multi_indices/EntsMultiIndices.hpp>

Inheritance diagram for MoFEM::BasicEntity:
[legend]
Collaboration diagram for MoFEM::BasicEntity:
[legend]

Public Member Functions

 BasicEntity (const boost::shared_ptr< BasicEntityData > &basic_data_ptr, const EntityHandle ent)
 
boost::shared_ptr< BasicEntityData > & getBasicDataPtr ()
 
const boost::shared_ptr< BasicEntityData > & getBasicDataPtr () const
 
EntityType getEntType () const
 Get entity type. More...
 
EntityID getEntId () const
 get entity id More...
 
EntityHandle getOwnerEnt () const
 Owner handle on this or other processors. More...
 
EntityHandlegetOwnerEnt ()
 Owner handle on this or other processors. More...
 
int getOwnerProc () const
 Get processor owning entity. More...
 
intgetOwnerProc ()
 Get processor owning entity. More...
 
int getPartProc () const
 Get processor. More...
 
intgetPartProc ()
 Get processor owning entity. More...
 
unsigned char getPStatus () const
 get pstatus This tag stores various aspects of parallel status in bits; see also #define's following, to be used in bit mask operations. If an entity is not shared with any other processors, the pstatus is 0, otherwise it's > 0 More...
 
intgetSharingProcsPtr () const
 
EntityHandlegetSharingHandlersPtr () const
 

Public Attributes

boost::shared_ptr< BasicEntityDatabasicDataPtr
 
EntityHandle ent
 
int owner_proc
 this never can not be changed if distributed mesh More...
 
int part_proc
 this can be changed on distributed More...
 
EntityHandle moab_owner_handle
 

Detailed Description

this struct keeps basic methods for moab entity

Todo:
BasicEntity in should be linked to directly to MoAB data structures such that connectivity and nodal coordinates could be quickly accessed, without need of using native MoAB functions.

Definition at line 96 of file EntsMultiIndices.hpp.

Constructor & Destructor Documentation

◆ BasicEntity()

MoFEM::BasicEntity::BasicEntity ( const boost::shared_ptr< BasicEntityData > &  basic_data_ptr,
const EntityHandle  ent 
)

Definition at line 69 of file EntsMultiIndices.cpp.

72  :
73 basicDataPtr(basic_data_ptr),
74 ent(ent) {
75  switch (getEntType()) {
76  case MBVERTEX:
77  case MBEDGE:
78  case MBTRI:
79  case MBQUAD:
80  case MBTET:
81  case MBPRISM:
82  case MBENTITYSET:
83  break;
84  default:
85  THROW_MESSAGE("this entity type is currently not implemented");
86  }
87  ParallelComm* pcomm = ParallelComm::get_pcomm(&basicDataPtr->moab,MYPCOMM_INDEX);
88  if(pcomm == NULL) THROW_MESSAGE("pcomm is null");
89  // unsigned char pstatus;
90  // rval = basicDataPtr->
91  // moab.tag_get_data(pcomm->pstatus_tag(),&ent,1,&pstatus); MOAB_THROW(rval);
92  rval = pcomm->get_owner_handle(ent,owner_proc,moab_owner_handle); MOAB_THROW(rval);
94 }
static MoABErrorCode rval
Definition: Common.hpp:25
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:389
#define MOAB_THROW(a)
Definition: definitions.h:376
int part_proc
this can be changed on distributed
EntityType getEntType() const
Get entity type.
int owner_proc
this never can not be changed if distributed mesh
EntityHandle moab_owner_handle
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:305
boost::shared_ptr< BasicEntityData > basicDataPtr

Member Function Documentation

◆ getBasicDataPtr() [1/2]

boost::shared_ptr<BasicEntityData>& MoFEM::BasicEntity::getBasicDataPtr ( )

Definition at line 112 of file EntsMultiIndices.hpp.

112  {
113  return basicDataPtr;
114  }
boost::shared_ptr< BasicEntityData > basicDataPtr

◆ getBasicDataPtr() [2/2]

const boost::shared_ptr<BasicEntityData>& MoFEM::BasicEntity::getBasicDataPtr ( ) const

Definition at line 116 of file EntsMultiIndices.hpp.

116  {
117  return basicDataPtr;
118  }
boost::shared_ptr< BasicEntityData > basicDataPtr

◆ getEntId()

EntityID MoFEM::BasicEntity::getEntId ( ) const

get entity id

Definition at line 127 of file EntsMultiIndices.hpp.

127 { return (EntityID)(ent&MB_ID_MASK); };
#define MB_ID_MASK
Definition: definitions.h:315

◆ getEntType()

EntityType MoFEM::BasicEntity::getEntType ( ) const

Get entity type.

Definition at line 123 of file EntsMultiIndices.hpp.

123 { return (EntityType)((ent&MB_TYPE_MASK)>>MB_ID_WIDTH); }
#define MB_TYPE_MASK
Definition: definitions.h:310
#define MB_ID_WIDTH
Definition: definitions.h:309

◆ getOwnerEnt() [1/2]

EntityHandle MoFEM::BasicEntity::getOwnerEnt ( ) const

Owner handle on this or other processors.

Definition at line 131 of file EntsMultiIndices.hpp.

131 { return moab_owner_handle; }
EntityHandle moab_owner_handle

◆ getOwnerEnt() [2/2]

EntityHandle& MoFEM::BasicEntity::getOwnerEnt ( )

Owner handle on this or other processors.

Definition at line 135 of file EntsMultiIndices.hpp.

135  {
136  return moab_owner_handle;
137  }
EntityHandle moab_owner_handle

◆ getOwnerProc() [1/2]

int MoFEM::BasicEntity::getOwnerProc ( ) const

Get processor owning entity.

Definition at line 141 of file EntsMultiIndices.hpp.

141 { return owner_proc; }
int owner_proc
this never can not be changed if distributed mesh

◆ getOwnerProc() [2/2]

int& MoFEM::BasicEntity::getOwnerProc ( )

Get processor owning entity.

Definition at line 145 of file EntsMultiIndices.hpp.

145  {
146  return owner_proc;
147  }
int owner_proc
this never can not be changed if distributed mesh

◆ getPartProc() [1/2]

int MoFEM::BasicEntity::getPartProc ( ) const

Get processor.

Definition at line 151 of file EntsMultiIndices.hpp.

151 { return part_proc; }
int part_proc
this can be changed on distributed

◆ getPartProc() [2/2]

int& MoFEM::BasicEntity::getPartProc ( )

Get processor owning entity.

Definition at line 155 of file EntsMultiIndices.hpp.

155 { return part_proc; }
int part_proc
this can be changed on distributed

◆ getPStatus()

unsigned char MoFEM::BasicEntity::getPStatus ( ) const

get pstatus This tag stores various aspects of parallel status in bits; see also #define's following, to be used in bit mask operations. If an entity is not shared with any other processors, the pstatus is 0, otherwise it's > 0

bit 0: !owned (0=owned, 1=not owned) bit 1: shared (0=not shared, 1=shared) bit 2: multishared (shared by > 2 procs; 0=not shared, 1=shared) bit 3: interface (0=not interface, 1=interface) bit 4: ghost (0=not ghost, 1=ghost)

Definition at line 96 of file EntsMultiIndices.cpp.

96  {
97  ParallelComm* pcomm = ParallelComm::get_pcomm(&basicDataPtr->moab,MYPCOMM_INDEX);
98  return *((unsigned char*)MoFEM::get_tag_ptr(
99  static_cast<moab::Core*>(&basicDataPtr->moab)->sequence_manager(),pcomm->pstatus_tag(),ent,NULL
100  ));
101 }
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:305
boost::shared_ptr< BasicEntityData > basicDataPtr
void * get_tag_ptr(SequenceManager *sequence_manager, Tag th, EntityHandle ent, int *tag_size)

◆ getSharingHandlersPtr()

EntityHandle* MoFEM::BasicEntity::getSharingHandlersPtr ( ) const

get sharid entity handlers

Returning list to shared entity hanlders. Use it with getSharingProcsPtr()

DO NOT MODIFY LIST.

BasicEntity *ent_ptr = BasicEntity(moan,entity_handle);
for(int proc = 0; proc<MAX_SHARING_PROCS && -1 != ent_ptr->getSharingProcsPtr[proc]; proc++) {
if(ent_ptr->getSharingProcsPtr[proc] == -1) {
// End of the list
break;
}
int sharing_proc = ent_ptr->getSharingProcsPtr[proc];
EntityHandle sharing_ent = ent_ptr->getSharingHandlersPtr[proc];
if(!(ent_ptr->getPStatus()&PSTATUS_MULTISHARED)) {
break;
}
}

Definition at line 231 of file EntsMultiIndices.hpp.

231  {
232 
233  EntityHandle *sharing_handlers_ptr = NULL;
234  moab::Interface &moab = basicDataPtr->moab;
235  ParallelComm* pcomm = ParallelComm::get_pcomm(&moab,MYPCOMM_INDEX);
236  if(getPStatus() & PSTATUS_MULTISHARED) {
237  // entity is multi shared
238  rval = moab.tag_get_by_ptr(pcomm->sharedhs_tag(),&ent,1,(const void **)&sharing_handlers_ptr); MOAB_THROW(rval);
239  } else if(getPStatus() & PSTATUS_SHARED) {
240  // shared
241  rval = moab.tag_get_by_ptr(pcomm->sharedh_tag(),&ent,1,(const void **)&sharing_handlers_ptr); MOAB_THROW(rval);
242  }
243  return sharing_handlers_ptr;
244  }
unsigned char getPStatus() const
get pstatus This tag stores various aspects of parallel status in bits; see also #define&#39;s following...
static MoABErrorCode rval
Definition: Common.hpp:25
#define MOAB_THROW(a)
Definition: definitions.h:376
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:305
boost::shared_ptr< BasicEntityData > basicDataPtr

◆ getSharingProcsPtr()

int* MoFEM::BasicEntity::getSharingProcsPtr ( ) const

get shared processors

Returning list to shared processors. Lists end with -1. Returns NULL if not sharing processors.

DO NOT MODIFY LIST.

BasicEntity *ent_ptr = BasicEntity(moan,entity_handle);
for(int proc = 0; proc<MAX_SHARING_PROCS && -1 != ent_ptr->getSharingProcsPtr[proc]; proc++) {
if(ent_ptr->getSharingProcsPtr[proc] == -1) {
// End of the list
break;
}
int sharing_proc = ent_ptr->getSharingProcsPtr[proc];
EntityHandle sharing_ent = ent_ptr->getSharingHandlersPtr[proc];
if(!(ent_ptr->getPStatus()&PSTATUS_MULTISHARED)) {
break;
}
}

Definition at line 194 of file EntsMultiIndices.hpp.

194  {
195 
196  moab::Interface &moab = basicDataPtr->moab;
197  int *sharing_procs_ptr = NULL;
198  ParallelComm* pcomm = ParallelComm::get_pcomm(&moab,MYPCOMM_INDEX);
199  if(getPStatus() & PSTATUS_MULTISHARED) {
200  // entity is multi shared
201  rval = moab.tag_get_by_ptr(pcomm->sharedps_tag(),&ent,1,(const void **)&sharing_procs_ptr); MOAB_THROW(rval);
202  } else if(getPStatus() & PSTATUS_SHARED) {
203  // shared
204  rval = moab.tag_get_by_ptr(pcomm->sharedp_tag(),&ent,1,(const void **)&sharing_procs_ptr); MOAB_THROW(rval);
205  }
206  return sharing_procs_ptr;
207  }
unsigned char getPStatus() const
get pstatus This tag stores various aspects of parallel status in bits; see also #define&#39;s following...
static MoABErrorCode rval
Definition: Common.hpp:25
#define MOAB_THROW(a)
Definition: definitions.h:376
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:305
boost::shared_ptr< BasicEntityData > basicDataPtr

Member Data Documentation

◆ basicDataPtr

boost::shared_ptr<BasicEntityData> MoFEM::BasicEntity::basicDataPtr
mutable

Definition at line 98 of file EntsMultiIndices.hpp.

◆ ent

EntityHandle MoFEM::BasicEntity::ent

Definition at line 100 of file EntsMultiIndices.hpp.

◆ moab_owner_handle

EntityHandle MoFEM::BasicEntity::moab_owner_handle

Definition at line 105 of file EntsMultiIndices.hpp.

◆ owner_proc

int MoFEM::BasicEntity::owner_proc

this never can not be changed if distributed mesh

Definition at line 102 of file EntsMultiIndices.hpp.

◆ part_proc

int MoFEM::BasicEntity::part_proc

this can be changed on distributed

Definition at line 103 of file EntsMultiIndices.hpp.


The documentation for this struct was generated from the following files: