v0.9.1
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes | Friends | List of all members
MoFEM::FieldEntity Struct Reference

Struct keeps handle to entity in the field. More...

#include <src/multi_indices/EntsMultiIndices.hpp>

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

Public Types

typedef interface_Field< Fieldinterface_type_Field
 
typedef interface_RefEntity< RefEntityinterface_type_RefEntity
 

Public Member Functions

 FieldEntity (const boost::shared_ptr< Field > &field_ptr, const boost::shared_ptr< RefEntity > &ref_ents_ptr, boost::shared_ptr< double *const > &&field_data_adaptor_ptr, boost::shared_ptr< const int > &&t_max_order_ptr)
 
virtual ~FieldEntity ()=default
 
EntityHandle getEnt () const
 Get entity handle. More...
 
int getNbDofsOnEnt () const
 Get number of active DOFs on entity. More...
 
boost::shared_ptr< FieldData *const > & getEntFieldDataPtr () const
 Get shared ptr to vector adaptor pointing to the field tag data on entity. More...
 
VectorAdaptor getEntFieldData () const
 Get vector of DOFs active values on entity. More...
 
int getOrderNbDofs (ApproximationOrder order) const
 Get number of DOFs on entity for given order of approximation. More...
 
int getOrderNbDofsDiff (ApproximationOrder order) const
 Get difference of number of DOFs between order and order-1. More...
 
const ApproximationOrdergetMaxOrderPtr () const
 Get pinter to Tag keeping approximation order. More...
 
ApproximationOrder getMaxOrder () const
 Get order set to the entity (Allocated tag size for such number) More...
 
const UIdgetGlobalUniqueId () const
 Get global unique id. More...
 
UId getGlobalUniqueIdCalculate () const
 Calculate global UId. More...
 
boost::shared_ptr< RefEntity > & getRefEntityPtr ()
 Get pointer to RefEntity. More...
 
boost::shared_ptr< Field > & getFieldPtr () const
 Get pointer to Field data structure associated with this entity. More...
 
std::array< int, MAX_DOFS_ON_ENTITY > & getDofOrderMap () const
 get hash-map relating dof index on entity with its order More...
 
- Public Member Functions inherited from MoFEM::interface_Field< Field >
 interface_Field (const boost::shared_ptr< Field > &field_ptr)
 
 interface_Field (const interface_Field< Field > &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< Field > & 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< RefEntity >
 interface_RefEntity (const boost::shared_ptr< RefEntity > &sptr)
 
 interface_RefEntity (const interface_RefEntity< RefEntity > &interface)
 
virtual ~interface_RefEntity ()=default
 
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
 
int & getOwnerProc ()
 
int getPartProc () const
 
int & getPartProc ()
 
unsigned char getPStatus () const
 
int * getSharingProcsPtr () const
 
EntityHandlegetSharingHandlersPtr () const
 
boost::shared_ptr< RefEntity > & getRefEntityPtr () const
 

Static Public Member Functions

static boost::shared_ptr< FieldData *const > makeSharedFieldDataAdaptorPtr (const boost::shared_ptr< Field > &field_ptr, const boost::shared_ptr< RefEntity > &ref_ents_ptr)
 Return shared pointer to entity field data vector adaptor. More...
 
static UId getGlobalUniqueIdCalculate (const int owner_proc, const char bit_number, const EntityHandle moab_owner_handle, const bool true_if_distributed_mesh)
 Calculate UId for field entity. More...
 
static UId getGlobalUniqueIdCalculate_Low_Proc (const int owner_proc)
 
static UId getGlobalUniqueIdCalculate_Hi_Proc (const int owner_proc)
 

Public Attributes

UId globalUId
 Global unique id for this entity. More...
 
- Public Attributes inherited from MoFEM::interface_Field< Field >
boost::shared_ptr< FieldsFieldPtr
 
- Public Attributes inherited from MoFEM::interface_RefEntity< RefEntity >
boost::shared_ptr< RefEntitysPtr
 

Private Attributes

boost::shared_ptr< const ApproximationOrdertagMaxOrderPtr
 
boost::shared_ptr< FieldData *const > fieldDataAdaptorPtr
 

Friends

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

Detailed Description

Struct keeps handle to entity in the field.

Definition at line 573 of file EntsMultiIndices.hpp.

Member Typedef Documentation

◆ interface_type_Field

Definition at line 576 of file EntsMultiIndices.hpp.

◆ interface_type_RefEntity

Definition at line 577 of file EntsMultiIndices.hpp.

Constructor & Destructor Documentation

◆ FieldEntity()

MoFEM::FieldEntity::FieldEntity ( const boost::shared_ptr< Field > &  field_ptr,
const boost::shared_ptr< RefEntity > &  ref_ents_ptr,
boost::shared_ptr< double *const > &&  field_data_adaptor_ptr,
boost::shared_ptr< const int > &&  t_max_order_ptr 
)

Definition at line 147 of file EntsMultiIndices.cpp.

152  : interface_Field<Field>(field_ptr), interface_RefEntity<RefEntity>(
153  ref_ents_ptr),
154  tagMaxOrderPtr(t_max_order_ptr),
155  fieldDataAdaptorPtr(field_data_adaptor_ptr) {
157 
158  if (PetscUnlikely(!fieldDataAdaptorPtr))
159  THROW_MESSAGE("Pointer to field data adaptor not set");
160 
161  if (PetscUnlikely(!tagMaxOrderPtr))
162  THROW_MESSAGE("Pointer to max order not set");
163 }
UId getGlobalUniqueIdCalculate() const
Calculate global UId.
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:626
UId globalUId
Global unique id for this entity.
boost::shared_ptr< FieldData *const > fieldDataAdaptorPtr
boost::shared_ptr< const ApproximationOrder > tagMaxOrderPtr

◆ ~FieldEntity()

virtual MoFEM::FieldEntity::~FieldEntity ( )
virtualdefault

Member Function Documentation

◆ getDofOrderMap()

std::array<int, MAX_DOFS_ON_ENTITY>& MoFEM::FieldEntity::getDofOrderMap ( ) const

get hash-map relating dof index on entity with its order

DOFs of given field are indexed on entity of the same type, same space, approximation base and number of coefficients, are sorted in the way.

Definition at line 740 of file EntsMultiIndices.hpp.

740  {
741  return getFieldPtr()->getDofOrderMap(getEntType());
742  }
boost::shared_ptr< Field > & getFieldPtr() const
Get pointer to Field data structure associated with this entity.

◆ getEnt()

EntityHandle MoFEM::FieldEntity::getEnt ( ) const

Get entity handle.

Returns
EntityHandle

Definition at line 591 of file EntsMultiIndices.hpp.

591 { return getRefEnt(); }

◆ getEntFieldData()

VectorAdaptor MoFEM::FieldEntity::getEntFieldData ( ) const

Get vector of DOFs active values on entity.

Returns
Vector of DOFs values

Definition at line 624 of file EntsMultiIndices.hpp.

624  {
626  }
auto getVectorAdaptor(T1 ptr, const size_t n)
Get Vector adaptor.
Definition: Templates.hpp:42
int getNbDofsOnEnt() const
Get number of active DOFs on entity.
boost::shared_ptr< FieldData *const > fieldDataAdaptorPtr

◆ getEntFieldDataPtr()

boost::shared_ptr<FieldData *const>& MoFEM::FieldEntity::getEntFieldDataPtr ( ) const

Get shared ptr to vector adaptor pointing to the field tag data on entity.

Returns
boost::shared_ptr<VectorAdaptor>&

Definition at line 616 of file EntsMultiIndices.hpp.

616  {
617  return fieldDataAdaptorPtr;
618  }
boost::shared_ptr< FieldData *const > fieldDataAdaptorPtr

◆ getFieldPtr()

boost::shared_ptr<Field>& MoFEM::FieldEntity::getFieldPtr ( ) const

Get pointer to Field data structure associated with this entity.

Definition at line 726 of file EntsMultiIndices.hpp.

726  {
727  return this->sFieldPtr;
728  }
boost::shared_ptr< Field > sFieldPtr

◆ getGlobalUniqueId()

const UId& MoFEM::FieldEntity::getGlobalUniqueId ( ) const

Get global unique id.

Returns
Global UId

Definition at line 666 of file EntsMultiIndices.hpp.

666 { return globalUId; }
UId globalUId
Global unique id for this entity.

◆ getGlobalUniqueIdCalculate() [1/2]

static UId MoFEM::FieldEntity::getGlobalUniqueIdCalculate ( const int  owner_proc,
const char  bit_number,
const EntityHandle  moab_owner_handle,
const bool  true_if_distributed_mesh 
)
static

Calculate UId for field entity.

UId is constructed such that all DOFs are ordered by processor, entity, field.

Parameters
owner_procowning processor
bit_numberfield bit number
moab_owner_handleentity handle on owning processor
true_if_distributed_meshif true UId is constructed for distributed meshes
Returns
UId

Definition at line 682 of file EntsMultiIndices.hpp.

684  {
685  // assert(bit_number < 32);
686  // assert(owner_proc < 1024);
687  constexpr int ent_shift = 8 * sizeof(EntityHandle);
688  if (true_if_distributed_mesh)
689  return (static_cast<UId>(moab_owner_handle) |
690  static_cast<UId>(bit_number) << ent_shift |
691  static_cast<UId>(owner_proc) << 5 + ent_shift)
692  << 9;
693  else
694  return (static_cast<UId>(moab_owner_handle) | static_cast<UId>(bit_number)
695  << ent_shift)
696  << 9;
697  }

◆ getGlobalUniqueIdCalculate() [2/2]

UId MoFEM::FieldEntity::getGlobalUniqueIdCalculate ( ) const

Calculate global UId.

Returns
Global UId

Definition at line 712 of file EntsMultiIndices.hpp.

712  {
714  sPtr->owner_proc, getBitNumber(), sPtr->moab_owner_handle,
715  getBasicDataPtr()->trueIfDistributedMesh());
716  }
boost::shared_ptr< RefEntity > sPtr
UId getGlobalUniqueIdCalculate() const
Calculate global UId.
boost::shared_ptr< BasicEntityData > & getBasicDataPtr()

◆ getGlobalUniqueIdCalculate_Hi_Proc()

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

Definition at line 703 of file EntsMultiIndices.hpp.

703  {
704  return getGlobalUniqueIdCalculate(owner_proc, BITFIELDID_SIZE - 1,
705  MBMAXTYPE, true);
706  }
UId getGlobalUniqueIdCalculate() const
Calculate global UId.
#define BITFIELDID_SIZE
max number of fields
Definition: definitions.h:286

◆ getGlobalUniqueIdCalculate_Low_Proc()

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

Definition at line 699 of file EntsMultiIndices.hpp.

699  {
700  return getGlobalUniqueIdCalculate(owner_proc, 0, 0, true);
701  }
UId getGlobalUniqueIdCalculate() const
Calculate global UId.

◆ getMaxOrder()

ApproximationOrder MoFEM::FieldEntity::getMaxOrder ( ) const

Get order set to the entity (Allocated tag size for such number)

Returns
Approximation order

Definition at line 658 of file EntsMultiIndices.hpp.

658  {
659  return *tagMaxOrderPtr.get();
660  }
boost::shared_ptr< const ApproximationOrder > tagMaxOrderPtr

◆ getMaxOrderPtr()

const ApproximationOrder* MoFEM::FieldEntity::getMaxOrderPtr ( ) const

Get pinter to Tag keeping approximation order.

Returns
Pointer to Tag

Definition at line 650 of file EntsMultiIndices.hpp.

650  {
651  return tagMaxOrderPtr.get();
652  }
boost::shared_ptr< const ApproximationOrder > tagMaxOrderPtr

◆ getNbDofsOnEnt()

int MoFEM::FieldEntity::getNbDofsOnEnt ( ) const

Get number of active DOFs on entity.

Returns
Number of DOFs

Definition at line 597 of file EntsMultiIndices.hpp.

597  {
599  }
int getOrderNbDofs(ApproximationOrder order) const
Get number of DOFs on entity for given order of approximation.
FieldCoefficientsNumber getNbOfCoeffs() const
ApproximationOrder getMaxOrder() const
Get order set to the entity (Allocated tag size for such number)

◆ getOrderNbDofs()

int MoFEM::FieldEntity::getOrderNbDofs ( ApproximationOrder  order) const

Get number of DOFs on entity for given order of approximation.

Parameters
orderOrder of approximation
Returns
Number of DOFs

Definition at line 633 of file EntsMultiIndices.hpp.

633  {
634  return (this->sFieldPtr->forderTable[getEntType()])(order);
635  }
constexpr int order
boost::shared_ptr< Field > sFieldPtr

◆ getOrderNbDofsDiff()

int MoFEM::FieldEntity::getOrderNbDofsDiff ( ApproximationOrder  order) const

Get difference of number of DOFs between order and order-1.

Parameters
orderApproximation order
Returns
Difference number of DOFs

Definition at line 642 of file EntsMultiIndices.hpp.

642  {
643  return getOrderNbDofs(order) - getOrderNbDofs(order - 1);
644  }
int getOrderNbDofs(ApproximationOrder order) const
Get number of DOFs on entity for given order of approximation.
constexpr int order

◆ getRefEntityPtr()

boost::shared_ptr<RefEntity>& MoFEM::FieldEntity::getRefEntityPtr ( )

Get pointer to RefEntity.

Definition at line 721 of file EntsMultiIndices.hpp.

721 { return this->sPtr; }
boost::shared_ptr< RefEntity > sPtr

◆ makeSharedFieldDataAdaptorPtr()

boost::shared_ptr< FieldData *const > MoFEM::FieldEntity::makeSharedFieldDataAdaptorPtr ( const boost::shared_ptr< Field > &  field_ptr,
const boost::shared_ptr< RefEntity > &  ref_ents_ptr 
)
static

Return shared pointer to entity field data vector adaptor.

Returns
boost::shared_ptr<VectorAdaptor>

Definition at line 165 of file EntsMultiIndices.cpp.

167  {
168  int size;
169  double *ptr;
170  switch (ref_ents_ptr->getEntType()) {
171  case MBVERTEX:
172  size = field_ptr->getNbOfCoeffs();
173  ptr = static_cast<FieldData *>(
174  MoFEM::get_tag_ptr(field_ptr->moab, field_ptr->th_FieldDataVerts,
175  ref_ents_ptr->ent, &size));
176  break;
177  default:
178  ptr = static_cast<FieldData *>(MoFEM::get_tag_ptr(
179  field_ptr->moab, field_ptr->th_FieldData, ref_ents_ptr->ent, &size));
180  }
181  return boost::make_shared<FieldData *const>(ptr);
182 }
void * get_tag_ptr(moab::Interface &moab, Tag th, EntityHandle ent, int *tag_size)

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 184 of file EntsMultiIndices.cpp.

184  {
185  os << "ent_global_uid "
186  << (UId)e.getGlobalUniqueId()
187  // << " ent_local_uid " << (UId)e.get_local_unique_id()
188  << " entity " << e.getEnt() << " type " << e.getEntType() << " pstatus "
189  << std::bitset<8>(e.getPStatus()) << " owner handle " << e.getOwnerEnt()
190  << " owner proc " << e.getOwnerProc() << " order " << e.getMaxOrder()
191  << " " << *e.sFieldPtr;
192  return os;
193 }
uint128_t UId
Unique Id.
Definition: Types.hpp:41

Member Data Documentation

◆ fieldDataAdaptorPtr

boost::shared_ptr<FieldData *const> MoFEM::FieldEntity::fieldDataAdaptorPtr
mutableprivate

Definition at line 746 of file EntsMultiIndices.hpp.

◆ globalUId

UId MoFEM::FieldEntity::globalUId

Global unique id for this entity.

Definition at line 578 of file EntsMultiIndices.hpp.

◆ tagMaxOrderPtr

boost::shared_ptr<const ApproximationOrder> MoFEM::FieldEntity::tagMaxOrderPtr
mutableprivate

Definition at line 745 of file EntsMultiIndices.hpp.


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