v0.15.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes | Friends | List of all members
MoFEM::Field Struct Reference

Field data structure for finite element 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<> > >
 Container for bulk DOF allocation.
 
using DofsOrderMap = std::array< std::array< int, MAX_DOFS_ON_ENTITY >, MBMAXTYPE >
 Array mapping entity types to DOF order arrays.
 

Public Member Functions

 Field (moab::Interface &moab, const EntityHandle meshset)
 Constructor for MOAB field.
 
virtual ~Field ()=default
 Virtual destructor.
 
FieldOrderTablegetFieldOrderTable ()
 Get field order table.
 
EntityHandle getMeshset () const
 Get field meshset handle.
 
const BitFieldIdgetId () const
 Get unique field identifier.
 
boost::string_ref getNameRef () const
 Get field name as string reference.
 
std::string getName () const
 Get field name as string.
 
FieldSpace getSpace () const
 Get field approximation space.
 
auto getSpaceName () const
 Get field approximation space name.
 
FieldContinuity getContinuity () const
 Get field continuity type.
 
auto getContinuityName () const
 Get field continuity name.
 
FieldApproximationBase getApproxBase () const
 Get approximation basis type.
 
auto getApproxBaseName () const
 Get approximation basis name.
 
FieldCoefficientsNumber getNbOfCoeffs () const
 Get number of field coefficients per DOF.
 
FieldBitNumber getBitNumber () const
 Get bit number for this field's ID.
 
FieldBitNumber getBitNumberCalculate () const
 Calculate bit number for this field's ID.
 
SequenceDofContainergetDofSequenceContainer () const
 Get sequence container for bulk DOF allocation.
 
const std::array< ApproximationOrder, MAX_DOFS_ON_ENTITY > & getDofOrderMap (const EntityType type) const
 Get DOF order mapping for specific entity type.
 
const DofsOrderMapgetDofOrderMap () const
 Get complete DOF order mapping for all entity types.
 
std::map< int, BaseFunction::DofsSideMap > & getDofSideMap () const
 Get DOF side mapping for broken spaces.
 
MoFEMErrorCode rebuildDofsOrderMap ()
 Rebuild DOF order mapping arrays.
 
const FieldgetFieldRawPtr () const
 Get raw pointer to this field.
 

Static Public Member Functions

static FieldBitNumber getBitNumberCalculate (const BitFieldId &id)
 Calculate bit number from field ID bitset.
 

Public Attributes

moab::Interface & moab
 MOAB interface reference.
 
EntityHandle meshSet
 Meshset containing field entities.
 
TagType tagFieldDataVertsType
 Tag type for vertex data storage.
 
Tag th_FieldDataVerts
 Tag for field values on vertices.
 
Tag th_FieldData
 Tag for field values on entities.
 
Tag th_AppOrder
 Tag for approximation order on entities.
 
Tag th_FieldRank
 Tag for field rank (vector dimension)
 
BitFieldIdtagId
 Field unique identifier.
 
FieldSpacetagSpaceData
 Field approximation space.
 
FieldContinuitytagFieldContinuityData
 Field continuity type.
 
FieldApproximationBasetagBaseData
 Field basis functions.
 
FieldCoefficientsNumbertagNbCoeffData
 Field rank (e.g. Temperature=1, displacement in 3D=3)
 
const void * tagName
 Field name.
 
int tagNameSize
 Field name size in bytes.
 
const void * tagNamePrefixData
 Field name prefix.
 
int tagNamePrefixSize
 Field name prefix size in bytes.
 
FieldOrderTable forderTable
 DOF count functions for each entity type.
 
unsigned int bitNumber
 Bit number corresponding to this field's unique ID.
 

Static Public Attributes

static constexpr int maxBrokenDofsOrder = 10
 Maximum order for broken space DOFs.
 

Private Attributes

SequenceDofContainer sequenceDofContainer
 
DofsOrderMap dofOrderMap
 
std::map< int, BaseFunction::DofsSideMapdofSideMap
 

Friends

std::ostream & operator<< (std::ostream &os, const Field &e)
 Output stream operator for field information.
 

Detailed Description

Field data structure for finite element approximation.

Stores field information including approximation space, basis functions, coordinate systems, and DOF management. Each field has a unique ID and name. Data is shared between mesh entities and their associated DOFs.

Examples
mofem/atom_tests/forces_and_sources_testing_users_base.cpp, mofem/atom_tests/scalar_check_approximation.cpp, and mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.cpp.

Definition at line 36 of file FieldMultiIndices.hpp.

Member Typedef Documentation

◆ DofsOrderMap

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

Array mapping entity types to DOF order arrays.

Definition at line 54 of file FieldMultiIndices.hpp.

◆ SequenceDofContainer

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

Container for bulk DOF allocation.

Definition at line 49 of file FieldMultiIndices.hpp.

Constructor & Destructor Documentation

◆ Field()

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

Constructor for MOAB field.

Parameters
moabMOAB interface reference
meshsetEntityHandle containing field entities

Definition at line 17 of file FieldMultiIndices.cpp.

18 : moab(moab), meshSet(meshset), tagId(NULL), tagSpaceData(NULL),
20 tagNameSize(0) {
21
22 auto get_tag_data_ptr = [&](const auto name, auto &tag_data) {
24 Tag th;
25 CHKERR moab.tag_get_handle(name, th);
26 CHKERR moab.tag_get_by_ptr(th, &meshset, 1, (const void **)&tag_data);
28 };
29
30 // id
31 ierr = get_tag_data_ptr("_FieldId", tagId);
32 CHKERRABORT(PETSC_COMM_SELF, ierr);
33 // space
34 ierr = get_tag_data_ptr("_FieldSpace", tagSpaceData);
35 CHKERRABORT(PETSC_COMM_SELF, ierr);
36 // continuity
37 ierr = get_tag_data_ptr("_FieldContinuity", tagFieldContinuityData);
38 CHKERRABORT(PETSC_COMM_SELF, ierr);
39
40 // approx. base
41 ierr = get_tag_data_ptr("_FieldBase", tagBaseData);
42 CHKERRABORT(PETSC_COMM_SELF, ierr);
43
44 // name
45 Tag th_field_name;
46 CHKERR moab.tag_get_handle("_FieldName", th_field_name);
47 CHKERR moab.tag_get_by_ptr(th_field_name, &meshSet, 1,
48 (const void **)&tagName, &tagNameSize);
49 // name prefix
50 Tag th_field_name_data_name_prefix;
51 CHKERR moab.tag_get_handle("_FieldName_DataNamePrefix",
52 th_field_name_data_name_prefix);
53 CHKERR moab.tag_get_by_ptr(th_field_name_data_name_prefix, &meshSet, 1,
54 (const void **)&tagNamePrefixData,
56 std::string name_data_prefix((char *)tagNamePrefixData, tagNamePrefixSize);
57
58 // rank
59 std::string Tag_rank_name = "_Field_Rank_" + getName();
60 CHKERR moab.tag_get_handle(Tag_rank_name.c_str(), th_FieldRank);
61 CHKERR moab.tag_get_by_ptr(th_FieldRank, &meshSet, 1,
62 (const void **)&tagNbCoeffData);
63
64 auto get_all_tags = [&]() {
66 // order
67 ApproximationOrder def_approx_order = -1;
68 std::string tag_approximation_order_name = "_App_Order_" + getName();
69 rval = moab.tag_get_handle(tag_approximation_order_name.c_str(), 1,
70 MB_TYPE_INTEGER, th_AppOrder,
71 MB_TAG_CREAT | MB_TAG_SPARSE, &def_approx_order);
72 if (rval == MB_ALREADY_ALLOCATED)
73 rval = MB_SUCCESS;
75
76 // data
77 std::string tag_data_name = name_data_prefix + getName();
78 const int def_len = 0;
79 rval = moab.tag_get_handle(
80 tag_data_name.c_str(), def_len, MB_TYPE_DOUBLE, th_FieldData,
81 MB_TAG_CREAT | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
82 if (rval == MB_ALREADY_ALLOCATED)
83 rval = MB_SUCCESS;
85
86 std::string tag_data_name_verts = name_data_prefix + getName() + "_V";
87 rval = moab.tag_get_handle(tag_data_name_verts.c_str(), th_FieldDataVerts);
88 if (rval == MB_SUCCESS)
90 else {
91 // Since vertex tag is not it mesh that tag is not dense, it is sparse,
92 // sinc it is set to all vertices on the mesh. Is unlikely that mesh has
93 // no vertices, then above assumption does not hold.
94 tagFieldDataVertsType = MB_TAG_SPARSE;
95 VectorDouble def_vert_data(*tagNbCoeffData);
96 def_vert_data.clear();
97 rval = moab.tag_get_handle(tag_data_name_verts.c_str(), *tagNbCoeffData,
98 MB_TYPE_DOUBLE, th_FieldDataVerts,
99 MB_TAG_CREAT | tagFieldDataVertsType,
100 &*def_vert_data.begin());
101 if (rval == MB_ALREADY_ALLOCATED)
102 rval = MB_SUCCESS;
104 }
105
107 };
108
109 auto get_all_tags_deprecated = [&]() {
111 // order
112 ApproximationOrder def_approx_order = -1;
113 std::string tag_approximation_order_name = "_App_Order_" + getName();
114 rval = moab.tag_get_handle(tag_approximation_order_name.c_str(), 1,
115 MB_TYPE_INTEGER, th_AppOrder,
116 MB_TAG_CREAT | MB_TAG_SPARSE, &def_approx_order);
117 if (rval == MB_ALREADY_ALLOCATED)
118 rval = MB_SUCCESS;
120
121 // data
122 std::string tag_data_name = name_data_prefix + getName();
123 const int def_len = 0;
124 rval = moab.tag_get_handle(
125 tag_data_name.c_str(), def_len, MB_TYPE_DOUBLE, th_FieldData,
126 MB_TAG_CREAT | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
127 if (rval == MB_ALREADY_ALLOCATED)
128 rval = MB_SUCCESS;
130
131 std::string tag_data_name_verts = name_data_prefix + getName() + "V";
132 rval = moab.tag_get_handle(tag_data_name_verts.c_str(), th_FieldDataVerts);
133 if (rval == MB_SUCCESS)
135 else {
136 // Since vertex tag is not it mesh that tag is not dense, it is sparse,
137 // sinc it is set to all vertices on the mesh. Is unlikely that mesh has
138 // no vertices, then above assumption does not hold.
139 tagFieldDataVertsType = MB_TAG_SPARSE;
140 VectorDouble def_vert_data(*tagNbCoeffData);
141 def_vert_data.clear();
142 rval = moab.tag_get_handle(tag_data_name_verts.c_str(), *tagNbCoeffData,
143 MB_TYPE_DOUBLE, th_FieldDataVerts,
144 MB_TAG_CREAT | tagFieldDataVertsType,
145 &*def_vert_data.begin());
146 if (rval == MB_ALREADY_ALLOCATED)
147 rval = MB_SUCCESS;
149 }
150
152 };
153
154 Version file_ver;
156 CHK_THROW_MESSAGE(ierr, "Not known file version");
157 if (file_ver.majorVersion >= 0 && file_ver.minorVersion >= 12 &&
158 file_ver.buildVersion >= 1) {
159 ierr = get_all_tags();
160 CHKERRABORT(PETSC_COMM_SELF, ierr);
161 } else {
162 ierr = get_all_tags_deprecated();
163 CHKERRABORT(PETSC_COMM_SELF, ierr);
164 }
165
167
168 auto reset_entity_order_table = [&]() {
169 for (int tt = 0; tt != MBMAXTYPE; ++tt)
170 forderTable[tt] = NULL;
171 };
172
173 auto set_continuous_entity_order_table = [&]() {
174 switch (*tagBaseData) {
177 switch (*tagSpaceData) {
178 case H1:
179 forderTable[MBVERTEX] = [](int P) -> int { return (P > 0) ? 1 : 0; };
180 forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_H1(P); };
181 forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_H1(P); };
182 forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_H1(P); };
183 forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_H1(P); };
184 forderTable[MBHEX] = [](int P) -> int { return NBVOLUMEHEX_H1(P); };
185 forderTable[MBPRISM] = [](int P) -> int { return NBVOLUMEPRISM_H1(P); };
186 break;
187 case HCURL:
188 forderTable[MBVERTEX] = [](int P) -> int {
189 (void)P;
190 return 0;
191 };
192 forderTable[MBEDGE] = [](int P) -> int {
193 return NBEDGE_AINSWORTH_HCURL(P);
194 };
195 forderTable[MBTRI] = [](int P) -> int {
197 };
198 forderTable[MBTET] = [](int P) -> int {
200 };
201 break;
202 case HDIV:
203 forderTable[MBVERTEX] = [](int P) -> int {
204 (void)P;
205 return 0;
206 };
207 forderTable[MBEDGE] = [](int P) -> int {
208 (void)P;
209 return NBEDGE_HDIV(P);
210 };
211 forderTable[MBTRI] = [](int P) -> int {
216 };
217 forderTable[MBTET] = [](int P) -> int {
224 };
225 break;
226 case L2:
227 forderTable[MBVERTEX] = [](int P) -> int {
228 (void)P;
229 return 1;
230 };
231 forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_L2(P); };
232 forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_L2(P); };
233 forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_L2(P); };
234 forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_L2(P); };
235 forderTable[MBHEX] = [](int P) -> int { return NBVOLUMEHEX_L2(P); };
236 break;
237 default:
238 THROW_MESSAGE("unknown approximation space");
239 }
240 break;
242 switch (*tagSpaceData) {
243 case H1:
244 forderTable[MBVERTEX] = [](int P) -> int { return (P > 0) ? 1 : 0; };
245 forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_H1(P); };
246 forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_H1(P); };
247 forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_H1(P); };
248 forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_H1(P); };
249 forderTable[MBPRISM] = [](int P) -> int { return NBVOLUMEPRISM_H1(P); };
250 break;
251 case L2:
252 forderTable[MBVERTEX] = [](int P) -> int {
253 (void)P;
254 return 1;
255 };
256 forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_L2(P); };
257 forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_L2(P); };
258 forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_L2(P); };
259 forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_L2(P); };
260 forderTable[MBHEX] = [](int P) -> int { return NBVOLUMEHEX_L2(P); };
261 break;
262 default:
263 THROW_MESSAGE("unknown approximation space or not yet implemented");
264 }
265 break;
267 switch (*tagSpaceData) {
268 case H1:
269 forderTable[MBVERTEX] = [](int P) -> int { return (P > 0) ? 1 : 0; };
270 forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_H1(P); };
271 forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_H1(P); };
272 forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_H1(P); };
273 forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_H1(P); };
274 forderTable[MBHEX] = [](int P) -> int { return NBVOLUMEHEX_H1(P); };
275 forderTable[MBPRISM] = [](int P) -> int { return NBVOLUMEPRISM_H1(P); };
276 break;
277 case HCURL:
278 forderTable[MBVERTEX] = [](int P) -> int {
279 (void)P;
280 return 0;
281 };
282 forderTable[MBEDGE] = [](int P) -> int {
283 return NBEDGE_DEMKOWICZ_HCURL(P);
284 };
285 forderTable[MBTRI] = [](int P) -> int {
287 };
288 forderTable[MBQUAD] = [](int P) -> int {
290 };
291 forderTable[MBTET] = [](int P) -> int {
293 };
294 forderTable[MBHEX] = [](int P) -> int {
296 };
297 break;
298 case HDIV:
299 forderTable[MBVERTEX] = [](int P) -> int {
300 (void)P;
301 return 0;
302 };
303 forderTable[MBEDGE] = [](int P) -> int {
304 (void)P;
305 return 0;
306 };
307 forderTable[MBTRI] = [](int P) -> int {
308 return NBFACETRI_DEMKOWICZ_HDIV(P);
309 };
310 forderTable[MBQUAD] = [](int P) -> int {
312 };
313 forderTable[MBTET] = [](int P) -> int {
315 };
316 forderTable[MBHEX] = [](int P) -> int {
318 };
319 break;
320 case L2:
321 forderTable[MBVERTEX] = [](int P) -> int {
322 (void)P;
323 return 1;
324 };
325 forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_L2(P); };
326 forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_L2(P); };
327 forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_L2(P); };
328 forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_L2(P); };
329 forderTable[MBHEX] = [](int P) -> int { return NBVOLUMEHEX_L2(P); };
330 break;
331 default:
332 THROW_MESSAGE("unknown approximation space or not yet implemented");
333 }
334 break;
335 case USER_BASE:
336 for (int ee = 0; ee < MBMAXTYPE; ee++) {
337 forderTable[ee] = [](int P) -> int {
338 (void)P;
339 return 0;
340 };
341 }
342 break;
343 default:
344 if (*tagSpaceData != NOFIELD) {
345 THROW_MESSAGE("unknown approximation base");
346 } else {
347 for (EntityType t = MBVERTEX; t < MBMAXTYPE; t++)
348 forderTable[t] = [](int P) -> int {
349 (void)P;
350 return 1;
351 };
352 }
353 }
354 };
355
356 auto set_discontinuous_entity_order_table = [&]() {
357 switch (*tagBaseData) {
360 switch (*tagSpaceData) {
361 case HCURL:
362 forderTable[MBVERTEX] = [](int P) -> int {
363 (void)P;
364 return 0;
365 };
366 forderTable[MBEDGE] = [](int P) -> int {
367 (void)P;
368 return 0;
369 };
370 forderTable[MBTRI] = [](int P) -> int {
372 };
373 forderTable[MBTET] = [](int P) -> int {
374 return 6 * NBEDGE_AINSWORTH_HCURL(P) +
377 };
378 break;
379 case HDIV:
380 forderTable[MBVERTEX] = [](int P) -> int {
381 (void)P;
382 return 0;
383 };
384 forderTable[MBEDGE] = [](int P) -> int {
385 (void)P;
386 return 0;
387 };
388 forderTable[MBTRI] = [](int P) -> int {
389 (void)P;
390 return 0;
391 };
392 forderTable[MBTET] = [](int P) -> int {
393 return
394
395 4 * (
396
401
402 ) +
403
410 };
411 break;
412 default:
413 THROW_MESSAGE("unknown approximation space or not implemented");
414 }
415 break;
417 THROW_MESSAGE("unknown approximation space or not yet implemented");
418 break;
420 switch (*tagSpaceData) {
421 case HCURL:
422 forderTable[MBVERTEX] = [](int P) -> int {
423 (void)P;
424 return 0;
425 };
426 forderTable[MBEDGE] = [](int P) -> int {
427 (void)P;
428 return 0;
429 };
430 forderTable[MBTRI] = [](int P) -> int {
432 };
433 forderTable[MBQUAD] = [](int P) -> int {
435 };
436 forderTable[MBTET] = [](int P) -> int {
437 return 6 * NBEDGE_DEMKOWICZ_HCURL(P) +
440 };
441 forderTable[MBHEX] = [](int P) -> int {
442 return 12 * NBEDGE_DEMKOWICZ_HCURL(P) +
445 };
446 break;
447 case HDIV:
448 forderTable[MBVERTEX] = [](int P) -> int {
449 (void)P;
450 return 0;
451 };
452 forderTable[MBEDGE] = [](int P) -> int {
453 (void)P;
454 return 0;
455 };
456 forderTable[MBTRI] = [](int P) -> int {
457 (void)P;
458 return 0;
459 };
460 forderTable[MBQUAD] = [](int P) -> int {
461 (void)P;
462 return 0;
463 };
464 forderTable[MBTET] = [](int P) -> int {
465 return 4 * NBFACETRI_DEMKOWICZ_HDIV(P) +
467 };
468 forderTable[MBHEX] = [](int P) -> int {
469 return 6 * NBFACEQUAD_DEMKOWICZ_HDIV(P) +
471 };
472 break;
473 default:
474 THROW_MESSAGE("unknown approximation space or not yet implemented");
475 }
476 break;
477 case USER_BASE:
478 for (int ee = 0; ee < MBMAXTYPE; ee++) {
479 forderTable[ee] = [](int P) -> int {
480 (void)P;
481 return 0;
482 };
483 }
484 break;
485 default:
486 if (*tagSpaceData != NOFIELD) {
487 THROW_MESSAGE("unknown approximation base");
488 } else {
489 for (EntityType t = MBVERTEX; t < MBMAXTYPE; t++)
490 forderTable[t] = [](int P) -> int {
491 (void)P;
492 return 1;
493 };
494 }
495 }
496 };
497
498 reset_entity_order_table();
499 switch (*tagFieldContinuityData) {
500 case CONTINUOUS:
501 set_continuous_entity_order_table();
502 break;
503 case DISCONTINUOUS:
504 set_discontinuous_entity_order_table();
505 break;
506 default:
508 set_continuous_entity_order_table();
509 MOFEM_LOG("SELF", Sev::warning)
510 << "unknown field continuity, set CONTINUOUS";
511 break;
512 }
514 CHKERRABORT(PETSC_COMM_SELF, ierr);
515};
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition definitions.h:60
@ AINSWORTH_LOBATTO_BASE
Definition definitions.h:62
@ USER_BASE
user implemented approximation base
Definition definitions.h:68
@ DEMKOWICZ_JACOBI_BASE
Definition definitions.h:66
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
Definition definitions.h:64
#define MOAB_THROW(err)
Check error code of MoAB function and throw MoFEM exception.
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
@ L2
field with C-1 continuity
Definition definitions.h:88
@ NOFIELD
scalar or vector of scalars describe (no true field)
Definition definitions.h:84
@ H1
continuous field
Definition definitions.h:85
@ HCURL
field with continuous tangents
Definition definitions.h:86
@ HDIV
field with continuous normal traction
Definition definitions.h:87
@ CONTINUOUS
Regular field.
@ DISCONTINUOUS
Broken continuity (No effect on L2 space)
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
#define MOFEM_LOG(channel, severity)
Log.
#define NBFACEQUAD_DEMKOWICZ_HDIV(P)
#define NBVOLUMETET_AINSWORTH_EDGE_HDIV(P)
#define NBEDGE_DEMKOWICZ_HCURL(P)
#define NBVOLUMETET_H1(P)
Number of base functions on tetrahedron for H1 space.
#define NBVOLUMEHEX_DEMKOWICZ_HCURL(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 NBVOLUMEHEX_H1(P)
Number of base functions on hex for H1 space.
#define NBFACETRI_L2(P)
Number of base functions on triangle for L2 space.
#define NBVOLUMETET_DEMKOWICZ_HDIV(P)
#define NBEDGE_HDIV(P)
#define NBVOLUMETET_AINSWORTH_FACE_HDIV(P)
#define NBVOLUMEPRISM_H1(P)
Number of base functions on prism for H1 space.
#define NBVOLUMEHEX_DEMKOWICZ_HDIV(P)
#define NBFACEQUAD_DEMKOWICZ_HCURL(P)
#define NBEDGE_H1(P)
Number of base function on edge for H1 space.
#define NBFACETRI_DEMKOWICZ_HDIV(P)
#define NBEDGE_L2(P)
Number of base functions on edge from L2 space.
#define NBVOLUMEHEX_L2(P)
Number of base functions on hexahedron for L2 space.
#define NBVOLUMETET_DEMKOWICZ_HCURL(P)
#define NBFACETRI_DEMKOWICZ_HCURL(P)
#define NBFACETRI_AINSWORTH_FACE_HDIV(P)
#define NBVOLUMETET_AINSWORTH_VOLUME_HDIV(P)
#define NBFACETRI_AINSWORTH_EDGE_HDIV(P)
#define NBEDGE_AINSWORTH_HCURL(P)
#define NBFACETRI_H1(P)
Number of base function on triangle for H1 space.
#define NBVOLUMETET_L2(P)
Number of base functions on tetrahedron for L2 space.
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
int ApproximationOrder
Approximation on the entity.
Definition Types.hpp:26
UBlasVector< double > VectorDouble
Definition Types.hpp:68
constexpr double t
plate stiffness
Definition plate.cpp:58
static boost::function< int(int)> broken_nbvolumetet_edge_hdiv
Definition Hdiv.hpp:27
static boost::function< int(int)> broken_nbvolumetet_face_hdiv
Definition Hdiv.hpp:28
static boost::function< int(int)> broken_nbfacetri_face_hdiv
Definition Hdiv.hpp:26
static boost::function< int(int)> broken_nbvolumetet_volume_hdiv
Definition Hdiv.hpp:29
static boost::function< int(int)> broken_nbfacetri_edge_hdiv
Definition Hdiv.hpp:25
const void * tagNamePrefixData
Field name prefix.
FieldOrderTable forderTable
DOF count functions for each entity type.
const void * tagName
Field name.
int tagNameSize
Field name size in bytes.
std::string getName() const
Get field name as string.
int tagNamePrefixSize
Field name prefix size in bytes.
unsigned int bitNumber
Bit number corresponding to this field's unique ID.
EntityHandle meshSet
Meshset containing field entities.
FieldSpace * tagSpaceData
Field approximation space.
FieldBitNumber getBitNumberCalculate() const
Calculate bit number for this field's ID.
Tag th_FieldData
Tag for field values on entities.
MoFEMErrorCode rebuildDofsOrderMap()
Rebuild DOF order mapping arrays.
FieldContinuity * tagFieldContinuityData
Field continuity type.
FieldCoefficientsNumber * tagNbCoeffData
Field rank (e.g. Temperature=1, displacement in 3D=3)
BitFieldId * tagId
Field unique identifier.
Tag th_FieldDataVerts
Tag for field values on vertices.
FieldApproximationBase * tagBaseData
Field basis functions.
TagType tagFieldDataVertsType
Tag type for vertex data storage.
Tag th_FieldRank
Tag for field rank (vector dimension)
Tag th_AppOrder
Tag for approximation order on entities.
moab::Interface & moab
MOAB interface reference.
static MoFEMErrorCode getFileVersion(moab::Interface &moab, Version &version)
Get database major version.

◆ ~Field()

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

Virtual destructor.

Member Function Documentation

◆ getApproxBase()

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

Get approximation basis type.

Returns
Approximation basis enumeration

Definition at line 161 of file FieldMultiIndices.hpp.

161{ return *tagBaseData; }

◆ getApproxBaseName()

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

Get approximation basis name.

Returns
Approximation basis name string

Definition at line 167 of file FieldMultiIndices.hpp.

167 {
168 return std::string(ApproximationBaseNames[getApproxBase()]);
169 }
static const char *const ApproximationBaseNames[]
Definition definitions.h:72
FieldApproximationBase getApproxBase() const
Get approximation basis type.

◆ getBitNumber()

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

Get bit number for this field's ID.

Returns
Bit position in field ID bitset

Definition at line 188 of file FieldMultiIndices.hpp.

188{ return bitNumber; }

◆ getBitNumberCalculate() [1/2]

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

Calculate bit number for this field's ID.

Returns
Bit position (1-based) or 0 if no bits set

Definition at line 208 of file FieldMultiIndices.hpp.

208 {
209 return getBitNumberCalculate(static_cast<BitFieldId &>(*tagId));
210 }
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
Definition Types.hpp:42

◆ getBitNumberCalculate() [2/2]

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

Calculate bit number from field ID bitset.

Parameters
idField ID bitset
Returns
Bit position (1-based) or 0 if no bits set

Definition at line 195 of file FieldMultiIndices.hpp.

195 {
196 static_assert(BITFIELDID_SIZE >= 32,
197 "Too many fields allowed, can be more but ...");
198 FieldBitNumber b = ffsl(id.to_ulong());
199 if (b != 0)
200 return b;
201 return 0;
202 }
#define BITFIELDID_SIZE
max number of fields
char FieldBitNumber
Field bit number.
Definition Types.hpp:28

◆ getContinuity()

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

Get field continuity type.

There are two types of continuity: CONTINUOUS and DISCONTINUOUS. Discontinuous is used to indicate broken spaces.

Returns
Field continuity enumeration

Definition at line 145 of file FieldMultiIndices.hpp.

145 {
147 }

◆ getContinuityName()

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

Get field continuity name.

Returns
Field continuity name string

Definition at line 153 of file FieldMultiIndices.hpp.

153 {
154 return std::string(FieldContinuityNames[getContinuity()]);
155 }
static const char *const FieldContinuityNames[]
FieldContinuity getContinuity() const
Get field continuity type.

◆ getDofOrderMap() [1/2]

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

Get complete DOF order mapping for all entity types.

Returns
Full DOF order mapping array

Definition at line 239 of file FieldMultiIndices.hpp.

239{ return dofOrderMap; }
DofsOrderMap dofOrderMap

◆ getDofOrderMap() [2/2]

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

Get DOF order mapping for specific entity type.

Parameters
typeEntity type (vertex, edge, face, volume)
Returns
Array mapping DOF index to approximation order
Examples
mofem/atom_tests/forces_and_sources_testing_users_base.cpp.

Definition at line 231 of file FieldMultiIndices.hpp.

231 {
232 return dofOrderMap[type];
233 }

◆ getDofSequenceContainer()

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

Get sequence container for bulk DOF allocation.

Container stores DOF data in bulk for efficiency. Vectors are destroyed when last entity referencing them is removed. Used primarily for vertex DOFs in H1 spaces where DOF count per vertex is fixed.

Returns
Reference to DOF sequence container

Definition at line 221 of file FieldMultiIndices.hpp.

221 {
223 }
SequenceDofContainer sequenceDofContainer

◆ getDofSideMap()

std::map< int, BaseFunction::DofsSideMap > & MoFEM::Field::getDofSideMap ( ) const
inline

Get DOF side mapping for broken spaces.

Maps interior DOFs in broken spaces to entities where their traces are non-zero. Used for discontinuous Galerkin methods.

Returns
Reference to DOF side mapping

Definition at line 251 of file FieldMultiIndices.hpp.

251 {
252 return dofSideMap;
253 }
std::map< int, BaseFunction::DofsSideMap > dofSideMap

◆ getFieldOrderTable()

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

Get field order table.

Returns
Reference to DOF count functions for each entity type

Definition at line 84 of file FieldMultiIndices.hpp.

84{ return forderTable; }

◆ getFieldRawPtr()

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

Get raw pointer to this field.

Returns
Pointer to this field object

Definition at line 268 of file FieldMultiIndices.hpp.

268{ return this; };

◆ getId()

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

Get unique field identifier.

Returns
Field ID bitset

Definition at line 105 of file FieldMultiIndices.hpp.

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

◆ getMeshset()

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

Get field meshset handle.

On this meshset handle are stored tags with field data about base, space, number of coefficients, continuity, etc.

Meshset contains entities on which the field is defined.

Returns
EntityHandle containing field entities

Definition at line 99 of file FieldMultiIndices.hpp.

99{ return meshSet; }

◆ getName()

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

Get field name as string.

Returns
Field name string

Definition at line 119 of file FieldMultiIndices.hpp.

119 {
120 return std::string((char *)tagName, tagNameSize);
121 }

◆ getNameRef()

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

Get field name as string reference.

Returns
Field name string reference

Definition at line 111 of file FieldMultiIndices.hpp.

111 {
112 return boost::string_ref((char *)tagName, tagNameSize);
113 }

◆ getNbOfCoeffs()

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

Get number of field coefficients per DOF.

Scalar fields have 1 coefficient, vector fields in 3D have 3. Coefficients may represent spatial components, physical quantities, or mixed formulations depending on the field interpretation.

Returns
Number of coefficients

Definition at line 180 of file FieldMultiIndices.hpp.

180 {
181 return *tagNbCoeffData;
182 };

◆ getSpace()

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

Get field approximation space.

Returns
Approximation space enumeration

Definition at line 127 of file FieldMultiIndices.hpp.

127{ return *tagSpaceData; }

◆ getSpaceName()

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

Get field approximation space name.

Returns
Approximation space name string

Definition at line 133 of file FieldMultiIndices.hpp.

133 {
134 return std::string(FieldSpaceNames[getSpace()]);
135 }
static const char *const FieldSpaceNames[]
Definition definitions.h:92
FieldSpace getSpace() const
Get field approximation space.

◆ rebuildDofsOrderMap()

MoFEMErrorCode MoFEM::Field::rebuildDofsOrderMap ( )

Rebuild DOF order mapping arrays.

Returns
Error code

Definition at line 517 of file FieldMultiIndices.cpp.

517 {
519
520 for (auto t = MBVERTEX; t != MBMAXTYPE; ++t) {
521
522 int DD = 0;
523 int nb_last_order_dofs = 0;
524 const int rank = (*tagNbCoeffData);
525 if (forderTable[t]) {
526
527 for (int oo = 0; oo < MAX_DOFS_ON_ENTITY; ++oo) {
528
529 const int nb_order_dofs = forderTable[t](oo);
530 const int diff_oo = nb_order_dofs - nb_last_order_dofs;
531 if (diff_oo >= 0) {
532
533 if ((DD + rank * diff_oo) < MAX_DOFS_ON_ENTITY)
534 for (int dd = 0; dd < diff_oo; ++dd)
535 for (int rr = 0; rr != rank; ++rr, ++DD)
536 dofOrderMap[t][DD] = oo;
537 else
538 break;
539
540 nb_last_order_dofs = nb_order_dofs;
541
542 } else {
543 break;
544 }
545 }
546 }
547
548 std::fill(&dofOrderMap[t][DD], dofOrderMap[t].end(), -1);
549 }
550
552}
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
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 Symbol Documentation

◆ operator<<

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

Output stream operator for field information.

Definition at line 554 of file FieldMultiIndices.cpp.

554 {
555 os << e.getNameRef() << " field_id " << e.getId().to_ulong() << " space "
556 << e.getSpaceName() << " field continuity " << e.getContinuityName()
557 << " approximation base " << e.getApproxBaseName() << " nb coefficients "
558 << e.getNbOfCoeffs() << " meshset " << e.meshSet;
559 return os;
560}

Member Data Documentation

◆ bitNumber

unsigned int MoFEM::Field::bitNumber

Bit number corresponding to this field's unique ID.

Definition at line 87 of file FieldMultiIndices.hpp.

◆ dofOrderMap

DofsOrderMap MoFEM::Field::dofOrderMap
mutableprivate

Definition at line 272 of file FieldMultiIndices.hpp.

◆ dofSideMap

std::map<int, BaseFunction::DofsSideMap> MoFEM::Field::dofSideMap
mutableprivate

Definition at line 273 of file FieldMultiIndices.hpp.

◆ forderTable

FieldOrderTable MoFEM::Field::forderTable

DOF count functions for each entity type.

Definition at line 78 of file FieldMultiIndices.hpp.

◆ maxBrokenDofsOrder

constexpr int MoFEM::Field::maxBrokenDofsOrder = 10
staticconstexpr

Maximum order for broken space DOFs.

Definition at line 241 of file FieldMultiIndices.hpp.

◆ meshSet

EntityHandle MoFEM::Field::meshSet

Meshset containing field entities.

Definition at line 59 of file FieldMultiIndices.hpp.

◆ moab

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

MOAB interface reference.

Definition at line 57 of file FieldMultiIndices.hpp.

◆ sequenceDofContainer

SequenceDofContainer MoFEM::Field::sequenceDofContainer
mutableprivate

Definition at line 271 of file FieldMultiIndices.hpp.

◆ tagBaseData

FieldApproximationBase* MoFEM::Field::tagBaseData

Field basis functions.

Definition at line 70 of file FieldMultiIndices.hpp.

◆ tagFieldContinuityData

FieldContinuity* MoFEM::Field::tagFieldContinuityData

Field continuity type.

Definition at line 69 of file FieldMultiIndices.hpp.

◆ tagFieldDataVertsType

TagType MoFEM::Field::tagFieldDataVertsType

Tag type for vertex data storage.

Definition at line 61 of file FieldMultiIndices.hpp.

◆ tagId

BitFieldId* MoFEM::Field::tagId

Field unique identifier.

Definition at line 67 of file FieldMultiIndices.hpp.

◆ tagName

const void* MoFEM::Field::tagName

Field name.

Definition at line 74 of file FieldMultiIndices.hpp.

◆ tagNamePrefixData

const void* MoFEM::Field::tagNamePrefixData

Field name prefix.

Definition at line 76 of file FieldMultiIndices.hpp.

◆ tagNamePrefixSize

int MoFEM::Field::tagNamePrefixSize

Field name prefix size in bytes.

Definition at line 77 of file FieldMultiIndices.hpp.

◆ tagNameSize

int MoFEM::Field::tagNameSize

Field name size in bytes.

Definition at line 75 of file FieldMultiIndices.hpp.

◆ tagNbCoeffData

FieldCoefficientsNumber* MoFEM::Field::tagNbCoeffData

Field rank (e.g. Temperature=1, displacement in 3D=3)

Definition at line 73 of file FieldMultiIndices.hpp.

◆ tagSpaceData

FieldSpace* MoFEM::Field::tagSpaceData

Field approximation space.

Definition at line 68 of file FieldMultiIndices.hpp.

◆ th_AppOrder

Tag MoFEM::Field::th_AppOrder

Tag for approximation order on entities.

Definition at line 64 of file FieldMultiIndices.hpp.

◆ th_FieldData

Tag MoFEM::Field::th_FieldData

Tag for field values on entities.

Definition at line 63 of file FieldMultiIndices.hpp.

◆ th_FieldDataVerts

Tag MoFEM::Field::th_FieldDataVerts

Tag for field values on vertices.

Definition at line 62 of file FieldMultiIndices.hpp.

◆ th_FieldRank

Tag MoFEM::Field::th_FieldRank

Tag for field rank (vector dimension)

Definition at line 65 of file FieldMultiIndices.hpp.


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