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

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

#include <src/multi_indices/FieldMultiIndices.hpp>

Public Types

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

Public Member Functions

 Field (moab::Interface &moab, const EntityHandle meshset)
 constructor for moab field More...
 
virtual ~Field ()=default
 
FieldOrderTablegetFieldOrderTable ()
 Get the Field Order Table. More...
 
UId generateGlobalUniqueIdForTypeLo (const EntityType type, const int owner_proc) const
 
UId generateGlobalUniqueIdForTypeHi (const EntityType type, const int owner_proc) const
 
EntityHandle getMeshset () const
 Get field meshset. More...
 
const BitFieldIdgetId () const
 Get unique field id. More...
 
boost::string_ref getNameRef () const
 Get string reference to field name. More...
 
std::string getName () const
 Get field name. More...
 
FieldSpace getSpace () const
 Get field approximation space. More...
 
auto getSpaceName () const
 Get field approximation space. More...
 
FieldApproximationBase getApproxBase () const
 Get approximation base. More...
 
auto getApproxBaseName () const
 Get approximation base. More...
 
FieldCoefficientsNumber getNbOfCoeffs () const
 Get number of field coefficients. More...
 
FieldBitNumber getBitNumber () const
 Get number of set bit in Field ID. Each field has uid, get getBitNumber get number of bit set for given field. Field ID has only one bit set for each field. More...
 
FieldBitNumber getBitNumberCalculate () const
 Calculate number of set bit in Field ID. Each field has uid, get getBitNumber get number of bit set for given field. Field ID has only one bit set for each field. More...
 
SequenceDofContainergetDofSequenceContainer () const
 Get reference to sequence data container. More...
 
const std::array< ApproximationOrder, MAX_DOFS_ON_ENTITY > & getDofOrderMap (const EntityType type) const
 get hash-map relating dof index on entity with its order More...
 
const DofsOrderMapgetDofOrderMap () const
 get hash-map relating dof index on entity with its order More...
 
MoFEMErrorCode rebuildDofsOrderMap ()
 
const FieldgetFieldRawPtr () const
 

Static Public Member Functions

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

Public Attributes

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

Private Attributes

SequenceDofContainer sequenceDofContainer
 
DofsOrderMap dofOrderMap
 

Friends

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

Detailed Description

Provide data structure for (tensor) field approximation.

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

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

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

Examples
EshelbianPlasticity.cpp, and forces_and_sources_testing_users_base.cpp.

Definition at line 64 of file FieldMultiIndices.hpp.

Member Typedef Documentation

◆ DofsOrderMap

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

Definition at line 82 of file FieldMultiIndices.hpp.

◆ SequenceDofContainer

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

Definition at line 75 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 29 of file FieldMultiIndices.cpp.

30 : moab(moab), meshSet(meshset), tagId(NULL), tagSpaceData(NULL),
31 tagNbCoeffData(NULL), tagName(NULL), tagNameSize(0) {
32
33 auto get_tag_data_ptr = [&](const auto name, auto &tag_data) {
35 Tag th;
36 CHKERR moab.tag_get_handle(name, th);
37 CHKERR moab.tag_get_by_ptr(th, &meshset, 1, (const void **)&tag_data);
39 };
40
41 // id
42 ierr = get_tag_data_ptr("_FieldId", tagId);
43 CHKERRABORT(PETSC_COMM_SELF, ierr);
44 // space
45 ierr = get_tag_data_ptr("_FieldSpace", tagSpaceData);
46 CHKERRABORT(PETSC_COMM_SELF, ierr);
47
48 // approx. base
49 ierr = get_tag_data_ptr("_FieldBase", tagBaseData);
50 CHKERRABORT(PETSC_COMM_SELF, ierr);
51
52 // name
53 Tag th_field_name;
54 CHKERR moab.tag_get_handle("_FieldName", th_field_name);
55 CHKERR moab.tag_get_by_ptr(th_field_name, &meshSet, 1,
56 (const void **)&tagName, &tagNameSize);
57 // name prefix
58 Tag th_field_name_data_name_prefix;
59 CHKERR moab.tag_get_handle("_FieldName_DataNamePrefix",
60 th_field_name_data_name_prefix);
61 CHKERR moab.tag_get_by_ptr(th_field_name_data_name_prefix, &meshSet, 1,
62 (const void **)&tagNamePrefixData,
64 std::string name_data_prefix((char *)tagNamePrefixData, tagNamePrefixSize);
65
66 // rank
67 std::string Tag_rank_name = "_Field_Rank_" + getName();
68 CHKERR moab.tag_get_handle(Tag_rank_name.c_str(), th_FieldRank);
69 CHKERR moab.tag_get_by_ptr(th_FieldRank, &meshSet, 1,
70 (const void **)&tagNbCoeffData);
71
72 auto get_all_tags = [&]() {
74 // order
75 ApproximationOrder def_approx_order = -1;
76 std::string tag_approximation_order_name = "_App_Order_" + getName();
77 rval = moab.tag_get_handle(tag_approximation_order_name.c_str(), 1,
78 MB_TYPE_INTEGER, th_AppOrder,
79 MB_TAG_CREAT | MB_TAG_SPARSE, &def_approx_order);
80 if (rval == MB_ALREADY_ALLOCATED)
81 rval = MB_SUCCESS;
83
84 // data
85 std::string tag_data_name = name_data_prefix + getName();
86 const int def_len = 0;
87 rval = moab.tag_get_handle(
88 tag_data_name.c_str(), def_len, MB_TYPE_DOUBLE, th_FieldData,
89 MB_TAG_CREAT | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
90 if (rval == MB_ALREADY_ALLOCATED)
91 rval = MB_SUCCESS;
93
94 std::string tag_data_name_verts = name_data_prefix + getName() + "_V";
95 rval = moab.tag_get_handle(tag_data_name_verts.c_str(), th_FieldDataVerts);
96 if (rval == MB_SUCCESS)
98 else {
99 // Since vertex tag is not it mesh that tag is not dense, it is sparse,
100 // sinc it is set to all vertices on the mesh. Is unlikely that mesh has
101 // no vertices, then above assumption does not hold.
102 tagFieldDataVertsType = MB_TAG_SPARSE;
103 VectorDouble def_vert_data(*tagNbCoeffData);
104 def_vert_data.clear();
105 rval = moab.tag_get_handle(tag_data_name_verts.c_str(), *tagNbCoeffData,
106 MB_TYPE_DOUBLE, th_FieldDataVerts,
107 MB_TAG_CREAT | tagFieldDataVertsType,
108 &*def_vert_data.begin());
109 if (rval == MB_ALREADY_ALLOCATED)
110 rval = MB_SUCCESS;
112 }
113
115 };
116
117 auto get_all_tags_deprecated = [&]() {
119 // order
120 ApproximationOrder def_approx_order = -1;
121 std::string tag_approximation_order_name = "_App_Order_" + getName();
122 rval = moab.tag_get_handle(tag_approximation_order_name.c_str(), 1,
123 MB_TYPE_INTEGER, th_AppOrder,
124 MB_TAG_CREAT | MB_TAG_SPARSE, &def_approx_order);
125 if (rval == MB_ALREADY_ALLOCATED)
126 rval = MB_SUCCESS;
128
129 // data
130 std::string tag_data_name = name_data_prefix + getName();
131 const int def_len = 0;
132 rval = moab.tag_get_handle(
133 tag_data_name.c_str(), def_len, MB_TYPE_DOUBLE, th_FieldData,
134 MB_TAG_CREAT | MB_TAG_VARLEN | MB_TAG_SPARSE, NULL);
135 if (rval == MB_ALREADY_ALLOCATED)
136 rval = MB_SUCCESS;
138
139 std::string tag_data_name_verts = name_data_prefix + getName() + "V";
140 rval = moab.tag_get_handle(tag_data_name_verts.c_str(), th_FieldDataVerts);
141 if (rval == MB_SUCCESS)
143 else {
144 // Since vertex tag is not it mesh that tag is not dense, it is sparse,
145 // sinc it is set to all vertices on the mesh. Is unlikely that mesh has
146 // no vertices, then above assumption does not hold.
147 tagFieldDataVertsType = MB_TAG_SPARSE;
148 VectorDouble def_vert_data(*tagNbCoeffData);
149 def_vert_data.clear();
150 rval = moab.tag_get_handle(tag_data_name_verts.c_str(), *tagNbCoeffData,
151 MB_TYPE_DOUBLE, th_FieldDataVerts,
152 MB_TAG_CREAT | tagFieldDataVertsType,
153 &*def_vert_data.begin());
154 if (rval == MB_ALREADY_ALLOCATED)
155 rval = MB_SUCCESS;
157 }
158
160 };
161
162 Version file_ver;
164 CHK_THROW_MESSAGE(ierr, "Not known file version");
165 if (file_ver.majorVersion >= 0 && file_ver.minorVersion >= 12 &&
166 file_ver.buildVersion >= 1) {
167 ierr = get_all_tags();
168 CHKERRABORT(PETSC_COMM_SELF, ierr);
169 } else {
170 ierr = get_all_tags_deprecated();
171 CHKERRABORT(PETSC_COMM_SELF, ierr);
172 }
173
175
176 auto reset_entity_order_table = [&]() {
177 for (int tt = 0; tt != MBMAXTYPE; ++tt)
178 forderTable[tt] = NULL;
179 };
180
181 auto set_entity_order_table = [&]() {
182 switch (*tagBaseData) {
185 switch (*tagSpaceData) {
186 case H1:
187 forderTable[MBVERTEX] = [](int P) -> int { return (P > 0) ? 1 : 0; };
188 forderTable[MBEDGE] = [](int P) -> int { return NBEDGE_H1(P); };
189 forderTable[MBTRI] = [](int P) -> int { return NBFACETRI_H1(P); };
190 forderTable[MBQUAD] = [](int P) -> int { return NBFACEQUAD_H1(P); };
191 forderTable[MBTET] = [](int P) -> int { return NBVOLUMETET_H1(P); };
192 forderTable[MBHEX] = [](int P) -> int { return NBVOLUMEHEX_H1(P); };
193 forderTable[MBPRISM] = [](int P) -> int { return NBVOLUMEPRISM_H1(P); };
194 break;
195 case HCURL:
196 forderTable[MBVERTEX] = [](int P) -> int {
197 (void)P;
198 return 0;
199 };
200 forderTable[MBEDGE] = [](int P) -> int {
201 return NBEDGE_AINSWORTH_HCURL(P);
202 };
203 forderTable[MBTRI] = [](int P) -> int {
205 };
206 forderTable[MBTET] = [](int P) -> int {
208 };
209 break;
210 case HDIV:
211 forderTable[MBVERTEX] = [](int P) -> int {
212 (void)P;
213 return 0;
214 };
215 forderTable[MBEDGE] = [](int P) -> int {
216 (void)P;
217 return NBEDGE_HDIV(P);
218 };
219 forderTable[MBTRI] = [](int P) -> int {
220 return NBFACETRI_AINSWORTH_HDIV(P);
221 };
222 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 reset_entity_order_table();
357 set_entity_order_table();
359 CHKERRABORT(PETSC_COMM_SELF, ierr);
360};
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:73
@ AINSWORTH_LOBATTO_BASE
Definition: definitions.h:75
@ USER_BASE
user implemented approximation base
Definition: definitions.h:81
@ DEMKOWICZ_JACOBI_BASE
Definition: definitions.h:79
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
Definition: definitions.h:77
#define MOAB_THROW(err)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:554
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
Definition: definitions.h:608
@ L2
field with C-1 continuity
Definition: definitions.h:101
@ NOFIELD
scalar or vector of scalars describe (no true field)
Definition: definitions.h:97
@ H1
continuous field
Definition: definitions.h:98
@ HCURL
field with continuous tangents
Definition: definitions.h:99
@ HDIV
field with continuous normal traction
Definition: definitions.h:100
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
#define CHKERR
Inline error check.
Definition: definitions.h:548
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
Definition: definitions.h:574
#define NBFACEQUAD_DEMKOWICZ_HDIV(P)
#define NBEDGE_DEMKOWICZ_HCURL(P)
#define NBVOLUMETET_H1(P)
Number of base functions on tetrahedron for H1 space.
#define NBVOLUMETET_AINSWORTH_HDIV(P)
#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 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)
Numer of base function on edge for H1 space.
#define NBFACETRI_DEMKOWICZ_HDIV(P)
#define NBEDGE_L2(P)
Number of base functions on edge fro L2 space.
#define NBVOLUMEHEX_L2(P)
Number of base functions on hexahedron for L2 space.
#define NBVOLUMETET_DEMKOWICZ_HCURL(P)
#define NBFACETRI_DEMKOWICZ_HCURL(P)
#define NBEDGE_AINSWORTH_HCURL(P)
#define NBFACETRI_H1(P)
Number of base function on triangle for H1 space.
#define NBFACETRI_AINSWORTH_HDIV(P)
#define NBVOLUMETET_L2(P)
Number of base functions on tetrahedron for L2 space.
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:87
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:85
int ApproximationOrder
Approximation on the entity.
Definition: Types.hpp:37
UBlasVector< double > VectorDouble
Definition: Types.hpp:79
constexpr double t
plate stiffness
Definition: plate.cpp:76
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()
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

◆ generateGlobalUniqueIdForTypeHi() [1/2]

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

Definition at line 136 of file FieldMultiIndices.hpp.

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

◆ generateGlobalUniqueIdForTypeHi() [2/2]

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

Definition at line 146 of file FieldMultiIndices.hpp.

147 {
149 }
static UId generateGlobalUniqueIdForTypeHi(const char bit_number, const EntityType type, const int owner_proc)

◆ generateGlobalUniqueIdForTypeLo() [1/2]

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

Definition at line 121 of file FieldMultiIndices.hpp.

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

◆ generateGlobalUniqueIdForTypeLo() [2/2]

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

Definition at line 131 of file FieldMultiIndices.hpp.

132 {
134 }
static UId generateGlobalUniqueIdForTypeLo(const char bit_number, const EntityType type, const int owner_proc)

◆ getApproxBase()

FieldApproximationBase MoFEM::Field::getApproxBase ( ) const

Get approximation base.

Returns
Approximation base

Definition at line 207 of file FieldMultiIndices.hpp.

207{ return *tagBaseData; }

◆ getApproxBaseName()

auto MoFEM::Field::getApproxBaseName ( ) const

Get approximation base.

Returns
Approximation base name

Definition at line 213 of file FieldMultiIndices.hpp.

213 {
214 return std::string(ApproximationBaseNames[getApproxBase()]);
215 }
static const char *const ApproximationBaseNames[]
Definition: definitions.h:85
FieldApproximationBase getApproxBase() const
Get approximation base.

◆ getBitNumber()

FieldBitNumber MoFEM::Field::getBitNumber ( ) const

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

Definition at line 240 of file FieldMultiIndices.hpp.

240{ return bitNumber; }

◆ getBitNumberCalculate() [1/2]

FieldBitNumber MoFEM::Field::getBitNumberCalculate ( ) const

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

Definition at line 261 of file FieldMultiIndices.hpp.

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

◆ getBitNumberCalculate() [2/2]

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

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

Definition at line 247 of file FieldMultiIndices.hpp.

247 {
248 static_assert(BITFIELDID_SIZE >= 32,
249 "Too many fields allowed, can be more but ...");
250 FieldBitNumber b = ffsl(id.to_ulong());
251 if (b != 0)
252 return b;
253 return 0;
254 }
#define BITFIELDID_SIZE
max number of fields
Definition: definitions.h:233
char FieldBitNumber
Field bit number.
Definition: Types.hpp:39

◆ getDofOrderMap() [1/2]

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

get hash-map relating dof index on entity with its order

Dofs of given field are indexed on entity of the same type, same space, approximation base and number of coefficients, are sorted in the way.

Definition at line 309 of file FieldMultiIndices.hpp.

309{ return dofOrderMap; }
DofsOrderMap dofOrderMap

◆ getDofOrderMap() [2/2]

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

get hash-map relating dof index on entity with its order

Dofs of given field are indexed on entity of the same type, same space, approximation base and number of coefficients, are sorted in the way.

Examples
forces_and_sources_testing_users_base.cpp.

Definition at line 297 of file FieldMultiIndices.hpp.

297 {
298 return dofOrderMap[type];
299 }

◆ getDofSequenceContainer()

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

Get reference to sequence data container.

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

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

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

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

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

Returns
MoFEM::Field::SequenceDofContainer

Definition at line 284 of file FieldMultiIndices.hpp.

284 {
286 }
SequenceDofContainer sequenceDofContainer

◆ getFieldOrderTable()

FieldOrderTable & MoFEM::Field::getFieldOrderTable ( )

Get the Field Order Table.

Returns
FieldOrderTable&

Definition at line 113 of file FieldMultiIndices.hpp.

113{ return forderTable; }

◆ getFieldRawPtr()

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

Definition at line 315 of file FieldMultiIndices.hpp.

315{ return this; };

◆ getId()

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

Get unique field id.

Returns
Filed ID

Definition at line 171 of file FieldMultiIndices.hpp.

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

◆ getMeshset()

EntityHandle MoFEM::Field::getMeshset ( ) const

Get field meshset.

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

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

Returns
EntityHandle

Definition at line 165 of file FieldMultiIndices.hpp.

165{ return meshSet; }

◆ getName()

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

Get field name.

Returns
Field name

Definition at line 185 of file FieldMultiIndices.hpp.

185 {
186 return std::string((char *)tagName, tagNameSize);
187 }

◆ getNameRef()

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

Get string reference to field name.

Returns
Field name

Definition at line 177 of file FieldMultiIndices.hpp.

177 {
178 return boost::string_ref((char *)tagName, tagNameSize);
179 }

◆ getNbOfCoeffs()

FieldCoefficientsNumber MoFEM::Field::getNbOfCoeffs ( ) const

Get number of field coefficients.

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

Definition at line 231 of file FieldMultiIndices.hpp.

231 {
232 return *tagNbCoeffData;
233 };

◆ getSpace()

FieldSpace MoFEM::Field::getSpace ( ) const

Get field approximation space.

Returns
approximation space

Definition at line 193 of file FieldMultiIndices.hpp.

193{ return *tagSpaceData; }

◆ getSpaceName()

auto MoFEM::Field::getSpaceName ( ) const

Get field approximation space.

Returns
approximation space name

Definition at line 199 of file FieldMultiIndices.hpp.

199 {
200 return std::string(FieldSpaceNames[getSpace()]);
201 }
static const char *const FieldSpaceNames[]
Definition: definitions.h:105
FieldSpace getSpace() const
Get field approximation space.

◆ rebuildDofsOrderMap()

MoFEMErrorCode MoFEM::Field::rebuildDofsOrderMap ( )

Definition at line 362 of file FieldMultiIndices.cpp.

362 {
364
365 for (auto t = MBVERTEX; t != MBMAXTYPE; ++t) {
366
367 int DD = 0;
368 int nb_last_order_dofs = 0;
369 const int rank = (*tagNbCoeffData);
370 if (forderTable[t]) {
371
372 for (int oo = 0; oo < MAX_DOFS_ON_ENTITY; ++oo) {
373
374 const int nb_order_dofs = forderTable[t](oo);
375 const int diff_oo = nb_order_dofs - nb_last_order_dofs;
376 if (diff_oo >= 0) {
377
378 if ((DD + rank * diff_oo) < MAX_DOFS_ON_ENTITY)
379 for (int dd = 0; dd < diff_oo; ++dd)
380 for (int rr = 0; rr != rank; ++rr, ++DD)
381 dofOrderMap[t][DD] = oo;
382 else
383 break;
384
385 nb_last_order_dofs = nb_order_dofs;
386
387 } else {
388 break;
389 }
390 }
391 }
392
393 std::fill(&dofOrderMap[t][DD], dofOrderMap[t].end(), -1);
394 }
395
397}
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
Definition: definitions.h:249
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 399 of file FieldMultiIndices.cpp.

399 {
400 os << e.getNameRef() << " field_id " << e.getId().to_ulong() << " space "
401 << FieldSpaceNames[e.getSpace()] << " approximation base "
402 << ApproximationBaseNames[e.getApproxBase()] << " nb coefficients "
403 << e.getNbOfCoeffs() << " meshset " << e.meshSet;
404 return os;
405}

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

◆ dofOrderMap

DofsOrderMap MoFEM::Field::dofOrderMap
mutableprivate

Definition at line 319 of file FieldMultiIndices.hpp.

◆ forderTable

FieldOrderTable MoFEM::Field::forderTable

nb. DOFs table for entities

Definition at line 106 of file FieldMultiIndices.hpp.

◆ meshSet

EntityHandle MoFEM::Field::meshSet

keeps entities for this meshset

Definition at line 86 of file FieldMultiIndices.hpp.

◆ moab

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

Definition at line 84 of file FieldMultiIndices.hpp.

◆ sequenceDofContainer

SequenceDofContainer MoFEM::Field::sequenceDofContainer
mutableprivate

Definition at line 318 of file FieldMultiIndices.hpp.

◆ tagBaseData

FieldApproximationBase* MoFEM::Field::tagBaseData

tag keeps field base

Definition at line 96 of file FieldMultiIndices.hpp.

◆ tagFieldDataVertsType

TagType MoFEM::Field::tagFieldDataVertsType

Definition at line 88 of file FieldMultiIndices.hpp.

◆ tagId

BitFieldId* MoFEM::Field::tagId

Tag field rank.

tag keeps field id

Definition at line 94 of file FieldMultiIndices.hpp.

◆ tagName

const void* MoFEM::Field::tagName

tag keeps name of the field

Definition at line 101 of file FieldMultiIndices.hpp.

◆ tagNamePrefixData

const void* MoFEM::Field::tagNamePrefixData

tag keeps name prefix of the field

Definition at line 103 of file FieldMultiIndices.hpp.

◆ tagNamePrefixSize

int MoFEM::Field::tagNamePrefixSize

number of bits necessary to keep field name prefix

Definition at line 104 of file FieldMultiIndices.hpp.

◆ tagNameSize

int MoFEM::Field::tagNameSize

number of bits necessary to keep field name

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

◆ tagSpaceData

FieldSpace* MoFEM::Field::tagSpaceData

tag keeps field space

Definition at line 95 of file FieldMultiIndices.hpp.

◆ th_AppOrder

Tag MoFEM::Field::th_AppOrder

Tag storing approximation order on entity.

Definition at line 91 of file FieldMultiIndices.hpp.

◆ th_FieldData

Tag MoFEM::Field::th_FieldData

Tag storing field values on entity in the field.

Definition at line 90 of file FieldMultiIndices.hpp.

◆ th_FieldDataVerts

Tag MoFEM::Field::th_FieldDataVerts

Tag storing field values on vertices in the field.

Definition at line 89 of file FieldMultiIndices.hpp.

◆ th_FieldRank

Tag MoFEM::Field::th_FieldRank

Definition at line 92 of file FieldMultiIndices.hpp.


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