v0.9.0
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 97 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 50 of file EntsMultiIndices.cpp.

53  : basicDataPtr(basic_data_ptr), ent(ent) {
54  switch (getEntType()) {
55  case MBVERTEX:
56  case MBEDGE:
57  case MBTRI:
58  case MBQUAD:
59  case MBTET:
60  case MBPRISM:
61  case MBENTITYSET:
62  break;
63  default:
64  THROW_MESSAGE("this entity type is currently not implemented");
65  }
66  ParallelComm *pcomm =
67  ParallelComm::get_pcomm(&basicDataPtr->moab, basicDataPtr->pcommID);
68  if (pcomm == NULL)
69  THROW_MESSAGE("pcomm is null");
70  rval = pcomm->get_owner_handle(ent, owner_proc, moab_owner_handle);
73 }
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:620
#define MOAB_THROW(a)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:602
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:84
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
boost::shared_ptr< BasicEntityData > basicDataPtr

Member Function Documentation

◆ getBasicDataPtr() [1/2]

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

Definition at line 111 of file EntsMultiIndices.hpp.

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

◆ getBasicDataPtr() [2/2]

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

Definition at line 115 of file EntsMultiIndices.hpp.

115  {
116  return basicDataPtr;
117  }
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:296

◆ getEntType()

EntityType MoFEM::BasicEntity::getEntType ( ) const

Get entity type.

Definition at line 121 of file EntsMultiIndices.hpp.

121  {
122  return (EntityType)((ent & MB_TYPE_MASK) >> MB_ID_WIDTH);
123  }
#define MB_TYPE_MASK
Definition: definitions.h:290
#define MB_ID_WIDTH
Definition: definitions.h:289

◆ 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 { return moab_owner_handle; }
EntityHandle moab_owner_handle

◆ getOwnerProc() [1/2]

int MoFEM::BasicEntity::getOwnerProc ( ) const

Get processor owning entity.

Definition at line 139 of file EntsMultiIndices.hpp.

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

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

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

151 { 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 75 of file EntsMultiIndices.cpp.

75  {
76  ParallelComm *pcomm =
77  ParallelComm::get_pcomm(&basicDataPtr->moab, basicDataPtr->pcommID);
78  return *((unsigned char *)MoFEM::get_tag_ptr(
79  basicDataPtr->moab, pcomm->pstatus_tag(), ent, NULL));
80 }
void * get_tag_ptr(moab::Interface &moab, Tag th, EntityHandle ent, int *tag_size)
boost::shared_ptr< BasicEntityData > basicDataPtr

◆ 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 232 of file EntsMultiIndices.hpp.

232  {
233  EntityHandle *sharing_handlers_ptr = NULL;
234  moab::Interface &moab = basicDataPtr->moab;
235  ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, basicDataPtr->pcommID);
236  if (getPStatus() & PSTATUS_MULTISHARED) {
237  // entity is multi shared
238  rval = moab.tag_get_by_ptr(pcomm->sharedhs_tag(), &ent, 1,
239  (const void **)&sharing_handlers_ptr);
240  MOAB_THROW(rval);
241  } else if (getPStatus() & PSTATUS_SHARED) {
242  // shared
243  rval = moab.tag_get_by_ptr(pcomm->sharedh_tag(), &ent, 1,
244  (const void **)&sharing_handlers_ptr);
245  MOAB_THROW(rval);
246  }
247  return sharing_handlers_ptr;
248  }
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:602
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:84
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 191 of file EntsMultiIndices.hpp.

191  {
192  moab::Interface &moab = basicDataPtr->moab;
193  int *sharing_procs_ptr = NULL;
194  ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, basicDataPtr->pcommID);
195  if (getPStatus() & PSTATUS_MULTISHARED) {
196  // entity is multi shared
197  rval = moab.tag_get_by_ptr(pcomm->sharedps_tag(), &ent, 1,
198  (const void **)&sharing_procs_ptr);
199  MOAB_THROW(rval);
200  } else if (getPStatus() & PSTATUS_SHARED) {
201  // shared
202  rval = moab.tag_get_by_ptr(pcomm->sharedp_tag(), &ent, 1,
203  (const void **)&sharing_procs_ptr);
204  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 following,...
#define MOAB_THROW(a)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:602
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:84
boost::shared_ptr< BasicEntityData > basicDataPtr

Member Data Documentation

◆ basicDataPtr

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

Definition at line 99 of file EntsMultiIndices.hpp.

◆ ent

EntityHandle MoFEM::BasicEntity::ent

Definition at line 101 of file EntsMultiIndices.hpp.

◆ moab_owner_handle

EntityHandle MoFEM::BasicEntity::moab_owner_handle

Definition at line 106 of file EntsMultiIndices.hpp.

◆ owner_proc

int MoFEM::BasicEntity::owner_proc

this never can not be changed if distributed mesh

Definition at line 103 of file EntsMultiIndices.hpp.

◆ part_proc

int MoFEM::BasicEntity::part_proc

this can be changed on distributed

Definition at line 104 of file EntsMultiIndices.hpp.


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