v0.6.10
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 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
 get shared processors More...
 
EntityHandlegetSharingHandlersPtr () const
 get sharid entity handlers More...
 

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 }
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:584
#define MOAB_THROW(a)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:569
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
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
EntityHandle moab_owner_handle
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:315
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 129 of file EntsMultiIndices.hpp.

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

◆ getEntType()

EntityType MoFEM::BasicEntity::getEntType ( ) const

Get entity type.

Definition at line 123 of file EntsMultiIndices.hpp.

123  {
124  return (EntityType)((ent & MB_TYPE_MASK) >> MB_ID_WIDTH);
125  }
#define MB_TYPE_MASK
Definition: definitions.h:320
#define MB_ID_WIDTH
Definition: definitions.h:319

◆ getOwnerEnt() [1/2]

EntityHandle MoFEM::BasicEntity::getOwnerEnt ( ) const

Owner handle on this or other processors.

Definition at line 133 of file EntsMultiIndices.hpp.

133 { 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 137 of file EntsMultiIndices.hpp.

137  {
138  return moab_owner_handle;
139  }
EntityHandle moab_owner_handle

◆ getOwnerProc() [1/2]

int MoFEM::BasicEntity::getOwnerProc ( ) const

Get processor owning entity.

Definition at line 143 of file EntsMultiIndices.hpp.

143 { 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 147 of file EntsMultiIndices.hpp.

147  {
148  return owner_proc;
149  }
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 153 of file EntsMultiIndices.hpp.

153 { 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 157 of file EntsMultiIndices.hpp.

157 { 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 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:315
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 handlers. 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 236 of file EntsMultiIndices.hpp.

236  {
237  EntityHandle *sharing_handlers_ptr = NULL;
238  moab::Interface &moab = basicDataPtr->moab;
239  ParallelComm* pcomm = ParallelComm::get_pcomm(&moab,MYPCOMM_INDEX);
240  if(getPStatus() & PSTATUS_MULTISHARED) {
241  // entity is multi shared
242  rval = moab.tag_get_by_ptr(pcomm->sharedhs_tag(), &ent, 1,
243  (const void **)&sharing_handlers_ptr);
244  MOAB_THROW(rval);
245  } else if(getPStatus() & PSTATUS_SHARED) {
246  // shared
247  rval = moab.tag_get_by_ptr(pcomm->sharedh_tag(), &ent, 1,
248  (const void **)&sharing_handlers_ptr);
249  MOAB_THROW(rval);
250  }
251  return sharing_handlers_ptr;
252  }
unsigned char getPStatus() const
get pstatus This tag stores various aspects of parallel status in bits; see also define following...
#define MOAB_THROW(a)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:569
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:315
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 196 of file EntsMultiIndices.hpp.

196  {
197  moab::Interface &moab = basicDataPtr->moab;
198  int *sharing_procs_ptr = NULL;
199  ParallelComm* pcomm = ParallelComm::get_pcomm(&moab,MYPCOMM_INDEX);
200  if(getPStatus() & PSTATUS_MULTISHARED) {
201  // entity is multi shared
202  rval = moab.tag_get_by_ptr(pcomm->sharedps_tag(), &ent, 1,
203  (const void **)&sharing_procs_ptr);
204  MOAB_THROW(rval);
205  } else if(getPStatus() & PSTATUS_SHARED) {
206  // shared
207  rval = moab.tag_get_by_ptr(pcomm->sharedp_tag(), &ent, 1,
208  (const void **)&sharing_procs_ptr);
209  MOAB_THROW(rval);
210  }
211  return sharing_procs_ptr;
212  }
unsigned char getPStatus() const
get pstatus This tag stores various aspects of parallel status in bits; see also define following...
#define MOAB_THROW(a)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:569
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:315
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: