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

Provide data structure for (tensor) field approximation. More...

#include <src/multi_indices/FieldMultiIndices.hpp>

Public Types

using SequenceDofContainer = multi_index_container< boost::weak_ptr< std::vector< DofEntity > >, indexed_by< sequenced<> >>
 
typedef std::array< std::array< int, MAX_DOFS_ON_ENTITY >, MBMAXTYPE > DofsOrderMap
 

Public Member Functions

 Field (const moab::Interface &moab, const EntityHandle meshset, const boost::shared_ptr< CoordSys > coord_sys_ptr)
 constructor for moab field More...
 
virtual ~Field ()=default
 
FieldOrderTablegetFieldOrderTable ()
 Get the Field Order Table. More...
 
UId generateGlobalUniqueIdForTypeLo (const EntityType type, const int owner_proc) const
 
UId generateGlobalUniqueIdForTypeHi (const EntityType type, const int owner_proc) const
 
EntityHandle getMeshset () const
 Get field meshset. More...
 
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
 Get reference base vectors. More...
 
MoFEMErrorCode get_E_DualBase (const double m[]) const
 Get reference dual base vectors. More...
 
MoFEMErrorCode get_e_Base (const double m[]) const
 Get current dual base vectors. More...
 
MoFEMErrorCode get_e_DualBase (const double m[]) const
 Get current dual base vectors. More...
 
EntityHandle getCoordSysMeshSet () const
 Returns meshset on which Tags defining coordinate system are stored. More...
 
std::string getCoordSysName () const
 Get coordinate system name. More...
 
boost::string_ref getCoordSysNameRef () const
 Get coordinate system name. More...
 
const BitFieldIdgetId () const
 Get unique field id. More...
 
boost::string_ref getNameRef () const
 Get string reference to field name. More...
 
std::string getName () const
 Get field name. More...
 
FieldSpace getSpace () const
 Get field approximation space. More...
 
FieldApproximationBase getApproxBase () const
 Get approximation base. More...
 
FieldCoefficientsNumber getNbOfCoeffs () const
 Get number of field coefficients. More...
 
FieldBitNumber getBitNumber () const
 Get number of set bit in Field ID. Each field has uid, get getBitNumber get number of bit set for given field. Field ID has only one bit set for each field. More...
 
FieldBitNumber getBitNumberCalculate () const
 Calculate number of set bit in Field ID. Each field has uid, get getBitNumber get number of bit set for given field. Field ID has only one bit set for each field. More...
 
SequenceDofContainergetDofSequenceContainer () const
 Get reference to sequence data container. More...
 
std::array< ApproximationOrder, MAX_DOFS_ON_ENTITY > & getDofOrderMap (const EntityType type) const
 get hash-map relating dof index on entity with its order More...
 
DofsOrderMapgetDofOrderMap () const
 get hash-map relating dof index on entity with its order More...
 
MoFEMErrorCode rebuildDofsOrderMap () const
 
const FieldgetFieldRawPtr () const
 

Static Public Member Functions

static UId generateGlobalUniqueIdForTypeLo (const char bit_number, const EntityType type, const int owner_proc)
 
static UId generateGlobalUniqueIdForTypeHi (const char bit_number, const EntityType type, const int owner_proc)
 
static FieldBitNumber getBitNumberCalculate (const BitFieldId &id)
 Calculate number of set bit in Field ID. Each field has uid, get getBitNumber get number of bit set for given field. Field ID has only one bit set for each field. More...
 

Public Attributes

moab::Interface & moab
 
EntityHandle meshSet
 keeps entities for this meshset More...
 
boost::shared_ptr< CoordSyscoordSysPtr
 Pointer to field coordinate system data structure. More...
 
TagType th_FieldDataVertsType
 
Tag th_FieldDataVerts
 Tag storing field values on vertices in the field. More...
 
Tag th_FieldData
 Tag storing field values on entity in the field. More...
 
Tag th_AppOrder
 Tag storing approximation order on entity. More...
 
BitFieldIdtagId
 tag keeps field id More...
 
FieldSpacetagSpaceData
 tag keeps field space More...
 
FieldApproximationBasetagBaseData
 tag keeps field base More...
 
FieldCoefficientsNumbertagNbCoeffData
 
const void * tagName
 tag keeps name of the field More...
 
int tagNameSize
 number of bits necessary to keep field name More...
 
const void * tagNamePrefixData
 tag keeps name prefix of the field More...
 
int tagNamePrefixSize
 
FieldOrderTable forderTable
 nb. DOFs table for entities More...
 
unsigned int bitNumber
 

Private Attributes

SequenceDofContainer sequenceDofContainer
 
DofsOrderMap dofOrderMap
 

Friends

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

Detailed Description

Provide data structure for (tensor) field approximation.

The Field is intended to provide support for fields, with a strong bias towards supporting first and best the capabilities required for scientific computing applications. Since we work with discrete spaces, data structure has to carry information about type of approximation space, its regularity.

Field data structure storing information about space, approximation base, coordinate systems, etc. It stores additional data needed for book keeping, like tags to data on the mesh.

Each filed has unique ID and name. This data structure is shared between entities on which is spanning and DOFs on those entities.

Definition at line 64 of file FieldMultiIndices.hpp.

Member Typedef Documentation

◆ DofsOrderMap

typedef std::array<std::array<int, MAX_DOFS_ON_ENTITY>, MBMAXTYPE> MoFEM::Field::DofsOrderMap

Definition at line 83 of file FieldMultiIndices.hpp.

◆ SequenceDofContainer

using MoFEM::Field::SequenceDofContainer = multi_index_container< boost::weak_ptr<std::vector<DofEntity> >, indexed_by<sequenced<> >>

Definition at line 76 of file FieldMultiIndices.hpp.

Constructor & Destructor Documentation

◆ Field()

MoFEM::Field::Field ( const moab::Interface &  moab,
const EntityHandle  meshset,
const boost::shared_ptr< CoordSys coord_sys_ptr 
)

constructor for moab field

Parameters
meshsetwhich keeps entities for this field

Definition at line 29 of file FieldMultiIndices.cpp.

31  : moab(const_cast<moab::Interface &>(moab)), meshSet(meshset),
32  coordSysPtr(coord_sys_ptr), tagId(NULL), tagSpaceData(NULL),
33  tagNbCoeffData(NULL), tagName(NULL), tagNameSize(0) {
34 
35  auto get_tag_data_ptr = [&](const auto name, auto &tag_data) {
37  Tag th;
38  CHKERR moab.tag_get_handle(name, th);
39  CHKERR moab.tag_get_by_ptr(th, &meshset, 1, (const void **)&tag_data);
41  };
42 
43  // id
44  ierr = get_tag_data_ptr("_FieldId", tagId);
45  CHKERRABORT(PETSC_COMM_SELF, ierr);
46  // space
47  ierr = get_tag_data_ptr("_FieldSpace", tagSpaceData);
48  CHKERRABORT(PETSC_COMM_SELF, ierr);
49 
50  // approx. base
51  ierr = get_tag_data_ptr("_FieldBase", tagBaseData);
52  CHKERRABORT(PETSC_COMM_SELF, ierr);
53 
54  auto get_all_tags = [&]() {
56  // name
57  Tag th_field_name;
58  CHKERR moab.tag_get_handle("_FieldName", th_field_name);
59  CHKERR moab.tag_get_by_ptr(th_field_name, &meshSet, 1,
60  (const void **)&tagName, &tagNameSize);
61  // name prefix
62  Tag th_field_name_data_name_prefix;
63  CHKERR moab.tag_get_handle("_FieldName_DataNamePrefix",
64  th_field_name_data_name_prefix);
65  CHKERR moab.tag_get_by_ptr(th_field_name_data_name_prefix, &meshSet, 1,
66  (const void **)&tagNamePrefixData,
68  std::string name_data_prefix((char *)tagNamePrefixData, tagNamePrefixSize);
69  // data
70  std::string tag_data_name = name_data_prefix + getName();
71  CHKERR moab.tag_get_handle(tag_data_name.c_str(), th_FieldData);
72  std::string tag_data_name_verts = name_data_prefix + getName() + "V";
73  CHKERR moab.tag_get_handle(tag_data_name_verts.c_str(), th_FieldDataVerts);
75  // order
76  std::string tag_approximation_order_name = "_App_Order_" + getName();
77  CHKERR moab.tag_get_handle(tag_approximation_order_name.c_str(),
78  th_AppOrder);
79  // rank
80  Tag th_rank;
81  std::string Tag_rank_name = "_Field_Rank_" + getName();
82  CHKERR moab.tag_get_handle(Tag_rank_name.c_str(), th_rank);
83  CHKERR moab.tag_get_by_ptr(th_rank, &meshSet, 1,
84  (const void **)&tagNbCoeffData);
86  };
87 
88  ierr = get_all_tags();
89  CHKERRABORT(PETSC_COMM_SELF, ierr);
90 
92 
93  auto reset_entity_order_table = [&]() {
94  for (int tt = 0; tt != MBMAXTYPE; ++tt)
95  forderTable[tt] = NULL;
96  };
97 
98  auto set_entity_order_table = [&]() {
99  switch (*tagBaseData) {
102  switch (*tagSpaceData) {
103  case H1:
104  forderTable[MBVERTEX] = [](int P) -> int { return (P > 0) ? 1 : 0; };
105  forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_H1(P); };
106  forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_H1(P); };
107  forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_H1(P); };
108  forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_H1(P); };
109  forderTable[MBPRISM] = [](int P) -> int { return NBVOLUMEPRISM_H1(P); };
110  break;
111  case HCURL:
112  forderTable[MBVERTEX] = [](int P) -> int {
113  (void)P;
114  return 0;
115  };
116  forderTable[MBEDGE] = [](int P) -> int {
117  return NBEDGE_AINSWORTH_HCURL(P);
118  };
119  forderTable[MBTRI] = [](int P) -> int {
120  return NBFACETRI_AINSWORTH_HCURL(P);
121  };
122  forderTable[MBTET] = [](int P) -> int {
123  return NBVOLUMETET_AINSWORTH_HCURL(P);
124  };
125  break;
126  case HDIV:
127  forderTable[MBVERTEX] = [](int P) -> int {
128  (void)P;
129  return 0;
130  };
131  forderTable[MBEDGE] = [](int P) -> int {
132  (void)P;
133  return NBEDGE_HDIV(P);
134  };
135  forderTable[MBTRI] = [](int P) -> int {
136  return NBFACETRI_AINSWORTH_HDIV(P);
137  };
138  forderTable[MBTET] = [](int P) -> int {
139  return NBVOLUMETET_AINSWORTH_HDIV(P);
140  };
141  break;
142  case L2:
143  forderTable[MBVERTEX] = [](int P) -> int {
144  (void)P;
145  return 1;
146  };
147  forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_L2(P); };
148  forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_L2(P); };
149  forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_L2(P); };
150  forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_L2(P); };
151  break;
152  default:
153  THROW_MESSAGE("unknown approximation space");
154  }
155  break;
157  switch (*tagSpaceData) {
158  case H1:
159  forderTable[MBVERTEX] = [](int P) -> int { return (P > 0) ? 1 : 0; };
160  forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_H1(P); };
161  forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_H1(P); };
162  forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_H1(P); };
163  forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_H1(P); };
164  forderTable[MBPRISM] = [](int P) -> int { return NBVOLUMEPRISM_H1(P); };
165  break;
166  case L2:
167  forderTable[MBVERTEX] = [](int P) -> int {
168  (void)P;
169  return 1;
170  };
171  forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_L2(P); };
172  forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_L2(P); };
173  forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_L2(P); };
174  forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_L2(P); };
175  break;
176  default:
177  THROW_MESSAGE("unknown approximation space or not yet implemented");
178  }
179  break;
181  switch (*tagSpaceData) {
182  case H1:
183  forderTable[MBVERTEX] = [](int P) -> int { return (P > 0) ? 1 : 0; };
184  forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_H1(P); };
185  forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_H1(P); };
186  forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_H1(P); };
187  forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_H1(P); };
188  forderTable[MBPRISM] = [](int P) -> int { return NBVOLUMEPRISM_H1(P); };
189  break;
190  case HCURL:
191  forderTable[MBVERTEX] = [](int P) -> int {
192  (void)P;
193  return 0;
194  };
195  forderTable[MBEDGE] = [](int P) -> int {
196  return NBEDGE_DEMKOWICZ_HCURL(P);
197  };
198  forderTable[MBTRI] = [](int P) -> int {
199  return NBFACETRI_DEMKOWICZ_HCURL(P);
200  };
201  forderTable[MBQUAD] = [](int P) -> int {
202  return NBFACEQUAD_DEMKOWICZ_HCURL(P);
203  };
204  forderTable[MBTET] = [](int P) -> int {
205  return NBVOLUMETET_DEMKOWICZ_HCURL(P);
206  };
207  break;
208  case HDIV:
209  forderTable[MBVERTEX] = [](int P) -> int {
210  (void)P;
211  return 0;
212  };
213  forderTable[MBEDGE] = [](int P) -> int {
214  (void)P;
215  return 0;
216  };
217  forderTable[MBTRI] = [](int P) -> int {
218  return NBFACETRI_DEMKOWICZ_HDIV(P);
219  };
220  forderTable[MBTET] = [](int P) -> int {
221  return NBVOLUMETET_DEMKOWICZ_HDIV(P);
222  };
223  break;
224  case L2:
225  forderTable[MBVERTEX] = [](int P) -> int {
226  (void)P;
227  return 1;
228  };
229  forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_L2(P); };
230  forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_L2(P); };
231  forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_L2(P); };
232  forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_L2(P); };
233  break;
234  default:
235  THROW_MESSAGE("unknown approximation space or not yet implemented");
236  }
237  break;
238  case USER_BASE:
239  for (int ee = 0; ee < MBMAXTYPE; ee++) {
240  forderTable[ee] = [](int P) -> int {
241  (void)P;
242  return 0;
243  };
244  }
245  break;
246  default:
247  if (*tagSpaceData != NOFIELD) {
248  THROW_MESSAGE("unknown approximation base");
249  } else {
250  for (EntityType t = MBVERTEX; t < MBMAXTYPE; t++)
251  forderTable[t] = [](int P) -> int {
252  (void)P;
253  return 1;
254  };
255  }
256  }
257  };
258 
259  reset_entity_order_table();
260  set_entity_order_table();
262  CHKERRABORT(PETSC_COMM_SELF, ierr);
263 };
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:152
@ AINSWORTH_LOBATTO_BASE
Definition: definitions.h:154
@ USER_BASE
user implemented approximation base
Definition: definitions.h:160
@ DEMKOWICZ_JACOBI_BASE
Definition: definitions.h:158
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
Definition: definitions.h:156
@ L2
field with C-1 continuity
Definition: definitions.h:180
@ NOFIELD
scalar or vector of scalars describe (no true field)
Definition: definitions.h:176
@ H1
continuous field
Definition: definitions.h:177
@ HCURL
field with continuous tangents
Definition: definitions.h:178
@ HDIV
field with continuous normal traction
Definition: definitions.h:179
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define CHKERR
Inline error check.
Definition: definitions.h:604
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:628
#define NBEDGE_DEMKOWICZ_HCURL(P)
#define NBVOLUMETET_H1(P)
Number of base functions on tetrahedron for H1 space.
#define NBVOLUMETET_AINSWORTH_HDIV(P)
#define NBFACEQUAD_H1(P)
Number of base functions on quad for H1 space.
#define NBVOLUMETET_AINSWORTH_HCURL(P)
#define NBFACETRI_AINSWORTH_HCURL(P)
#define NBFACEQUAD_L2(P)
Number of base functions on quad for L2 space.
#define NBFACETRI_L2(P)
Number of base functions on triangle for L2 space.
#define NBVOLUMETET_DEMKOWICZ_HDIV(P)
#define NBEDGE_HDIV(P)
#define NBVOLUMEPRISM_H1(P)
Number of base functions on prism for H1 space.
#define NBFACEQUAD_DEMKOWICZ_HCURL(P)
#define NBEDGE_H1(P)
Numer of base function on edge for H1 space.
#define NBFACETRI_DEMKOWICZ_HDIV(P)
#define NBEDGE_L2(P)
Number of base functions on edge fro L2 space.
#define NBVOLUMETET_DEMKOWICZ_HCURL(P)
#define NBFACETRI_DEMKOWICZ_HCURL(P)
#define NBEDGE_AINSWORTH_HCURL(P)
#define NBFACETRI_H1(P)
Number of base function on triangle for H1 space.
#define NBFACETRI_AINSWORTH_HDIV(P)
#define NBVOLUMETET_L2(P)
Number of base functions on tetrahedron for L2 space.
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:87
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943
const void * tagNamePrefixData
tag keeps name prefix of the field
FieldOrderTable forderTable
nb. DOFs table for entities
const void * tagName
tag keeps name of the field
int tagNameSize
number of bits necessary to keep field name
std::string getName() const
Get field name.
unsigned int bitNumber
TagType th_FieldDataVertsType
EntityHandle meshSet
keeps entities for this meshset
FieldSpace * tagSpaceData
tag keeps field space
MoFEMErrorCode rebuildDofsOrderMap() const
FieldBitNumber getBitNumberCalculate() const
Calculate number of set bit in Field ID. Each field has uid, get getBitNumber get number of bit set f...
boost::shared_ptr< CoordSys > coordSysPtr
Pointer to field coordinate system data structure.
Tag th_FieldData
Tag storing field values on entity in the field.
FieldCoefficientsNumber * tagNbCoeffData
BitFieldId * tagId
tag keeps field id
Tag th_FieldDataVerts
Tag storing field values on vertices in the field.
FieldApproximationBase * tagBaseData
tag keeps field base
Tag th_AppOrder
Tag storing approximation order on entity.
moab::Interface & moab

◆ ~Field()

virtual MoFEM::Field::~Field ( )
virtualdefault

Member Function Documentation

◆ generateGlobalUniqueIdForTypeHi() [1/2]

static UId MoFEM::Field::generateGlobalUniqueIdForTypeHi ( const char  bit_number,
const EntityType  type,
const int  owner_proc 
)
static

Definition at line 138 of file FieldMultiIndices.hpp.

140  {
141  constexpr int ent_shift = 8 * sizeof(EntityHandle);
142  return (static_cast<UId>(type) << MB_ID_WIDTH |
143  static_cast<UId>(bit_number) << ent_shift |
144  static_cast<UId>(owner_proc) << 5 + ent_shift)
145  << 9;
146  }
#define MB_ID_WIDTH
Definition: definitions.h:296
uint128_t UId
Unique Id.
Definition: Types.hpp:42

◆ generateGlobalUniqueIdForTypeHi() [2/2]

UId MoFEM::Field::generateGlobalUniqueIdForTypeHi ( const EntityType  type,
const int  owner_proc 
) const

Definition at line 148 of file FieldMultiIndices.hpp.

149  {
150  return generateGlobalUniqueIdForTypeHi(bitNumber, type, owner_proc);
151  }
static UId generateGlobalUniqueIdForTypeHi(const char bit_number, const EntityType type, const int owner_proc)

◆ generateGlobalUniqueIdForTypeLo() [1/2]

static UId MoFEM::Field::generateGlobalUniqueIdForTypeLo ( const char  bit_number,
const EntityType  type,
const int  owner_proc 
)
static

Definition at line 123 of file FieldMultiIndices.hpp.

125  {
126  constexpr int ent_shift = 8 * sizeof(EntityHandle);
127  return (static_cast<UId>(type) << MB_ID_WIDTH |
128  static_cast<UId>(bit_number) << 8 * sizeof(EntityHandle) |
129  static_cast<UId>(owner_proc) << 5 + ent_shift)
130  << 9;
131  }

◆ generateGlobalUniqueIdForTypeLo() [2/2]

UId MoFEM::Field::generateGlobalUniqueIdForTypeLo ( const EntityType  type,
const int  owner_proc 
) const

Definition at line 133 of file FieldMultiIndices.hpp.

134  {
135  return generateGlobalUniqueIdForTypeLo(bitNumber, type, owner_proc);
136  }
static UId generateGlobalUniqueIdForTypeLo(const char bit_number, const EntityType type, const int owner_proc)

◆ get_E_Base()

MoFEMErrorCode MoFEM::Field::get_E_Base ( const double  m[]) const

Get reference base vectors.

Parameters
Arraywhere coefficients (covariant) are returned
Returns
Error code

Definition at line 185 of file FieldMultiIndices.hpp.

185  {
187  MoFEMFunctionReturnHot(coordSysPtr->get_E_Base(m));
188  }
static Index< 'm', 3 > m
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:516
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:509

◆ get_e_Base()

MoFEMErrorCode MoFEM::Field::get_e_Base ( const double  m[]) const

Get current dual base vectors.

Parameters
Arraywhere coefficients (covariant) are returned
Returns
Error code

Definition at line 205 of file FieldMultiIndices.hpp.

205  {
207  MoFEMFunctionReturnHot(coordSysPtr->get_e_Base(m));
208  }

◆ get_E_DualBase()

MoFEMErrorCode MoFEM::Field::get_E_DualBase ( const double  m[]) const

Get reference dual base vectors.

Parameters
Arraywhere coefficients (contravariant) are returned
Returns
Error code

Definition at line 195 of file FieldMultiIndices.hpp.

195  {
197  MoFEMFunctionReturnHot(coordSysPtr->get_E_DualBase(m));
198  }

◆ get_e_DualBase()

MoFEMErrorCode MoFEM::Field::get_e_DualBase ( const double  m[]) const

Get current dual base vectors.

Parameters
Arraywhere coefficients (covariant) are returned
Returns
Error code

Definition at line 215 of file FieldMultiIndices.hpp.

215  {
217  MoFEMFunctionReturnHot(coordSysPtr->get_e_DualBase(m));
218  }

◆ getApproxBase()

FieldApproximationBase MoFEM::Field::getApproxBase ( ) const

Get approximation base.

Returns
Approximation base

Definition at line 274 of file FieldMultiIndices.hpp.

274 { return *tagBaseData; }

◆ getBitNumber()

FieldBitNumber MoFEM::Field::getBitNumber ( ) const

Get number of set bit in Field ID. Each field has uid, get getBitNumber get number of bit set for given field. Field ID has only one bit set for each field.

Definition at line 299 of file FieldMultiIndices.hpp.

299 { return bitNumber; }

◆ getBitNumberCalculate() [1/2]

FieldBitNumber MoFEM::Field::getBitNumberCalculate ( ) const

Calculate number of set bit in Field ID. Each field has uid, get getBitNumber get number of bit set for given field. Field ID has only one bit set for each field.

Definition at line 320 of file FieldMultiIndices.hpp.

320  {
321  return getBitNumberCalculate(static_cast<BitFieldId &>(*tagId));
322  }
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
Definition: Types.hpp:53

◆ getBitNumberCalculate() [2/2]

static FieldBitNumber MoFEM::Field::getBitNumberCalculate ( const BitFieldId id)
static

Calculate number of set bit in Field ID. Each field has uid, get getBitNumber get number of bit set for given field. Field ID has only one bit set for each field.

Definition at line 306 of file FieldMultiIndices.hpp.

306  {
307  static_assert(BITFIELDID_SIZE >= 32,
308  "Too many fields allowed, can be more but ...");
309  FieldBitNumber b = ffsl(id.to_ulong());
310  if (b != 0)
311  return b;
312  return 0;
313  }
#define BITFIELDID_SIZE
max number of fields
Definition: definitions.h:287
char FieldBitNumber
Field bit number.
Definition: Types.hpp:39

◆ getCoordSysDim()

int MoFEM::Field::getCoordSysDim ( const int  d = 0) const

Get dimension of general two-point tensor MoFEM::CoordSys::getDim.

See details here MoFEM::CoordSys::getDim

Definition at line 176 of file FieldMultiIndices.hpp.

176  {
177  return coordSysPtr->getDim(d);
178  }
const Tensor1_Expr< const dTensor0< T, Dim, i >, typename promote< T, double >::V, Dim, i > d(const Tensor0< T * > &a, const Index< i, Dim > index, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: dTensor0.hpp:27

◆ getCoordSysMeshSet()

EntityHandle MoFEM::Field::getCoordSysMeshSet ( ) const

Returns meshset on which Tags defining coordinate system are stored.

Returns
Coordinate system EntityHandle

Definition at line 224 of file FieldMultiIndices.hpp.

224  {
225  return coordSysPtr->getMeshset();
226  }

◆ getCoordSysName()

std::string MoFEM::Field::getCoordSysName ( ) const

Get coordinate system name.

Returns
Coordinate system name

Definition at line 232 of file FieldMultiIndices.hpp.

232 { return coordSysPtr->getName(); }

◆ getCoordSysNameRef()

boost::string_ref MoFEM::Field::getCoordSysNameRef ( ) const

Get coordinate system name.

Returns
Return string_ref with name.

Definition at line 238 of file FieldMultiIndices.hpp.

238  {
239  return coordSysPtr->getNameRef();
240  }

◆ getDofOrderMap() [1/2]

DofsOrderMap& MoFEM::Field::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 368 of file FieldMultiIndices.hpp.

368  {
369  return const_cast<DofsOrderMap &>(dofOrderMap);
370  }
DofsOrderMap dofOrderMap
std::array< std::array< int, MAX_DOFS_ON_ENTITY >, MBMAXTYPE > DofsOrderMap

◆ getDofOrderMap() [2/2]

std::array<ApproximationOrder, MAX_DOFS_ON_ENTITY>& MoFEM::Field::getDofOrderMap ( const EntityType  type) 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 356 of file FieldMultiIndices.hpp.

356  {
357  return dofOrderMap[type];
358  }

◆ getDofSequenceContainer()

SequenceDofContainer& MoFEM::Field::getDofSequenceContainer ( ) const

Get reference to sequence data container.

In sequence data container data are physically stored. The purpose of this is to allocate DofEntity data in bulk, having only one allocation instead each time entity is inserted. That makes code efficient.

The vector in sequence is destroyed if last entity inside that vector is destroyed. All MoFEM::MoFEMEntities have aliased shared_ptr which points to the vector.

Not all DOFs are starred in this way, currently such cases are considered;

  • DOFs on vertices. That is exploited that for H1 space, there is some fixed number of DOFs on each vertex

For other cases, DOFs are stored locally in each MoFEM::MoFEMEntities.

Returns
MoFEM::Field::SequenceDofContainer

Definition at line 343 of file FieldMultiIndices.hpp.

343  {
344  return sequenceDofContainer;
345  }
SequenceDofContainer sequenceDofContainer

◆ getFieldOrderTable()

FieldOrderTable& MoFEM::Field::getFieldOrderTable ( )

Get the Field Order Table.

Returns
FieldOrderTable&

Definition at line 115 of file FieldMultiIndices.hpp.

115 { return forderTable; }

◆ getFieldRawPtr()

const Field* MoFEM::Field::getFieldRawPtr ( ) const

Definition at line 376 of file FieldMultiIndices.hpp.

376 { return this; };

◆ getId()

const BitFieldId& MoFEM::Field::getId ( ) const

Get unique field id.

Returns
Filed ID

Definition at line 246 of file FieldMultiIndices.hpp.

246 { return *((BitFieldId *)tagId); }

◆ getMeshset()

EntityHandle MoFEM::Field::getMeshset ( ) const

Get field meshset.

To meshsets entity are attached Tags which keeps basic information about field. Those information is field name, approximation base, approximation space, id, etc.

In meshset contains entities on which given filed is sparing. Type of entities depended on approximations space.

Returns
EntityHandle

Definition at line 167 of file FieldMultiIndices.hpp.

167 { return meshSet; }

◆ getName()

std::string MoFEM::Field::getName ( ) const

Get field name.

Returns
Field name

Definition at line 260 of file FieldMultiIndices.hpp.

260  {
261  return std::string((char *)tagName, tagNameSize);
262  }

◆ getNameRef()

boost::string_ref MoFEM::Field::getNameRef ( ) const

Get string reference to field name.

Returns
Field name

Definition at line 252 of file FieldMultiIndices.hpp.

252  {
253  return boost::string_ref((char *)tagName, tagNameSize);
254  }

◆ getNbOfCoeffs()

FieldCoefficientsNumber MoFEM::Field::getNbOfCoeffs ( ) const

Get number of field coefficients.

Scalar field has only one coefficient, vector field in 3D has three. In general number determine space needed to keep data on entities. What coefficient means depend on interpretation and associated coordinate system. For example 3 coefficient means could be covariant or contravariant, or mean three temperatures for mixture of solid, air and water, etc.

Definition at line 290 of file FieldMultiIndices.hpp.

290  {
291  return *tagNbCoeffData;
292  };

◆ getSpace()

FieldSpace MoFEM::Field::getSpace ( ) const

Get field approximation space.

Returns
approximation space

Definition at line 268 of file FieldMultiIndices.hpp.

268 { return *tagSpaceData; }

◆ rebuildDofsOrderMap()

MoFEMErrorCode MoFEM::Field::rebuildDofsOrderMap ( ) const

Definition at line 265 of file FieldMultiIndices.cpp.

265  {
267 
268  for (auto t = MBVERTEX; t != MBMAXTYPE; ++t) {
269 
270  int DD = 0;
271  int nb_last_order_dofs = 0;
272  const int rank = (*tagNbCoeffData);
273 
274  if (forderTable[t]) {
275 
276  for (int oo = 0; oo < MAX_DOFS_ON_ENTITY; ++oo) {
277 
278  const int nb_order_dofs = forderTable[t](oo);
279  const int diff_oo = nb_order_dofs - nb_last_order_dofs;
280  if (diff_oo >= 0) {
281 
282  if ((DD + rank * diff_oo) < MAX_DOFS_ON_ENTITY)
283  for (int dd = 0; dd < diff_oo; ++dd)
284  for (int rr = 0; rr != rank; ++rr, ++DD)
285  dofOrderMap[t][DD] = oo;
286  else
287  break;
288 
289  nb_last_order_dofs = nb_order_dofs;
290 
291  } else {
292  break;
293  }
294  }
295  }
296 
297  std::fill(&dofOrderMap[t][DD], dofOrderMap[t].end(), -1);
298  }
299 
301 }
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
Definition: definitions.h:305
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 303 of file FieldMultiIndices.cpp.

303  {
304  os << e.getNameRef() << " field_id " << e.getId().to_ulong() << " space "
305  << FieldSpaceNames[e.getSpace()] << " approximation base "
306  << ApproximationBaseNames[e.getApproxBase()] << " rank "
307  << e.getNbOfCoeffs() << " meshset " << e.meshSet;
308  return os;
309 }
static const char *const FieldSpaceNames[]
Definition: definitions.h:184
static const char *const ApproximationBaseNames[]
Definition: definitions.h:164

Member Data Documentation

◆ bitNumber

unsigned int MoFEM::Field::bitNumber

Field Id is bit set. Each field has only one bit on, bitNumber stores number of set bit

Definition at line 121 of file FieldMultiIndices.hpp.

◆ coordSysPtr

boost::shared_ptr<CoordSys> MoFEM::Field::coordSysPtr

Pointer to field coordinate system data structure.

Definition at line 89 of file FieldMultiIndices.hpp.

◆ dofOrderMap

DofsOrderMap MoFEM::Field::dofOrderMap
mutableprivate

Definition at line 380 of file FieldMultiIndices.hpp.

◆ forderTable

FieldOrderTable MoFEM::Field::forderTable

nb. DOFs table for entities

Definition at line 108 of file FieldMultiIndices.hpp.

◆ meshSet

EntityHandle MoFEM::Field::meshSet

keeps entities for this meshset

Definition at line 87 of file FieldMultiIndices.hpp.

◆ moab

moab::Interface& MoFEM::Field::moab

Definition at line 85 of file FieldMultiIndices.hpp.

◆ sequenceDofContainer

SequenceDofContainer MoFEM::Field::sequenceDofContainer
mutableprivate

Definition at line 379 of file FieldMultiIndices.hpp.

◆ tagBaseData

FieldApproximationBase* MoFEM::Field::tagBaseData

tag keeps field base

Definition at line 98 of file FieldMultiIndices.hpp.

◆ tagId

BitFieldId* MoFEM::Field::tagId

tag keeps field id

Definition at line 96 of file FieldMultiIndices.hpp.

◆ tagName

const void* MoFEM::Field::tagName

tag keeps name of the field

Definition at line 103 of file FieldMultiIndices.hpp.

◆ tagNamePrefixData

const void* MoFEM::Field::tagNamePrefixData

tag keeps name prefix of the field

Definition at line 105 of file FieldMultiIndices.hpp.

◆ tagNamePrefixSize

int MoFEM::Field::tagNamePrefixSize

number of bits necessary to keep field name prefix

Definition at line 106 of file FieldMultiIndices.hpp.

◆ tagNameSize

int MoFEM::Field::tagNameSize

number of bits necessary to keep field name

Definition at line 104 of file FieldMultiIndices.hpp.

◆ tagNbCoeffData

FieldCoefficientsNumber* MoFEM::Field::tagNbCoeffData

tag keeps field rank (dimension, f.e. Temperature field has rank 1, displacements field in 3d has rank 3)

Definition at line 102 of file FieldMultiIndices.hpp.

◆ tagSpaceData

FieldSpace* MoFEM::Field::tagSpaceData

tag keeps field space

Definition at line 97 of file FieldMultiIndices.hpp.

◆ th_AppOrder

Tag MoFEM::Field::th_AppOrder

Tag storing approximation order on entity.

Definition at line 94 of file FieldMultiIndices.hpp.

◆ th_FieldData

Tag MoFEM::Field::th_FieldData

Tag storing field values on entity in the field.

Definition at line 93 of file FieldMultiIndices.hpp.

◆ th_FieldDataVerts

Tag MoFEM::Field::th_FieldDataVerts

Tag storing field values on vertices in the field.

Definition at line 92 of file FieldMultiIndices.hpp.

◆ th_FieldDataVertsType

TagType MoFEM::Field::th_FieldDataVertsType

Definition at line 91 of file FieldMultiIndices.hpp.


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