v0.15.0
Loading...
Searching...
No Matches
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
 
using DofsOrderMap
 

Public Member Functions

 Field (moab::Interface &moab, const EntityHandle meshset)
 constructor for moab field
 
virtual ~Field ()=default
 
FieldOrderTablegetFieldOrderTable ()
 Get the Field Order Table.
 
EntityHandle getMeshset () const
 Get field meshset.
 
const BitFieldIdgetId () const
 Get unique field id.
 
boost::string_ref getNameRef () const
 Get string reference to field name.
 
std::string getName () const
 Get field name.
 
FieldSpace getSpace () const
 Get field approximation space.
 
auto getSpaceName () const
 Get field approximation space.
 
FieldContinuity getContinuity () const
 Get field space continuity.
 
auto getContinuityName () const
 Get field space continuity name.
 
FieldApproximationBase getApproxBase () const
 Get approximation base.
 
auto getApproxBaseName () const
 Get approximation base.
 
FieldCoefficientsNumber getNbOfCoeffs () const
 Get number of field coefficients.
 
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.
 
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.
 
SequenceDofContainergetDofSequenceContainer () const
 Get reference to sequence data container.
 
const std::array< ApproximationOrder, MAX_DOFS_ON_ENTITY > & getDofOrderMap (const EntityType type) const
 get hash-map relating dof index on entity with its order
 
const DofsOrderMapgetDofOrderMap () const
 get hash-map relating dof index on entity with its order
 
std::map< int, BaseFunction::DofsSideMap > & getDofSideMap () const
 Get the dofs side map.
 
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.
 

Public Attributes

moab::Interface & moab
 
EntityHandle meshSet
 keeps entities for this meshset
 
TagType tagFieldDataVertsType
 
Tag th_FieldDataVerts
 Tag storing field values on vertices in the field.
 
Tag th_FieldData
 Tag storing field values on entity in the field.
 
Tag th_AppOrder
 Tag storing approximation order on entity.
 
Tag th_FieldRank
 
BitFieldIdtagId
 Tag field rank.
 
FieldSpacetagSpaceData
 tag keeps field space
 
FieldContinuitytagFieldContinuityData
 tag keeps field continuity
 
FieldApproximationBasetagBaseData
 tag keeps field base
 
FieldCoefficientsNumbertagNbCoeffData
 
const void * tagName
 tag keeps name of the field
 
int tagNameSize
 number of bits necessary to keep field name
 
const void * tagNamePrefixData
 tag keeps name prefix of the field
 
int tagNamePrefixSize
 
FieldOrderTable forderTable
 nb. DOFs table for entities
 
unsigned int bitNumber
 

Static Public Attributes

static constexpr int maxBrokenDofsOrder = 10
 max number of broken dofs
 

Private Attributes

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

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 field 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

Initial value:
std::array<std::array<int, MAX_DOFS_ON_ENTITY>, MBMAXTYPE>

Definition at line 68 of file FieldMultiIndices.hpp.

◆ SequenceDofContainer

Initial value:
multi_index_container<
boost::weak_ptr<std::vector<DofEntity>>,
indexed_by<sequenced<>>>

Definition at line 62 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 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 nme:nme847.
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
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
tag keeps name prefix of the field
FieldOrderTable forderTable
nb. DOFs table for entities
const void * tagName
tag keeps name of the field
int tagNameSize
number of bits necessary to keep field name
std::string getName() const
Get field name.
unsigned int bitNumber
EntityHandle meshSet
keeps entities for this meshset
FieldSpace * tagSpaceData
tag keeps field space
FieldBitNumber getBitNumberCalculate() const
Calculate number of set bit in Field ID. Each field has uid, get getBitNumber get number of bit set f...
Tag th_FieldData
Tag storing field values on entity in the field.
MoFEMErrorCode rebuildDofsOrderMap()
FieldContinuity * tagFieldContinuityData
tag keeps field continuity
FieldCoefficientsNumber * tagNbCoeffData
BitFieldId * tagId
Tag field rank.
Tag th_FieldDataVerts
Tag storing field values on vertices in the field.
FieldApproximationBase * tagBaseData
tag keeps field base
TagType tagFieldDataVertsType
Tag th_AppOrder
Tag storing approximation order on entity.
moab::Interface & moab
static MoFEMErrorCode getFileVersion(moab::Interface &moab, Version &version)
Get database major version.

◆ ~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 }
static const char *const ApproximationBaseNames[]
Definition definitions.h:72
FieldApproximationBase getApproxBase() const
Get approximation base.

◆ 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 }
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
Definition Types.hpp:42

◆ 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 }
#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 space continuity.

Definition at line 162 of file FieldMultiIndices.hpp.

162 {
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 }
static const char *const FieldContinuityNames[]
FieldContinuity getContinuity() const
Get field space continuity.

◆ 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; }
DofsOrderMap 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 {
257 }
SequenceDofContainer sequenceDofContainer

◆ getDofSideMap()

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

Get the dofs side map.

This establish connection between dofs in the interior of broken specs and entity on which trace of the dof is nonzero.

Returns
const BaseFunction::DofsSideMap&

Definition at line 292 of file FieldMultiIndices.hpp.

292 {
293 return dofSideMap;
294 }
std::map< int, BaseFunction::DofsSideMap > dofSideMap

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

300{ 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 field 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 }
static const char *const FieldSpaceNames[]
Definition definitions.h:92
FieldSpace getSpace() const
Get field approximation space.

◆ rebuildDofsOrderMap()

MoFEMErrorCode MoFEM::Field::rebuildDofsOrderMap ( )

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

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

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

◆ dofSideMap

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

Definition at line 305 of file FieldMultiIndices.hpp.

◆ forderTable

FieldOrderTable MoFEM::Field::forderTable

nb. DOFs table for entities

Definition at line 94 of file FieldMultiIndices.hpp.

◆ maxBrokenDofsOrder

int MoFEM::Field::maxBrokenDofsOrder = 10
staticconstexpr

max number of broken dofs

Definition at line 282 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 303 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: