v0.16.3
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.
 
FieldOrderTable & getFieldOrderTable ()
 Get field order table.
 
EntityHandle getMeshset () const
 Get field meshset handle.
 
const BitFieldId & getId () 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.
 
SequenceDofContainer & getDofSequenceContainer () 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 DofsOrderMap & getDofOrderMap () 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 Field * getFieldRawPtr () 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)
 
BitFieldId * tagId
 Field unique identifier.
 
FieldSpace * tagSpaceData
 Field approximation space.
 
FieldContinuity * tagFieldContinuityData
 Field continuity type.
 
FieldApproximationBase * tagBaseData
 Field basis functions.
 
FieldCoefficientsNumber * tagNbCoeffData
 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::DofsSideMap > dofSideMap
 

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, and mofem/atom_tests/scalar_check_approximation.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 11 of file FieldMultiIndices.cpp.

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

◆ 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 511 of file FieldMultiIndices.cpp.

511 {
513
514 for (auto t = MBVERTEX; t != MBMAXTYPE; ++t) {
515
516 int DD = 0;
517 int nb_last_order_dofs = 0;
518 const int rank = (*tagNbCoeffData);
519 if (forderTable[t]) {
520
521 for (int oo = 0; oo < MAX_DOFS_ON_ENTITY; ++oo) {
522
523 const int nb_order_dofs = forderTable[t](oo);
524 const int diff_oo = nb_order_dofs - nb_last_order_dofs;
525 if (diff_oo >= 0) {
526
527 if ((DD + rank * diff_oo) < MAX_DOFS_ON_ENTITY)
528 for (int dd = 0; dd < diff_oo; ++dd)
529 for (int rr = 0; rr != rank; ++rr, ++DD)
530 dofOrderMap[t][DD] = oo;
531 else
532 break;
533
534 nb_last_order_dofs = nb_order_dofs;
535
536 } else {
537 break;
538 }
539 }
540 }
541
542 std::fill(&dofOrderMap[t][DD], dofOrderMap[t].end(), -1);
543 }
544
546}
It end
Definition Schur.cpp:2568
#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 548 of file FieldMultiIndices.cpp.

548 {
549 os << e.getNameRef() << " field_id " << e.getId().to_ulong() << " space "
550 << e.getSpaceName() << " field continuity " << e.getContinuityName()
551 << " approximation base " << e.getApproxBaseName() << " nb coefficients "
552 << e.getNbOfCoeffs() << " meshset " << e.meshSet;
553 return os;
554}

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: