v0.14.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>

Collaboration diagram for MoFEM::Field:
[legend]

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 (moab::Interface &moab, const EntityHandle meshset)
 constructor for moab field More...
 
virtual ~Field ()=default
 
FieldOrderTablegetFieldOrderTable ()
 Get the Field Order Table. More...
 
EntityHandle getMeshset () const
 Get field meshset. 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...
 
auto getSpaceName () const
 Get field approximation space. More...
 
FieldContinuity getContinuity () const
 Get field space continuity. More...
 
auto getContinuityName () const
 Get field space continuity name. More...
 
FieldApproximationBase getApproxBase () const
 Get approximation base. More...
 
auto getApproxBaseName () 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...
 
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 DofsOrderMapgetDofOrderMap () const
 get hash-map relating dof index on entity with its order More...
 
MoFEMErrorCode rebuildDofsOrderMap ()
 
const FieldgetFieldRawPtr () const
 

Static Public Member Functions

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...
 
TagType tagFieldDataVertsType
 
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...
 
Tag th_FieldRank
 
BitFieldIdtagId
 Tag field rank. More...
 
FieldSpacetagSpaceData
 tag keeps field space More...
 
FieldContinuitytagFieldContinuityData
 tag keeps field continuity 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.

Examples
EshelbianPlasticity.cpp, forces_and_sources_testing_users_base.cpp, and scalar_check_approximation.cpp.

Definition at line 51 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 69 of file FieldMultiIndices.hpp.

◆ SequenceDofContainer

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

Definition at line 66 of file FieldMultiIndices.hpp.

Constructor & Destructor Documentation

◆ Field()

MoFEM::Field::Field ( moab::Interface &  moab,
const EntityHandle  meshset 
)

constructor for moab field

Parameters
meshsetwhich keeps entities for this field

Definition at line 15 of file FieldMultiIndices.cpp.

16  : moab(moab), meshSet(meshset), tagId(NULL), tagSpaceData(NULL),
17  tagFieldContinuityData(NULL), tagNbCoeffData(NULL), tagName(NULL),
18  tagNameSize(0) {
19 
20  auto get_tag_data_ptr = [&](const auto name, auto &tag_data) {
22  Tag th;
23  CHKERR moab.tag_get_handle(name, th);
24  CHKERR moab.tag_get_by_ptr(th, &meshset, 1, (const void **)&tag_data);
26  };
27 
28  // id
29  ierr = get_tag_data_ptr("_FieldId", tagId);
30  CHKERRABORT(PETSC_COMM_SELF, ierr);
31  // space
32  ierr = get_tag_data_ptr("_FieldSpace", tagSpaceData);
33  CHKERRABORT(PETSC_COMM_SELF, ierr);
34  // continuity
35  ierr = get_tag_data_ptr("_FieldContinuity", tagFieldContinuityData);
36  CHKERRABORT(PETSC_COMM_SELF, ierr);
37 
38  // approx. base
39  ierr = get_tag_data_ptr("_FieldBase", tagBaseData);
40  CHKERRABORT(PETSC_COMM_SELF, ierr);
41 
42  // name
43  Tag th_field_name;
44  CHKERR moab.tag_get_handle("_FieldName", th_field_name);
45  CHKERR moab.tag_get_by_ptr(th_field_name, &meshSet, 1,
46  (const void **)&tagName, &tagNameSize);
47  // name prefix
48  Tag th_field_name_data_name_prefix;
49  CHKERR moab.tag_get_handle("_FieldName_DataNamePrefix",
50  th_field_name_data_name_prefix);
51  CHKERR moab.tag_get_by_ptr(th_field_name_data_name_prefix, &meshSet, 1,
52  (const void **)&tagNamePrefixData,
54  std::string name_data_prefix((char *)tagNamePrefixData, tagNamePrefixSize);
55 
56  // rank
57  std::string Tag_rank_name = "_Field_Rank_" + getName();
58  CHKERR moab.tag_get_handle(Tag_rank_name.c_str(), th_FieldRank);
59  CHKERR moab.tag_get_by_ptr(th_FieldRank, &meshSet, 1,
60  (const void **)&tagNbCoeffData);
61 
62  auto get_all_tags = [&]() {
64  // order
65  ApproximationOrder def_approx_order = -1;
66  std::string tag_approximation_order_name = "_App_Order_" + getName();
67  rval = moab.tag_get_handle(tag_approximation_order_name.c_str(), 1,
68  MB_TYPE_INTEGER, th_AppOrder,
69  MB_TAG_CREAT | MB_TAG_SPARSE, &def_approx_order);
70  if (rval == MB_ALREADY_ALLOCATED)
71  rval = MB_SUCCESS;
73 
74  // data
75  std::string tag_data_name = name_data_prefix + getName();
76  const int def_len = 0;
77  rval = moab.tag_get_handle(
78  tag_data_name.c_str(), def_len, MB_TYPE_DOUBLE, th_FieldData,
79  MB_TAG_CREAT | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
80  if (rval == MB_ALREADY_ALLOCATED)
81  rval = MB_SUCCESS;
83 
84  std::string tag_data_name_verts = name_data_prefix + getName() + "_V";
85  rval = moab.tag_get_handle(tag_data_name_verts.c_str(), th_FieldDataVerts);
86  if (rval == MB_SUCCESS)
88  else {
89  // Since vertex tag is not it mesh that tag is not dense, it is sparse,
90  // sinc it is set to all vertices on the mesh. Is unlikely that mesh has
91  // no vertices, then above assumption does not hold.
92  tagFieldDataVertsType = MB_TAG_SPARSE;
93  VectorDouble def_vert_data(*tagNbCoeffData);
94  def_vert_data.clear();
95  rval = moab.tag_get_handle(tag_data_name_verts.c_str(), *tagNbCoeffData,
96  MB_TYPE_DOUBLE, th_FieldDataVerts,
97  MB_TAG_CREAT | tagFieldDataVertsType,
98  &*def_vert_data.begin());
99  if (rval == MB_ALREADY_ALLOCATED)
100  rval = MB_SUCCESS;
101  MOAB_THROW(rval);
102  }
103 
105  };
106 
107  auto get_all_tags_deprecated = [&]() {
109  // order
110  ApproximationOrder def_approx_order = -1;
111  std::string tag_approximation_order_name = "_App_Order_" + getName();
112  rval = moab.tag_get_handle(tag_approximation_order_name.c_str(), 1,
113  MB_TYPE_INTEGER, th_AppOrder,
114  MB_TAG_CREAT | MB_TAG_SPARSE, &def_approx_order);
115  if (rval == MB_ALREADY_ALLOCATED)
116  rval = MB_SUCCESS;
117  MOAB_THROW(rval);
118 
119  // data
120  std::string tag_data_name = name_data_prefix + getName();
121  const int def_len = 0;
122  rval = moab.tag_get_handle(
123  tag_data_name.c_str(), def_len, MB_TYPE_DOUBLE, th_FieldData,
124  MB_TAG_CREAT | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
125  if (rval == MB_ALREADY_ALLOCATED)
126  rval = MB_SUCCESS;
127  MOAB_THROW(rval);
128 
129  std::string tag_data_name_verts = name_data_prefix + getName() + "V";
130  rval = moab.tag_get_handle(tag_data_name_verts.c_str(), th_FieldDataVerts);
131  if (rval == MB_SUCCESS)
133  else {
134  // Since vertex tag is not it mesh that tag is not dense, it is sparse,
135  // sinc it is set to all vertices on the mesh. Is unlikely that mesh has
136  // no vertices, then above assumption does not hold.
137  tagFieldDataVertsType = MB_TAG_SPARSE;
138  VectorDouble def_vert_data(*tagNbCoeffData);
139  def_vert_data.clear();
140  rval = moab.tag_get_handle(tag_data_name_verts.c_str(), *tagNbCoeffData,
141  MB_TYPE_DOUBLE, th_FieldDataVerts,
142  MB_TAG_CREAT | tagFieldDataVertsType,
143  &*def_vert_data.begin());
144  if (rval == MB_ALREADY_ALLOCATED)
145  rval = MB_SUCCESS;
146  MOAB_THROW(rval);
147  }
148 
150  };
151 
152  Version file_ver;
154  CHK_THROW_MESSAGE(ierr, "Not known file version");
155  if (file_ver.majorVersion >= 0 && file_ver.minorVersion >= 12 &&
156  file_ver.buildVersion >= 1) {
157  ierr = get_all_tags();
158  CHKERRABORT(PETSC_COMM_SELF, ierr);
159  } else {
160  ierr = get_all_tags_deprecated();
161  CHKERRABORT(PETSC_COMM_SELF, ierr);
162  }
163 
165 
166  auto reset_entity_order_table = [&]() {
167  for (int tt = 0; tt != MBMAXTYPE; ++tt)
168  forderTable[tt] = NULL;
169  };
170 
171  auto set_continuos_entity_order_table = [&]() {
172  switch (*tagBaseData) {
175  switch (*tagSpaceData) {
176  case H1:
177  forderTable[MBVERTEX] = [](int P) -> int { return (P > 0) ? 1 : 0; };
178  forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_H1(P); };
179  forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_H1(P); };
180  forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_H1(P); };
181  forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_H1(P); };
182  forderTable[MBHEX] = [](int P) -> int { return NBVOLUMEHEX_H1(P); };
183  forderTable[MBPRISM] = [](int P) -> int { return NBVOLUMEPRISM_H1(P); };
184  break;
185  case HCURL:
186  forderTable[MBVERTEX] = [](int P) -> int {
187  (void)P;
188  return 0;
189  };
190  forderTable[MBEDGE] = [](int P) -> int {
191  return NBEDGE_AINSWORTH_HCURL(P);
192  };
193  forderTable[MBTRI] = [](int P) -> int {
195  };
196  forderTable[MBTET] = [](int P) -> int {
198  };
199  break;
200  case HDIV:
201  forderTable[MBVERTEX] = [](int P) -> int {
202  (void)P;
203  return 0;
204  };
205  forderTable[MBEDGE] = [](int P) -> int {
206  (void)P;
207  return NBEDGE_HDIV(P);
208  };
209  forderTable[MBTRI] = [](int P) -> int {
210  return NBFACETRI_AINSWORTH_HDIV(P);
211  };
212  forderTable[MBTET] = [](int P) -> int {
214  };
215  break;
216  case L2:
217  forderTable[MBVERTEX] = [](int P) -> int {
218  (void)P;
219  return 1;
220  };
221  forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_L2(P); };
222  forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_L2(P); };
223  forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_L2(P); };
224  forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_L2(P); };
225  forderTable[MBHEX] = [](int P) -> int { return NBVOLUMEHEX_L2(P); };
226  break;
227  default:
228  THROW_MESSAGE("unknown approximation space");
229  }
230  break;
232  switch (*tagSpaceData) {
233  case H1:
234  forderTable[MBVERTEX] = [](int P) -> int { return (P > 0) ? 1 : 0; };
235  forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_H1(P); };
236  forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_H1(P); };
237  forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_H1(P); };
238  forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_H1(P); };
239  forderTable[MBPRISM] = [](int P) -> int { return NBVOLUMEPRISM_H1(P); };
240  break;
241  case L2:
242  forderTable[MBVERTEX] = [](int P) -> int {
243  (void)P;
244  return 1;
245  };
246  forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_L2(P); };
247  forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_L2(P); };
248  forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_L2(P); };
249  forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_L2(P); };
250  forderTable[MBHEX] = [](int P) -> int { return NBVOLUMEHEX_L2(P); };
251  break;
252  default:
253  THROW_MESSAGE("unknown approximation space or not yet implemented");
254  }
255  break;
257  switch (*tagSpaceData) {
258  case H1:
259  forderTable[MBVERTEX] = [](int P) -> int { return (P > 0) ? 1 : 0; };
260  forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_H1(P); };
261  forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_H1(P); };
262  forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_H1(P); };
263  forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_H1(P); };
264  forderTable[MBHEX] = [](int P) -> int { return NBVOLUMEHEX_H1(P); };
265  forderTable[MBPRISM] = [](int P) -> int { return NBVOLUMEPRISM_H1(P); };
266  break;
267  case HCURL:
268  forderTable[MBVERTEX] = [](int P) -> int {
269  (void)P;
270  return 0;
271  };
272  forderTable[MBEDGE] = [](int P) -> int {
273  return NBEDGE_DEMKOWICZ_HCURL(P);
274  };
275  forderTable[MBTRI] = [](int P) -> int {
277  };
278  forderTable[MBQUAD] = [](int P) -> int {
280  };
281  forderTable[MBTET] = [](int P) -> int {
283  };
284  forderTable[MBHEX] = [](int P) -> int {
286  };
287  break;
288  case HDIV:
289  forderTable[MBVERTEX] = [](int P) -> int {
290  (void)P;
291  return 0;
292  };
293  forderTable[MBEDGE] = [](int P) -> int {
294  (void)P;
295  return 0;
296  };
297  forderTable[MBTRI] = [](int P) -> int {
298  return NBFACETRI_DEMKOWICZ_HDIV(P);
299  };
300  forderTable[MBQUAD] = [](int P) -> int {
302  };
303  forderTable[MBTET] = [](int P) -> int {
305  };
306  forderTable[MBHEX] = [](int P) -> int {
308  };
309  break;
310  case L2:
311  forderTable[MBVERTEX] = [](int P) -> int {
312  (void)P;
313  return 1;
314  };
315  forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_L2(P); };
316  forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_L2(P); };
317  forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_L2(P); };
318  forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_L2(P); };
319  forderTable[MBHEX] = [](int P) -> int { return NBVOLUMEHEX_L2(P); };
320  break;
321  default:
322  THROW_MESSAGE("unknown approximation space or not yet implemented");
323  }
324  break;
325  case USER_BASE:
326  for (int ee = 0; ee < MBMAXTYPE; ee++) {
327  forderTable[ee] = [](int P) -> int {
328  (void)P;
329  return 0;
330  };
331  }
332  break;
333  default:
334  if (*tagSpaceData != NOFIELD) {
335  THROW_MESSAGE("unknown approximation base");
336  } else {
337  for (EntityType t = MBVERTEX; t < MBMAXTYPE; t++)
338  forderTable[t] = [](int P) -> int {
339  (void)P;
340  return 1;
341  };
342  }
343  }
344  };
345 
346  auto set_discontinuous_entity_order_table = [&]() {
347  switch (*tagBaseData) {
350  switch (*tagSpaceData) {
351  case HCURL:
352  forderTable[MBVERTEX] = [](int P) -> int {
353  (void)P;
354  return 0;
355  };
356  forderTable[MBEDGE] = [](int P) -> int {
357  (void)P;
358  return 0;
359  };
360  forderTable[MBTRI] = [](int P) -> int {
362  };
363  forderTable[MBTET] = [](int P) -> int {
364  return 6 * NBEDGE_AINSWORTH_HCURL(P) +
367  };
368  break;
369  case HDIV:
370  forderTable[MBVERTEX] = [](int P) -> int {
371  (void)P;
372  return 0;
373  };
374  forderTable[MBEDGE] = [](int P) -> int {
375  (void)P;
376  return 0;
377  };
378  forderTable[MBTRI] = [](int P) -> int {
379  (void)P;
380  return 0;
381  };
382  forderTable[MBTET] = [](int P) -> int {
383  return 4 * NBFACETRI_AINSWORTH_HDIV(P) +
385  };
386  break;
387  default:
388  THROW_MESSAGE("unknown approximation space or not implemented");
389  }
390  break;
392  THROW_MESSAGE("unknown approximation space or not yet implemented");
393  break;
395  switch (*tagSpaceData) {
396  case HCURL:
397  forderTable[MBVERTEX] = [](int P) -> int {
398  (void)P;
399  return 0;
400  };
401  forderTable[MBEDGE] = [](int P) -> int {
402  (void)P;
403  return 0;
404  };
405  forderTable[MBTRI] = [](int P) -> int {
407  };
408  forderTable[MBQUAD] = [](int P) -> int {
410  };
411  forderTable[MBTET] = [](int P) -> int {
412  return 6 * NBEDGE_DEMKOWICZ_HCURL(P) +
415  };
416  forderTable[MBHEX] = [](int P) -> int {
417  return 12 * NBEDGE_DEMKOWICZ_HCURL(P) +
420  };
421  break;
422  case HDIV:
423  forderTable[MBVERTEX] = [](int P) -> int {
424  (void)P;
425  return 0;
426  };
427  forderTable[MBEDGE] = [](int P) -> int {
428  (void)P;
429  return 0;
430  };
431  forderTable[MBTRI] = [](int P) -> int {
432  (void)P;
433  return 0;
434  };
435  forderTable[MBQUAD] = [](int P) -> int {
436  (void)P;
437  return 0;
438  };
439  forderTable[MBTET] = [](int P) -> int {
440  return 4 * NBFACETRI_DEMKOWICZ_HDIV(P) +
442  };
443  forderTable[MBHEX] = [](int P) -> int {
444  return 6 * NBFACEQUAD_DEMKOWICZ_HDIV(P) +
446  };
447  break;
448  default:
449  THROW_MESSAGE("unknown approximation space or not yet implemented");
450  }
451  break;
452  case USER_BASE:
453  for (int ee = 0; ee < MBMAXTYPE; ee++) {
454  forderTable[ee] = [](int P) -> int {
455  (void)P;
456  return 0;
457  };
458  }
459  break;
460  default:
461  if (*tagSpaceData != NOFIELD) {
462  THROW_MESSAGE("unknown approximation base");
463  } else {
464  for (EntityType t = MBVERTEX; t < MBMAXTYPE; t++)
465  forderTable[t] = [](int P) -> int {
466  (void)P;
467  return 1;
468  };
469  }
470  }
471  };
472 
473  reset_entity_order_table();
474  switch (*tagFieldContinuityData) {
475  case CONTINUOUS:
476  set_continuos_entity_order_table();
477  break;
478  case DISCONTINUOUS:
479  set_discontinuous_entity_order_table();
480  break;
481  default:
482  THROW_MESSAGE("unknown field continuity");
483  break;
484  }
486  CHKERRABORT(PETSC_COMM_SELF, ierr);
487 };

◆ ~Field()

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

Member Function Documentation

◆ getApproxBase()

FieldApproximationBase MoFEM::Field::getApproxBase ( ) const
inline

Get approximation base.

Returns
Approximation base

Definition at line 178 of file FieldMultiIndices.hpp.

178 { return *tagBaseData; }

◆ getApproxBaseName()

auto MoFEM::Field::getApproxBaseName ( ) const
inline

Get approximation base.

Returns
Approximation base name

Definition at line 184 of file FieldMultiIndices.hpp.

184  {
185  return std::string(ApproximationBaseNames[getApproxBase()]);
186  }

◆ getBitNumber()

FieldBitNumber MoFEM::Field::getBitNumber ( ) const
inline

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 211 of file FieldMultiIndices.hpp.

211 { return bitNumber; }

◆ getBitNumberCalculate() [1/2]

FieldBitNumber MoFEM::Field::getBitNumberCalculate ( ) const
inline

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

232  {
233  return getBitNumberCalculate(static_cast<BitFieldId &>(*tagId));
234  }

◆ getBitNumberCalculate() [2/2]

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

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 218 of file FieldMultiIndices.hpp.

218  {
219  static_assert(BITFIELDID_SIZE >= 32,
220  "Too many fields allowed, can be more but ...");
221  FieldBitNumber b = ffsl(id.to_ulong());
222  if (b != 0)
223  return b;
224  return 0;
225  }

◆ getContinuity()

FieldContinuity MoFEM::Field::getContinuity ( ) const
inline

Get field space continuity.

Definition at line 162 of file FieldMultiIndices.hpp.

162  {
163  return *tagFieldContinuityData;
164  }

◆ getContinuityName()

auto MoFEM::Field::getContinuityName ( ) const
inline

Get field space continuity name.

Definition at line 170 of file FieldMultiIndices.hpp.

170  {
171  return std::string(FieldContinuityNames[getContinuity()]);
172  }

◆ getDofOrderMap() [1/2]

const DofsOrderMap& MoFEM::Field::getDofOrderMap ( ) const
inline

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 280 of file FieldMultiIndices.hpp.

280 { return dofOrderMap; }

◆ getDofOrderMap() [2/2]

const std::array<ApproximationOrder, MAX_DOFS_ON_ENTITY>& MoFEM::Field::getDofOrderMap ( const EntityType  type) const
inline

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.

Examples
forces_and_sources_testing_users_base.cpp.

Definition at line 268 of file FieldMultiIndices.hpp.

268  {
269  return dofOrderMap[type];
270  }

◆ getDofSequenceContainer()

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

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 stored 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 255 of file FieldMultiIndices.hpp.

255  {
256  return sequenceDofContainer;
257  }

◆ getFieldOrderTable()

FieldOrderTable& MoFEM::Field::getFieldOrderTable ( )
inline

Get the Field Order Table.

Returns
FieldOrderTable&

Definition at line 101 of file FieldMultiIndices.hpp.

101 { return forderTable; }

◆ getFieldRawPtr()

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

Definition at line 286 of file FieldMultiIndices.hpp.

286 { return this; };

◆ getId()

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

Get unique field id.

Returns
Filed ID

Definition at line 129 of file FieldMultiIndices.hpp.

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

◆ getMeshset()

EntityHandle MoFEM::Field::getMeshset ( ) const
inline

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 123 of file FieldMultiIndices.hpp.

123 { return meshSet; }

◆ getName()

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

Get field name.

Returns
Field name

Definition at line 143 of file FieldMultiIndices.hpp.

143  {
144  return std::string((char *)tagName, tagNameSize);
145  }

◆ getNameRef()

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

Get string reference to field name.

Returns
Field name

Definition at line 135 of file FieldMultiIndices.hpp.

135  {
136  return boost::string_ref((char *)tagName, tagNameSize);
137  }

◆ getNbOfCoeffs()

FieldCoefficientsNumber MoFEM::Field::getNbOfCoeffs ( ) const
inline

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 202 of file FieldMultiIndices.hpp.

202  {
203  return *tagNbCoeffData;
204  };

◆ getSpace()

FieldSpace MoFEM::Field::getSpace ( ) const
inline

Get field approximation space.

Returns
approximation space

Definition at line 151 of file FieldMultiIndices.hpp.

151 { return *tagSpaceData; }

◆ getSpaceName()

auto MoFEM::Field::getSpaceName ( ) const
inline

Get field approximation space.

Returns
approximation space name

Definition at line 157 of file FieldMultiIndices.hpp.

157  {
158  return std::string(FieldSpaceNames[getSpace()]);
159  }

◆ rebuildDofsOrderMap()

MoFEMErrorCode MoFEM::Field::rebuildDofsOrderMap ( )

Definition at line 489 of file FieldMultiIndices.cpp.

489  {
491 
492  for (auto t = MBVERTEX; t != MBMAXTYPE; ++t) {
493 
494  int DD = 0;
495  int nb_last_order_dofs = 0;
496  const int rank = (*tagNbCoeffData);
497  if (forderTable[t]) {
498 
499  for (int oo = 0; oo < MAX_DOFS_ON_ENTITY; ++oo) {
500 
501  const int nb_order_dofs = forderTable[t](oo);
502  const int diff_oo = nb_order_dofs - nb_last_order_dofs;
503  if (diff_oo >= 0) {
504 
505  if ((DD + rank * diff_oo) < MAX_DOFS_ON_ENTITY)
506  for (int dd = 0; dd < diff_oo; ++dd)
507  for (int rr = 0; rr != rank; ++rr, ++DD)
508  dofOrderMap[t][DD] = oo;
509  else
510  break;
511 
512  nb_last_order_dofs = nb_order_dofs;
513 
514  } else {
515  break;
516  }
517  }
518  }
519 
520  std::fill(&dofOrderMap[t][DD], dofOrderMap[t].end(), -1);
521  }
522 
524 }

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 526 of file FieldMultiIndices.cpp.

526  {
527  os << e.getNameRef() << " field_id " << e.getId().to_ulong() << " space "
528  << e.getSpaceName() << " field continuity " << e.getContinuityName()
529  << " approximation base " << e.getApproxBaseName() << " nb coefficients "
530  << e.getNbOfCoeffs() << " meshset " << e.meshSet;
531  return os;
532 }

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

◆ dofOrderMap

DofsOrderMap MoFEM::Field::dofOrderMap
mutableprivate

Definition at line 290 of file FieldMultiIndices.hpp.

◆ forderTable

FieldOrderTable MoFEM::Field::forderTable

nb. DOFs table for entities

Definition at line 94 of file FieldMultiIndices.hpp.

◆ meshSet

EntityHandle MoFEM::Field::meshSet

keeps entities for this meshset

Definition at line 73 of file FieldMultiIndices.hpp.

◆ moab

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

Definition at line 71 of file FieldMultiIndices.hpp.

◆ sequenceDofContainer

SequenceDofContainer MoFEM::Field::sequenceDofContainer
mutableprivate

Definition at line 286 of file FieldMultiIndices.hpp.

◆ tagBaseData

FieldApproximationBase* MoFEM::Field::tagBaseData

tag keeps field base

Definition at line 84 of file FieldMultiIndices.hpp.

◆ tagFieldContinuityData

FieldContinuity* MoFEM::Field::tagFieldContinuityData

tag keeps field continuity

Definition at line 83 of file FieldMultiIndices.hpp.

◆ tagFieldDataVertsType

TagType MoFEM::Field::tagFieldDataVertsType

Definition at line 75 of file FieldMultiIndices.hpp.

◆ tagId

BitFieldId* MoFEM::Field::tagId

Tag field rank.

tag keeps field id

Definition at line 81 of file FieldMultiIndices.hpp.

◆ tagName

const void* MoFEM::Field::tagName

tag keeps name of the field

Definition at line 89 of file FieldMultiIndices.hpp.

◆ tagNamePrefixData

const void* MoFEM::Field::tagNamePrefixData

tag keeps name prefix of the field

Definition at line 91 of file FieldMultiIndices.hpp.

◆ tagNamePrefixSize

int MoFEM::Field::tagNamePrefixSize

number of bits necessary to keep field name prefix

Definition at line 92 of file FieldMultiIndices.hpp.

◆ tagNameSize

int MoFEM::Field::tagNameSize

number of bits necessary to keep field name

Definition at line 90 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 88 of file FieldMultiIndices.hpp.

◆ tagSpaceData

FieldSpace* MoFEM::Field::tagSpaceData

tag keeps field space

Definition at line 82 of file FieldMultiIndices.hpp.

◆ th_AppOrder

Tag MoFEM::Field::th_AppOrder

Tag storing approximation order on entity.

Definition at line 78 of file FieldMultiIndices.hpp.

◆ th_FieldData

Tag MoFEM::Field::th_FieldData

Tag storing field values on entity in the field.

Definition at line 77 of file FieldMultiIndices.hpp.

◆ th_FieldDataVerts

Tag MoFEM::Field::th_FieldDataVerts

Tag storing field values on vertices in the field.

Definition at line 76 of file FieldMultiIndices.hpp.

◆ th_FieldRank

Tag MoFEM::Field::th_FieldRank

Definition at line 79 of file FieldMultiIndices.hpp.


The documentation for this struct was generated from the following files:
MoFEM::Field::tagFieldDataVertsType
TagType tagFieldDataVertsType
Definition: FieldMultiIndices.hpp:75
H1
@ H1
continuous field
Definition: definitions.h:85
NBVOLUMEHEX_DEMKOWICZ_HCURL
#define NBVOLUMEHEX_DEMKOWICZ_HCURL(P)
Definition: h1_hdiv_hcurl_l2.h:124
NBEDGE_H1
#define NBEDGE_H1(P)
Numer of base function on edge for H1 space.
Definition: h1_hdiv_hcurl_l2.h:55
MoFEM::Field::moab
moab::Interface & moab
Definition: FieldMultiIndices.hpp:71
NBVOLUMETET_DEMKOWICZ_HCURL
#define NBVOLUMETET_DEMKOWICZ_HCURL(P)
Definition: h1_hdiv_hcurl_l2.h:110
MoFEM::Field::getContinuity
FieldContinuity getContinuity() const
Get field space continuity.
Definition: FieldMultiIndices.hpp:162
CHK_THROW_MESSAGE
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
Definition: definitions.h:609
ApproximationBaseNames
const static char *const ApproximationBaseNames[]
Definition: definitions.h:72
L2
@ L2
field with C-1 continuity
Definition: definitions.h:88
MoFEM::Field::tagSpaceData
FieldSpace * tagSpaceData
tag keeps field space
Definition: FieldMultiIndices.hpp:82
MoFEM::Field::rebuildDofsOrderMap
MoFEMErrorCode rebuildDofsOrderMap()
Definition: FieldMultiIndices.cpp:489
MoFEM::Field::tagFieldContinuityData
FieldContinuity * tagFieldContinuityData
tag keeps field continuity
Definition: FieldMultiIndices.hpp:83
MoFEM::Field::getSpace
FieldSpace getSpace() const
Get field approximation space.
Definition: FieldMultiIndices.hpp:151
MoFEM::th
Tag th
Definition: Projection10NodeCoordsOnField.cpp:122
MoFEM::Types::BitFieldId
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
Definition: Types.hpp:42
MoFEM::Field::th_FieldData
Tag th_FieldData
Tag storing field values on entity in the field.
Definition: FieldMultiIndices.hpp:77
MoFEM::UnknownInterface::getFileVersion
static MoFEMErrorCode getFileVersion(moab::Interface &moab, Version &version)
Get database major version.
Definition: UnknownInterface.cpp:16
NBVOLUMETET_H1
#define NBVOLUMETET_H1(P)
Number of base functions on tetrahedron for H1 space.
Definition: h1_hdiv_hcurl_l2.h:75
MOAB_THROW
#define MOAB_THROW(err)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:554
MoFEM::Field::getName
std::string getName() const
Get field name.
Definition: FieldMultiIndices.hpp:143
MoFEM::Field::sequenceDofContainer
SequenceDofContainer sequenceDofContainer
Definition: FieldMultiIndices.hpp:286
NBVOLUMETET_L2
#define NBVOLUMETET_L2(P)
Number of base functions on tetrahedron for L2 space.
Definition: h1_hdiv_hcurl_l2.h:27
NBFACEQUAD_DEMKOWICZ_HCURL
#define NBFACEQUAD_DEMKOWICZ_HCURL(P)
Definition: h1_hdiv_hcurl_l2.h:118
MoFEM::Field::th_FieldRank
Tag th_FieldRank
Definition: FieldMultiIndices.hpp:79
THROW_MESSAGE
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
Definition: definitions.h:574
USER_BASE
@ USER_BASE
user implemented approximation base
Definition: definitions.h:68
MoFEM::Field::tagNamePrefixSize
int tagNamePrefixSize
Definition: FieldMultiIndices.hpp:92
MoFEM::Field::tagNameSize
int tagNameSize
number of bits necessary to keep field name
Definition: FieldMultiIndices.hpp:90
MoFEM::Exceptions::rval
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:74
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
FieldContinuityNames
const static char *const FieldContinuityNames[]
Definition: definitions.h:105
NBFACEQUAD_L2
#define NBFACEQUAD_L2(P)
Number of base functions on quad for L2 space.
Definition: h1_hdiv_hcurl_l2.h:70
BITFIELDID_SIZE
#define BITFIELDID_SIZE
max number of fields
Definition: definitions.h:233
NBVOLUMEHEX_DEMKOWICZ_HDIV
#define NBVOLUMEHEX_DEMKOWICZ_HDIV(P)
Definition: h1_hdiv_hcurl_l2.h:149
MoFEM::Field::th_FieldDataVerts
Tag th_FieldDataVerts
Tag storing field values on vertices in the field.
Definition: FieldMultiIndices.hpp:76
NBEDGE_L2
#define NBEDGE_L2(P)
Number of base functions on edge fro L2 space.
Definition: h1_hdiv_hcurl_l2.h:48
NBFACETRI_DEMKOWICZ_HDIV
#define NBFACETRI_DEMKOWICZ_HDIV(P)
Definition: h1_hdiv_hcurl_l2.h:139
convert.type
type
Definition: convert.py:64
EshelbianPlasticity::P
@ P
Definition: EshelbianContact.cpp:193
MoFEM::Field::tagBaseData
FieldApproximationBase * tagBaseData
tag keeps field base
Definition: FieldMultiIndices.hpp:84
MoFEM::Field::getApproxBase
FieldApproximationBase getApproxBase() const
Get approximation base.
Definition: FieldMultiIndices.hpp:178
NBVOLUMETET_DEMKOWICZ_HDIV
#define NBVOLUMETET_DEMKOWICZ_HDIV(P)
Definition: h1_hdiv_hcurl_l2.h:140
NBEDGE_DEMKOWICZ_HCURL
#define NBEDGE_DEMKOWICZ_HCURL(P)
Definition: h1_hdiv_hcurl_l2.h:108
MoFEM::Field::tagName
const void * tagName
tag keeps name of the field
Definition: FieldMultiIndices.hpp:89
AINSWORTH_LOBATTO_BASE
@ AINSWORTH_LOBATTO_BASE
Definition: definitions.h:62
MoFEM::Field::tagNbCoeffData
FieldCoefficientsNumber * tagNbCoeffData
Definition: FieldMultiIndices.hpp:88
NBFACEQUAD_H1
#define NBFACEQUAD_H1(P)
Number of base functions on quad for H1 space.
Definition: h1_hdiv_hcurl_l2.h:65
t
constexpr double t
plate stiffness
Definition: plate.cpp:59
MoFEM::Field::dofOrderMap
DofsOrderMap dofOrderMap
Definition: FieldMultiIndices.hpp:290
NBFACETRI_DEMKOWICZ_HCURL
#define NBFACETRI_DEMKOWICZ_HCURL(P)
Definition: h1_hdiv_hcurl_l2.h:109
AINSWORTH_BERNSTEIN_BEZIER_BASE
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
Definition: definitions.h:64
NBEDGE_HDIV
#define NBEDGE_HDIV(P)
Definition: h1_hdiv_hcurl_l2.h:129
MAX_DOFS_ON_ENTITY
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
Definition: definitions.h:249
NBEDGE_AINSWORTH_HCURL
#define NBEDGE_AINSWORTH_HCURL(P)
Definition: h1_hdiv_hcurl_l2.h:97
FTensor::dd
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
NBFACETRI_H1
#define NBFACETRI_H1(P)
Number of base function on triangle for H1 space.
Definition: h1_hdiv_hcurl_l2.h:60
FieldSpaceNames
const static char *const FieldSpaceNames[]
Definition: definitions.h:92
MoFEM::Field::th_AppOrder
Tag th_AppOrder
Tag storing approximation order on entity.
Definition: FieldMultiIndices.hpp:78
MoFEM::Types::ApproximationOrder
int ApproximationOrder
Approximation on the entity.
Definition: Types.hpp:26
DEMKOWICZ_JACOBI_BASE
@ DEMKOWICZ_JACOBI_BASE
Definition: definitions.h:66
NBFACEQUAD_DEMKOWICZ_HDIV
#define NBFACEQUAD_DEMKOWICZ_HDIV(P)
Definition: h1_hdiv_hcurl_l2.h:145
MoFEM::Field::bitNumber
unsigned int bitNumber
Definition: FieldMultiIndices.hpp:107
NBVOLUMETET_AINSWORTH_HCURL
#define NBVOLUMETET_AINSWORTH_HCURL(P)
Definition: h1_hdiv_hcurl_l2.h:105
MoFEM::Types::FieldBitNumber
char FieldBitNumber
Field bit number.
Definition: Types.hpp:28
NBFACETRI_L2
#define NBFACETRI_L2(P)
Number of base functions on triangle for L2 space.
Definition: h1_hdiv_hcurl_l2.h:42
DISCONTINUOUS
@ DISCONTINUOUS
Broken continuity (No effect on L2 space)
Definition: definitions.h:101
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
HCURL
@ HCURL
field with continuous tangents
Definition: definitions.h:86
NBVOLUMETET_AINSWORTH_HDIV
#define NBVOLUMETET_AINSWORTH_HDIV(P)
Definition: h1_hdiv_hcurl_l2.h:137
NBVOLUMEHEX_H1
#define NBVOLUMEHEX_H1(P)
Number of base functions on hex for H1 space.
Definition: h1_hdiv_hcurl_l2.h:93
MoFEM::Types::VectorDouble
UBlasVector< double > VectorDouble
Definition: Types.hpp:68
MoFEM::Field::tagNamePrefixData
const void * tagNamePrefixData
tag keeps name prefix of the field
Definition: FieldMultiIndices.hpp:91
NBFACETRI_AINSWORTH_HCURL
#define NBFACETRI_AINSWORTH_HCURL(P)
Definition: h1_hdiv_hcurl_l2.h:100
NBVOLUMEPRISM_H1
#define NBVOLUMEPRISM_H1(P)
Number of base functions on prism for H1 space.
Definition: h1_hdiv_hcurl_l2.h:80
MoFEM::Field::getBitNumberCalculate
FieldBitNumber getBitNumberCalculate() const
Calculate number of set bit in Field ID. Each field has uid, get getBitNumber get number of bit set f...
Definition: FieldMultiIndices.hpp:232
NBFACETRI_AINSWORTH_HDIV
#define NBFACETRI_AINSWORTH_HDIV(P)
Definition: h1_hdiv_hcurl_l2.h:132
CONTINUOUS
@ CONTINUOUS
Regular field.
Definition: definitions.h:100
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
HDIV
@ HDIV
field with continuous normal traction
Definition: definitions.h:87
MoFEM::Field::forderTable
FieldOrderTable forderTable
nb. DOFs table for entities
Definition: FieldMultiIndices.hpp:94
MoFEM::Field::meshSet
EntityHandle meshSet
keeps entities for this meshset
Definition: FieldMultiIndices.hpp:73
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
NBVOLUMEHEX_L2
#define NBVOLUMEHEX_L2(P)
Number of base functions on hexahedron for L2 space.
Definition: h1_hdiv_hcurl_l2.h:37
NOFIELD
@ NOFIELD
scalar or vector of scalars describe (no true field)
Definition: definitions.h:84
MoFEM::Field::tagId
BitFieldId * tagId
Tag field rank.
Definition: FieldMultiIndices.hpp:81