12 : moab(moab), meshSet(meshset), tagId(NULL), tagSpaceData(NULL),
13 tagFieldContinuityData(NULL), tagNbCoeffData(NULL), tagName(NULL),
16 auto get_tag_data_ptr = [&](
const auto name,
auto &tag_data) {
20 CHKERR moab.tag_get_by_ptr(
th, &meshset, 1, (
const void **)&tag_data);
25 ierr = get_tag_data_ptr(
"_FieldId",
tagId);
26 CHKERRABORT(PETSC_COMM_SELF,
ierr);
29 CHKERRABORT(PETSC_COMM_SELF,
ierr);
32 CHKERRABORT(PETSC_COMM_SELF,
ierr);
36 CHKERRABORT(PETSC_COMM_SELF,
ierr);
40 CHKERR moab.tag_get_handle(
"_FieldName", th_field_name);
44 Tag th_field_name_data_name_prefix;
45 CHKERR moab.tag_get_handle(
"_FieldName_DataNamePrefix",
46 th_field_name_data_name_prefix);
53 std::string Tag_rank_name =
"_Field_Rank_" +
getName();
58 auto get_all_tags = [&]() {
62 std::string tag_approximation_order_name =
"_App_Order_" +
getName();
63 rval =
moab.tag_get_handle(tag_approximation_order_name.c_str(), 1,
65 MB_TAG_CREAT | MB_TAG_SPARSE, &def_approx_order);
66 if (
rval == MB_ALREADY_ALLOCATED)
71 std::string tag_data_name = name_data_prefix +
getName();
72 const int def_len = 0;
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)
80 std::string tag_data_name_verts = name_data_prefix +
getName() +
"_V";
82 if (
rval == MB_SUCCESS)
90 def_vert_data.clear();
94 &*def_vert_data.begin());
95 if (
rval == MB_ALREADY_ALLOCATED)
103 auto get_all_tags_deprecated = [&]() {
107 std::string tag_approximation_order_name =
"_App_Order_" +
getName();
108 rval =
moab.tag_get_handle(tag_approximation_order_name.c_str(), 1,
110 MB_TAG_CREAT | MB_TAG_SPARSE, &def_approx_order);
111 if (
rval == MB_ALREADY_ALLOCATED)
116 std::string tag_data_name = name_data_prefix +
getName();
117 const int def_len = 0;
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)
125 std::string tag_data_name_verts = name_data_prefix +
getName() +
"V";
127 if (
rval == MB_SUCCESS)
135 def_vert_data.clear();
139 &*def_vert_data.begin());
140 if (
rval == MB_ALREADY_ALLOCATED)
153 ierr = get_all_tags();
154 CHKERRABORT(PETSC_COMM_SELF,
ierr);
156 ierr = get_all_tags_deprecated();
157 CHKERRABORT(PETSC_COMM_SELF,
ierr);
162 auto reset_entity_order_table = [&]() {
163 for (
int tt = 0; tt != MBMAXTYPE; ++tt)
167 auto set_continuous_entity_order_table = [&]() {
173 forderTable[MBVERTEX] = [](
int P) ->
int {
return (P > 0) ? 1 : 0; };
238 forderTable[MBVERTEX] = [](
int P) ->
int {
return (P > 0) ? 1 : 0; };
257 THROW_MESSAGE(
"unknown approximation space or not yet implemented");
263 forderTable[MBVERTEX] = [](
int P) ->
int {
return (P > 0) ? 1 : 0; };
326 THROW_MESSAGE(
"unknown approximation space or not yet implemented");
330 for (
int ee = 0; ee < MBMAXTYPE; ee++) {
341 for (EntityType
t = MBVERTEX;
t < MBMAXTYPE;
t++)
350 auto set_discontinuous_entity_order_table = [&]() {
407 THROW_MESSAGE(
"unknown approximation space or not implemented");
411 THROW_MESSAGE(
"unknown approximation space or not yet implemented");
468 THROW_MESSAGE(
"unknown approximation space or not yet implemented");
472 for (
int ee = 0; ee < MBMAXTYPE; ee++) {
483 for (EntityType
t = MBVERTEX;
t < MBMAXTYPE;
t++)
492 reset_entity_order_table();
495 set_continuous_entity_order_table();
498 set_discontinuous_entity_order_table();
502 set_continuous_entity_order_table();
504 <<
"unknown field continuity, set CONTINUOUS";
508 CHKERRABORT(PETSC_COMM_SELF,
ierr);
514 for (
auto t = MBVERTEX;
t != MBMAXTYPE; ++
t) {
517 int nb_last_order_dofs = 0;
518 const int rank = (*tagNbCoeffData);
524 const int diff_oo = nb_order_dofs - nb_last_order_dofs;
528 for (
int dd = 0; dd < diff_oo; ++dd)
529 for (
int rr = 0; rr != rank; ++rr, ++DD)
534 nb_last_order_dofs = nb_order_dofs;
549 os << e.
getNameRef() <<
" field_id " << e.
getId().to_ulong() <<
" space "
559 const boost::shared_ptr<FieldEntity> &ent_field_ptr,
560 const boost::shared_ptr<EntFiniteElement> &ent_fe_ptr)
561 : byWhat(0), entFieldPtr(ent_field_ptr), entFePtr(ent_fe_ptr) {}
567 << *e.
entFePtr->getFiniteElementPtr();
Vec t
Removal: the ring edge.
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
@ USER_BASE
user implemented approximation base
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
#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
@ NOFIELD
scalar or vector of scalars describe (no true field)
@ HCURL
field with continuous tangents
@ HDIV
field with continuous normal traction
@ 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 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
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
int ApproximationOrder
Approximation on the entity.
implementation of Data Operators for Forces and Sources
std::ostream & operator<<(std::ostream &os, const EntitiesFieldData::EntData &e)
static boost::function< int(int)> broken_nbvolumetet_edge_hdiv
static boost::function< int(int)> broken_nbvolumetet_face_hdiv
static boost::function< int(int)> broken_nbfacetri_face_hdiv
static boost::function< int(int)> broken_nbvolumetet_volume_hdiv
static boost::function< int(int)> broken_nbfacetri_edge_hdiv
FieldEntityEntFiniteElementAdjacencyMap of mofem finite element and entities.
const boost::shared_ptr< FieldEntity > entFieldPtr
field entity
unsigned int byWhat
see options ByWhat
FieldEntityEntFiniteElementAdjacencyMap(const boost::shared_ptr< FieldEntity > &ent_field_ptr, const boost::shared_ptr< EntFiniteElement > &ent_fe_ptr)
const boost::shared_ptr< EntFiniteElement > entFePtr
finite element entity
Field data structure for finite element approximation.
FieldCoefficientsNumber getNbOfCoeffs() const
Get number of field coefficients per DOF.
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.
auto getSpaceName() const
Get field approximation space name.
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.
auto getApproxBaseName() const
Get approximation basis name.
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.
static constexpr int maxBrokenDofsOrder
Maximum order for broken space DOFs.
Field(moab::Interface &moab, const EntityHandle meshset)
Constructor for MOAB field.
Tag th_FieldDataVerts
Tag for field values on vertices.
FieldApproximationBase * tagBaseData
Field basis functions.
auto getContinuityName() const
Get field continuity name.
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.
boost::string_ref getNameRef() const
Get field name as string reference.
const BitFieldId & getId() const
Get unique field identifier.
static MoFEMErrorCode getFileVersion(moab::Interface &moab, Version &version)
Get database major version.