v0.8.13
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
MoFEM::DofEntity Struct Reference

keeps information about DOF on the entity More...

#include <src/multi_indices/DofsMultiIndices.hpp>

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

Public Types

typedef interface_Field< FieldEntityinterface_type_Field
 
typedef interface_FieldEntity< FieldEntityinterface_type_FieldEntity
 
typedef interface_RefEntity< FieldEntityinterface_type_RefEntity
 

Public Member Functions

 DofEntity (const boost::shared_ptr< FieldEntity > &entity_ptr, const ApproximationOrder dof_order, const FieldCoefficientsNumber dof_rank, const DofIdx dof, const bool is_active=false)
 
DofIdx getEntDofIdx () const
 
FieldDatagetFieldData () const
 
UId getGlobalUniqueId () const
 
UId getEntGlobalUniqueId () const
 
ShortId getNonNonuniqueShortId () const
 get short uid it is unique in combination with entity handle More...
 
EntityHandle getEnt () const
 
ApproximationOrder getDofOrder () const
 
FieldCoefficientsNumber getDofCoeffIdx () const
 
char getActive () const
 
- Public Member Functions inherited from MoFEM::interface_FieldEntity< FieldEntity >
 interface_FieldEntity (const boost::shared_ptr< FieldEntity > &sptr)
 
EntityHandle getEnt () const
 
int getNbDofsOnEnt () const
 
VectorAdaptor getEntFieldData () const
 
int getOrderNbDofs (int order) const
 
int getOrderNbDofsDiff (int order) const
 
ApproximationOrder getMaxOrder () const
 
UId getGlobalUniqueId () const
 
boost::shared_ptr< RefEntity > & getRefEntityPtr () const
 
boost::shared_ptr< Field > & getFieldPtr () const
 
boost::shared_ptr< FieldEntity > & getFieldEntityPtr () const
 
std::vector< ApproximationOrder > & getDofOrderMap () const
 get hash-map relating dof index on entity with its order More...
 
- Public Member Functions inherited from MoFEM::interface_Field< FieldEntity >
 interface_Field (const boost::shared_ptr< FieldEntity > &field_ptr)
 
 interface_Field (const interface_Field< FieldEntity > &interface)
 
virtual ~interface_Field ()
 
EntityHandle getMeshset () const
 
int getCoordSysId () const
 
int getCoordSysDim (const int d=0) const
 Get dimension of general two-point tensor MoFEM::CoordSys::getDim. More...
 
MoFEMErrorCode get_E_Base (const double m[]) const
 
MoFEMErrorCode get_E_DualBase (const double m[]) const
 
MoFEMErrorCode get_e_Base (const double m[]) const
 
MoFEMErrorCode get_e_DualBase (const double m[]) const
 
EntityHandle getCoordSysMeshSet () const
 
std::string getCoordSysName () const
 
boost::string_ref getCoordSysNameRef () const
 
const BitFieldIdgetId () const
 
boost::string_ref getNameRef () const
 
std::string getName () const
 
FieldSpace getSpace () const
 
FieldApproximationBase getApproxBase () const
 
FieldCoefficientsNumber getNbOfCoeffs () const
 
unsigned int getBitNumber () const
 
boost::shared_ptr< FieldEntity > & getFieldPtr () const
 
std::vector< ApproximationOrder > & getDofOrderMap (const EntityType type) const
 get hash-map relating dof index on entity with its order More...
 
- Public Member Functions inherited from MoFEM::interface_RefEntity< FieldEntity >
 interface_RefEntity (const boost::shared_ptr< FieldEntity > &sptr)
 
 interface_RefEntity (const interface_RefEntity< FieldEntity > &interface)
 
virtual ~interface_RefEntity ()
 
boost::shared_ptr< BasicEntityData > & getBasicDataPtr ()
 
const boost::shared_ptr< BasicEntityData > & getBasicDataPtr () const
 
EntityHandle getRefEnt () const
 
EntityType getParentEntType () const
 
EntityHandle getParentEnt () const
 
BitRefLevelgetBitRefLevelPtr () const
 
const BitRefLevelgetBitRefLevel () const
 
unsigned long int getBitRefLevelULong () const
 
EntityType getEntType () const
 
EntityID getEntId () const
 
EntityHandle getOwnerEnt () const
 
EntityHandlegetOwnerEnt ()
 
int getOwnerProc () const
 
intgetOwnerProc ()
 
int getPartProc () const
 
intgetPartProc ()
 
unsigned char getPStatus () const
 
intgetSharingProcsPtr () const
 
EntityHandlegetSharingHandlersPtr () const
 
boost::shared_ptr< FieldEntity > & getRefEntityPtr () const
 

Static Public Member Functions

static UId getGlobalUniqueIdCalculate (const DofIdx dof, const boost::shared_ptr< FieldEntity > &ent_ptr)
 Calculate UId for DOF. More...
 
static UId getGlobalUniqueIdCalculate_Low_Proc (const int owner_proc)
 
static UId getGlobalUniqueIdCalculate_Hi_Proc (const int owner_proc)
 
static ShortId getNonNonuniqueShortId (const DofIdx dof, const boost::shared_ptr< FieldEntity > &ent_ptr)
 

Public Attributes

bool active
 true if dof is active More...
 
UId globalUId
 global unique id for this dof More...
 
- Public Attributes inherited from MoFEM::interface_Field< FieldEntity >
boost::shared_ptr< FieldEntitysFieldPtr
 
- Public Attributes inherited from MoFEM::interface_RefEntity< FieldEntity >
boost::shared_ptr< FieldEntitysPtr
 

Friends

std::ostream & operator<< (std::ostream &os, const DofEntity &e)
 

Detailed Description

keeps information about DOF on the entity

Definition at line 30 of file DofsMultiIndices.hpp.

Member Typedef Documentation

◆ interface_type_Field

Definition at line 32 of file DofsMultiIndices.hpp.

◆ interface_type_FieldEntity

Definition at line 33 of file DofsMultiIndices.hpp.

◆ interface_type_RefEntity

Definition at line 34 of file DofsMultiIndices.hpp.

Constructor & Destructor Documentation

◆ DofEntity()

MoFEM::DofEntity::DofEntity ( const boost::shared_ptr< FieldEntity > &  entity_ptr,
const ApproximationOrder  dof_order,
const FieldCoefficientsNumber  dof_rank,
const DofIdx  dof,
const bool  is_active = false 
)

Definition at line 35 of file DofsMultiIndices.cpp.

39  : interface_FieldEntity<FieldEntity>(entity_ptr), active(is_active) {
40 
41  if (!entity_ptr) {
42  THROW_MESSAGE("FieldEntity pinter not initialized");
43  }
44  if (!sPtr) {
45  THROW_MESSAGE("FieldEntity pinter not initialized");
46  }
47  if (!getFieldEntityPtr()) {
48  THROW_MESSAGE("FieldEntity pinter not initialized");
49  }
50 
51  globalUId = getGlobalUniqueIdCalculate(dof, entity_ptr);
52 
53  // set order to DOF
54  ApproximationOrder &order = getDofOrderMap()[dof];
55  if (order != dof_order) {
56  if (order != -1) {
57  cerr << dof << " " << dof_order << " " << order;
59  "Order of DOFs inconsistent with order set before for entity");
60  }
61  order = dof_order;
62  }
63 
64  // verify data consistency
65  if (dof_rank != dof % getNbOfCoeffs()) {
66  std::ostringstream ss;
67  ss << dof_rank << " " << dof << " " << getNbOfCoeffs() << endl;
68  ss << *entity_ptr;
69  cerr << ss.str() << endl;
70  THROW_MESSAGE("Inconsitent DOFs rank with index of DOF on entity");
71  }
72 }
boost::shared_ptr< FieldEntity > sPtr
std::vector< ApproximationOrder > & getDofOrderMap() const
get hash-map relating dof index on entity with its order
FieldCoefficientsNumber getNbOfCoeffs() const
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:638
boost::shared_ptr< FieldEntity > & getFieldEntityPtr() const
bool active
true if dof is active
int ApproximationOrder
Approximation on the entity.
Definition: Common.hpp:131
static UId getGlobalUniqueIdCalculate(const DofIdx dof, const boost::shared_ptr< FieldEntity > &ent_ptr)
Calculate UId for DOF.
UId globalUId
global unique id for this dof

Member Function Documentation

◆ getActive()

char MoFEM::DofEntity::getActive ( ) const
Returns
return true if dof us active

Definition at line 136 of file DofsMultiIndices.hpp.

136 { return active ? 1 : 0; }
bool active
true if dof is active

◆ getDofCoeffIdx()

FieldCoefficientsNumber MoFEM::DofEntity::getDofCoeffIdx ( ) const
Returns
get dof coefficient index

Definition at line 131 of file DofsMultiIndices.hpp.

131  {
132  return getEntDofIdx() % getNbOfCoeffs();
133  }
DofIdx getEntDofIdx() const
FieldCoefficientsNumber getNbOfCoeffs() const

◆ getDofOrder()

ApproximationOrder MoFEM::DofEntity::getDofOrder ( ) const
Returns
get dof approximation order

Definition at line 126 of file DofsMultiIndices.hpp.

126  {
127  return getDofOrderMap()[getEntDofIdx()];
128  }
std::vector< ApproximationOrder > & getDofOrderMap() const
get hash-map relating dof index on entity with its order
DofIdx getEntDofIdx() const

◆ getEnt()

EntityHandle MoFEM::DofEntity::getEnt ( ) const
Returns
get dof entity handle

Definition at line 123 of file DofsMultiIndices.hpp.

123 { return this->sPtr->getEnt(); }
boost::shared_ptr< FieldEntity > sPtr

◆ getEntDofIdx()

DofIdx MoFEM::DofEntity::getEntDofIdx ( ) const
Returns
get dof index on entity

Definition at line 83 of file DofsMultiIndices.hpp.

83  {
84  DofIdx dof;
85  memcpy(&dof, &globalUId, 2);
86  return DOF_UID_MASK_ON_ENTITY & dof;
87  }
#define DOF_UID_MASK_ON_ENTITY
Mask for DOF number on entity form UId.
Definition: definitions.h:332
int DofIdx
Index of DOF.
Definition: Common.hpp:126
UId globalUId
global unique id for this dof

◆ getEntGlobalUniqueId()

UId MoFEM::DofEntity::getEntGlobalUniqueId ( ) const
Returns
get entity unique dof id

Definition at line 99 of file DofsMultiIndices.hpp.

99  {
100  return this->sPtr->getGlobalUniqueId();
101  }
boost::shared_ptr< FieldEntity > sPtr

◆ getFieldData()

FieldData& MoFEM::DofEntity::getFieldData ( ) const
Returns
get field data on dof

Definition at line 90 of file DofsMultiIndices.hpp.

90  {
91  return const_cast<FieldData &>(
92  this->sPtr->getEntFieldData().data()[getEntDofIdx()]);
93  }
boost::shared_ptr< FieldEntity > sPtr
DofIdx getEntDofIdx() const
double FieldData
Field data type.
Definition: Common.hpp:130

◆ getGlobalUniqueId()

UId MoFEM::DofEntity::getGlobalUniqueId ( ) const
Returns
get unique dof id

Definition at line 96 of file DofsMultiIndices.hpp.

96 { return globalUId; }
UId globalUId
global unique id for this dof

◆ getGlobalUniqueIdCalculate()

static UId MoFEM::DofEntity::getGlobalUniqueIdCalculate ( const DofIdx  dof,
const boost::shared_ptr< FieldEntity > &  ent_ptr 
)
static

Calculate UId for DOF.

UId is constructed such that all DOFs are ordered by processor, entity, field and dof index on entity, On entity dofs index is constructed such that coefficient number and dofs increase with dofs index on entity.

Parameters
dofdof index on entity
ent_ptrpointer to field entity
Returns
UId

Definition at line 48 of file DofsMultiIndices.hpp.

49  {
50  // if(dof>=512) THROW_MESSAGE("_dof>=512");
51  return static_cast<UId>(dof) | (ent_ptr->getGlobalUniqueId() << 9);
52  }
uint128_t UId
Unique Id.
Definition: Common.hpp:136

◆ getGlobalUniqueIdCalculate_Hi_Proc()

static UId MoFEM::DofEntity::getGlobalUniqueIdCalculate_Hi_Proc ( const int  owner_proc)
static

Definition at line 58 of file DofsMultiIndices.hpp.

58  {
59  return static_cast<UId>(MBMAXTYPE) << 9 |
60  static_cast<UId>(BITFIELDID_SIZE - 1)
61  << 9 + 8 * sizeof(EntityHandle) |
62  static_cast<UId>(owner_proc) << 9 + 5 + 8 * sizeof(EntityHandle);
63  }
uint128_t UId
Unique Id.
Definition: Common.hpp:136
#define BITFIELDID_SIZE
max number of fields
Definition: definitions.h:313

◆ getGlobalUniqueIdCalculate_Low_Proc()

static UId MoFEM::DofEntity::getGlobalUniqueIdCalculate_Low_Proc ( const int  owner_proc)
static

Definition at line 54 of file DofsMultiIndices.hpp.

54  {
55  return static_cast<UId>(owner_proc) << 9 + 5 + 8 * sizeof(EntityHandle);
56  }
uint128_t UId
Unique Id.
Definition: Common.hpp:136

◆ getNonNonuniqueShortId() [1/2]

static ShortId MoFEM::DofEntity::getNonNonuniqueShortId ( const DofIdx  dof,
const boost::shared_ptr< FieldEntity > &  ent_ptr 
)
static

Definition at line 66 of file DofsMultiIndices.hpp.

67  {
68  // if(sizeof(ShortId) < sizeof(char)+2) THROW_MESSAGE("sizeof(ShortId)<
69  // sizeof(char)+2")
70  return static_cast<ShortId>(dof) |
71  (static_cast<ShortId>(ent_ptr->getBitNumber()) << 9);
72  }
int ShortId
Unique Id in the field.
Definition: Common.hpp:137

◆ getNonNonuniqueShortId() [2/2]

ShortId MoFEM::DofEntity::getNonNonuniqueShortId ( ) const

get short uid it is unique in combination with entity handle

EntityHandle are controlled by MOAB, which is unique in MOAB instance. However two MOAB instances, can have attached different EntityHandles to the same entity.

Relation between MoAB EntityHandle can be handled by saving entity handle data into tag, see MB_TYPE_HANDLE. MOAB at time of file reading or creating new MOAB instance, substitute tag value by approbate entity handle.

ShortId is created to handle problems related to saving data series, and reading those data using different MoAB instances.

Definition at line 118 of file DofsMultiIndices.hpp.

118  {
120  }
DofIdx getEntDofIdx() const
ShortId getNonNonuniqueShortId() const
get short uid it is unique in combination with entity handle
boost::shared_ptr< FieldEntity > & getFieldEntityPtr() const

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const DofEntity e 
)
friend

Definition at line 74 of file DofsMultiIndices.cpp.

74  {
75  os << "dof_uid " << e.getGlobalUniqueId() << " dof_order " << e.getDofOrder()
76  << " dof_rank " << e.getDofCoeffIdx() << " dof " << e.getEntDofIdx()
77  << " active " << e.active << " " << *(e.sFieldPtr);
78  return os;
79 }

Member Data Documentation

◆ active

bool MoFEM::DofEntity::active

true if dof is active

Definition at line 74 of file DofsMultiIndices.hpp.

◆ globalUId

UId MoFEM::DofEntity::globalUId

global unique id for this dof

Definition at line 75 of file DofsMultiIndices.hpp.


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