v0.13.0
Public Types | Public Member Functions | Static Public Member Functions | Private 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

using interface_type_Field = interface_FieldImpl< FieldEntity, FieldEntity >
 
using interface_type_FieldEntity = interface_FieldEntity< FieldEntity >
 
using interface_type_RefEntity = interface_RefEntity< FieldEntity >
 
- Public Types inherited from MoFEM::interface_FieldImpl< FIELD, REFENT >
using interface_type_RefEntity = interface_RefEntity< REFENT >
 

Public Member Functions

virtual ~DofEntity ()=default
 
 DofEntity (const boost::shared_ptr< FieldEntity > &entity_ptr, const ApproximationOrder dof_order, const FieldCoefficientsNumber dof_rank, const DofIdx dof)
 
DofIdx getEntDofIdx () const
 
FieldDatagetFieldData () const
 
const UIdgetEntLocalUniqueId () const
 
const UId getEntGlobalUniqueId () const
 
UId getLocalUniqueId () const
 
UId getGlobalUniqueId () 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)
 
int getNbDofsOnEnt () const
 
VectorAdaptor getEntFieldData () const
 
int getOrderNbDofs (ApproximationOrder order) const
 
int getOrderNbDofsDiff (ApproximationOrder order) const
 
ApproximationOrder getMaxOrder () const
 
UId getGlobalUniqueId () const
 
UIdgetLocalUniqueId () const
 
boost::shared_ptr< RefEntity > & getRefEntityPtr () const
 
boost::shared_ptr< FieldEntity > & getFieldEntityPtr () const
 
const std::array< int, MAX_DOFS_ON_ENTITY > & getDofOrderMap () const
 get hash-map relating dof index on entity with its order More...
 
boost::shared_ptr< S > getSharedStoragePtr () const
 
boost::weak_ptr< EntityStorage > & getWeakStoragePtr () const
 
- Public Member Functions inherited from MoFEM::interface_Field< FIELD, REFENT >
 interface_Field (const boost::shared_ptr< FIELD > &field_ptr, const boost::shared_ptr< REFENT > &ref_ents_ptr)
 
EntityHandle getMeshset () const
 
int getCoordSysDim (const int d=0) const
 
const BitFieldIdgetId () const
 
boost::string_ref getNameRef () const
 
std::string getName () const
 
FieldSpace getSpace () const
 
FieldApproximationBase getApproxBase () const
 
FieldCoefficientsNumber getNbOfCoeffs () const
 
FieldBitNumber getBitNumber () const
 
std::array< ApproximationOrder, MAX_DOFS_ON_ENTITY > & getDofOrderMap (const EntityType type) const
 get hash-map relating dof index on entity with its order More...
 
const FieldgetFieldRawPtr () const
 
FieldOrderTablegetFieldOrderTable ()
 
- Public Member Functions inherited from MoFEM::interface_FieldImpl< FIELD, REFENT >
 interface_FieldImpl (const boost::shared_ptr< FIELD > &field_ptr, const boost::shared_ptr< REFENT > &ref_ents_ptr)
 
virtual ~interface_FieldImpl ()=default
 
- Public Member Functions inherited from MoFEM::interface_RefEntity< REFENT >
 interface_RefEntity (const boost::shared_ptr< REFENT > &sptr)
 
 interface_RefEntity (const interface_RefEntity< REFENT > &interface)
 
virtual ~interface_RefEntity ()=default
 
int getSideNumber () const
 
boost::shared_ptr< SideNumbergetSideNumberPtr () const
 Get the Side number. More...
 
const boost::shared_ptr< BasicEntityDatagetBasicDataPtr () const
 Get pointer to basic data struture. More...
 
EntityHandle getEnt () const
 Get the entity handle. More...
 
EntityType getParentEntType () const
 Get patent entity. More...
 
EntityHandle getParentEnt () const
 
BitRefLevelgetBitRefLevelPtr () const
 Get pointer to bit ref level tag. More...
 
const BitRefLevelgetBitRefLevel () const
 
unsigned long int getBitRefLevelULong () const
 Get entity ref bit refinement as ulong. More...
 
EntityType getEntType () const
 Get entity type. More...
 
int getEntDimension () const
 Get the Ent Dimension. More...
 
const char * getEntTypeName () const
 Get the Ent Type Name. More...
 
EntityID getEntId () const
 get entity id More...
 
EntityHandle getOwnerEnt () const
 
EntityHandlegetOwnerEnt ()
 
int getOwnerProc () const
 
int getPartProc () const
 
int * getPartProcPtr () const
 Get pointer to partition tag. More...
 
unsigned char getPStatus () const
 
int * getSharingProcsPtr () const
 get shared processors More...
 
EntityHandlegetSharingHandlersPtr () const
 get sharid entity handlers More...
 
boost::shared_ptr< REFENT > & getRefEntityPtr () const
 

Static Public Member Functions

static ShortId getNonNonuniqueShortId (const DofIdx dof, const boost::shared_ptr< FieldEntity > &ent_ptr)
 
static UId getUniqueIdCalculate (const DofIdx dof, UId ent_uid)
 
static UId getLocalUniqueIdCalculate (const DofIdx dof, const boost::shared_ptr< FieldEntity > &ent_ptr)
 
static UId getLoFieldEntityUId (const FieldBitNumber bit, const EntityHandle ent)
 
static UId getHiFieldEntityUId (const FieldBitNumber bit, const EntityHandle ent)
 
static UId getGlobalUniqueIdCalculate (const DofIdx dof, const boost::shared_ptr< FieldEntity > &ent_ptr)
 Calculate UId for DOF. More...
 

Private Attributes

DofIdx dof
 

Friends

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

Additional Inherited Members

- Public Attributes inherited from MoFEM::interface_RefEntity< REFENT >
boost::shared_ptr< REFENT > sPtr
 

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 34 of file DofsMultiIndices.hpp.

◆ interface_type_FieldEntity

Definition at line 35 of file DofsMultiIndices.hpp.

◆ interface_type_RefEntity

Definition at line 36 of file DofsMultiIndices.hpp.

Constructor & Destructor Documentation

◆ ~DofEntity()

virtual MoFEM::DofEntity::~DofEntity ( )
virtualdefault

◆ DofEntity()

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

Definition at line 21 of file DofsMultiIndices.cpp.

24  : interface_FieldEntity<FieldEntity>(entity_ptr), dof(dof) {
25 
26 #ifndef NDEBUG
27  if (PetscUnlikely(!entity_ptr))
28  THROW_MESSAGE("FieldEntity pointer not initialized");
29  if (PetscUnlikely(!sPtr))
30  THROW_MESSAGE("FieldEntity pointer not initialized");
31  if (PetscUnlikely(!getFieldEntityPtr()))
32  THROW_MESSAGE("FieldEntity pointer not initialized");
33  // verify dof order
34  if (PetscUnlikely(dof_order != getDofOrderMap()[dof])) {
36  "Inconsistent DOF order with order set before for entity " +
37  boost::lexical_cast<std::string>(*entity_ptr) + "\n" + "dof->" +
38  boost::lexical_cast<std::string>(dof) + " dof_order->" +
39  boost::lexical_cast<std::string>(dof_order) +
40  " != " + boost::lexical_cast<std::string>(getDofOrderMap()[dof]) +
41  "<-getDofOrderMap()[dof]");
42  }
43 
44  // verify dof rank
45  if (PetscUnlikely(dof_rank != dof % getNbOfCoeffs()))
46  THROW_MESSAGE("Inconsistent DOFs rank with index of DOF on entity");
47 #endif
48 }
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
Definition: definitions.h:574
const std::array< int, MAX_DOFS_ON_ENTITY > & getDofOrderMap() const
get hash-map relating dof index on entity with its order
boost::shared_ptr< FieldEntity > & getFieldEntityPtr() const
FieldCoefficientsNumber getNbOfCoeffs() const

Member Function Documentation

◆ getActive()

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

Definition at line 150 of file DofsMultiIndices.hpp.

150 { return dof < 0 ? 0 : 1; }

◆ getDofCoeffIdx()

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

Definition at line 145 of file DofsMultiIndices.hpp.

145  {
146  return getEntDofIdx() % getNbOfCoeffs();
147  }
DofIdx getEntDofIdx() const

◆ getDofOrder()

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

Definition at line 140 of file DofsMultiIndices.hpp.

140  {
141  return getDofOrderMap()[getEntDofIdx()];
142  }

◆ getEnt()

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

Definition at line 137 of file DofsMultiIndices.hpp.

137 { return this->sPtr->getEnt(); }

◆ getEntDofIdx()

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

Definition at line 50 of file DofsMultiIndices.hpp.

50 { return std::abs(dof); }

◆ getEntGlobalUniqueId()

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

Definition at line 64 of file DofsMultiIndices.hpp.

64  {
65  return this->sPtr->getGlobalUniqueId();
66  }

◆ getEntLocalUniqueId()

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

Definition at line 59 of file DofsMultiIndices.hpp.

59  {
60  return this->sPtr->getLocalUniqueId();
61  }

◆ getFieldData()

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

Definition at line 53 of file DofsMultiIndices.hpp.

53  {
54  return const_cast<FieldData &>(
55  (*this->sPtr->getEntFieldDataPtr())[getEntDofIdx()]);
56  }
double FieldData
Field data type.
Definition: Types.hpp:36

◆ getGlobalUniqueId()

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

Definition at line 113 of file DofsMultiIndices.hpp.

113  {
114  return getUniqueIdCalculate(std::abs(dof), this->sPtr->getGlobalUniqueId());
115  }
static UId getUniqueIdCalculate(const DofIdx dof, UId ent_uid)

◆ 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 107 of file DofsMultiIndices.hpp.

108  {
109  return getUniqueIdCalculate(dof, ent_ptr->getGlobalUniqueId());
110  }

◆ getHiFieldEntityUId()

static UId MoFEM::DofEntity::getHiFieldEntityUId ( const FieldBitNumber  bit,
const EntityHandle  ent 
)
static

Definition at line 89 of file DofsMultiIndices.hpp.

90  {
93  }
auto bit
set bit
UId getLocalUniqueIdCalculate()
Get the Local Unique Id Calculate object.
static UId getHiFieldEntityUId(const UId &uid)

◆ getLocalUniqueId()

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

Definition at line 79 of file DofsMultiIndices.hpp.

79  {
80  return getUniqueIdCalculate(std::abs(dof), this->sPtr->getLocalUniqueId());
81  }

◆ getLocalUniqueIdCalculate()

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

Definition at line 73 of file DofsMultiIndices.hpp.

74  {
75  return getUniqueIdCalculate(dof, ent_ptr->getLocalUniqueId());
76  }

◆ getLoFieldEntityUId()

static UId MoFEM::DofEntity::getLoFieldEntityUId ( const FieldBitNumber  bit,
const EntityHandle  ent 
)
static

Definition at line 83 of file DofsMultiIndices.hpp.

84  {
87  }
static UId getLoFieldEntityUId(const UId &uid)

◆ getNonNonuniqueShortId() [1/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 132 of file DofsMultiIndices.hpp.

132  {
134  }
ShortId getNonNonuniqueShortId() const
get short uid it is unique in combination with entity handle

◆ getNonNonuniqueShortId() [2/2]

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

Definition at line 39 of file DofsMultiIndices.hpp.

40  {
41  return static_cast<ShortId>(dof) |
42  (static_cast<ShortId>(ent_ptr->getBitNumber()) << 9);
43  }
int ShortId
Unique Id in the field.
Definition: Types.hpp:43

◆ getUniqueIdCalculate()

static UId MoFEM::DofEntity::getUniqueIdCalculate ( const DofIdx  dof,
UId  ent_uid 
)
static
Examples
eigen_elastic.cpp, and heat_method.cpp.

Definition at line 68 of file DofsMultiIndices.hpp.

68  {
69  return ent_uid | dof;
70  }

Friends And Related Function Documentation

◆ DofEntity_active_change

friend struct DofEntity_active_change
friend

Definition at line 157 of file DofsMultiIndices.hpp.

◆ operator<<

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

Definition at line 50 of file DofsMultiIndices.cpp.

50  {
51  os << "dof_uid " << e.getLocalUniqueId() << " dof_order " << e.getDofOrder()
52  << " dof_rank " << e.getDofCoeffIdx() << " dof " << e.getEntDofIdx()
53  << " active " << (e.dof < 0 ? false : true) << " "
54  << *e.getFieldEntityPtr();
55  return os;
56 }

Member Data Documentation

◆ dof

DofIdx MoFEM::DofEntity::dof
private

Definition at line 155 of file DofsMultiIndices.hpp.


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