25constexpr std::array<const DefaultElementAdjacency::DefEntTypeMap *, MBMAXTYPE>
30 std::vector<EntityHandle> &adjacency) {
34 adjacency.push_back(fe.
getEnt());
36 for (
auto ent : adjacency)
41 for (
auto ent : adjacency) {
43 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, -1, 0, 0)));
48 "this field is not implemented for VERTEX finite element");
57 std::vector<EntityHandle> &adjacency) {
63 CHKERR moab.get_connectivity(&fe_ent, 1, adjacency,
true);
66 adjacency.push_back(fe_ent);
68 for (
auto e : adjacency)
73 for (
auto e : adjacency) {
75 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(e, -1, 0, 0)));
80 "this field is not implemented for EDGE finite element");
89 std::vector<EntityHandle> &adjacency) {
95 CHKERR moab.get_connectivity(&fe_ent, 1, adjacency,
true);
97 CHKERR moab.get_adjacencies(&fe_ent, 1, 1,
false, adjacency,
98 moab::Interface::UNION);
101 adjacency.push_back(fe_ent);
103 for (
auto ent : adjacency)
108 for (
auto ent : adjacency) {
110 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, -1, 0, 0)));
115 "this field is not implemented for TRI finite element");
123 std::vector<EntityHandle> &adjacency) {
128 CHKERR moab.get_connectivity(&fe_ent, 1, adjacency,
true);
130 CHKERR moab.get_adjacencies(&fe_ent, 1, 1,
false, adjacency,
131 moab::Interface::UNION);
133 CHKERR moab.get_adjacencies(&fe_ent, 1, 2,
false, adjacency,
134 moab::Interface::UNION);
136 adjacency.push_back(fe_ent);
138 for (
auto ent : adjacency)
143 for (
auto ent : adjacency) {
145 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, -1, 0, 0)));
150 "this field is not implemented for TRI finite element");
159 std::vector<EntityHandle> &adjacency) {
166 CHKERR moab.side_element(prism, 2, 3, face_side3);
167 CHKERR moab.side_element(prism, 2, 4, face_side4);
170 for (
int qq = 0; qq < 3; qq++) {
172 rval = moab.side_element(prism, 2, qq, quad);
173 if (
rval != MB_SUCCESS || quad == 0)
175 int side_number, sense, offset;
176 rval = moab.side_number(prism, quad, side_number, sense, offset);
177 if (side_number == -1 ||
rval != MB_SUCCESS)
180 .insert(boost::shared_ptr<SideNumber>(
181 new SideNumber(quad, side_number, sense, offset)));
184 for (; ee < 3; ee++) {
186 CHKERR moab.side_element(prism, 1, ee, edge);
187 boost::shared_ptr<SideNumber> side_ptr =
189 if (side_ptr->side_number != ee) {
191 "data inconsistency for edge %d while in FE datastructure is "
193 ee, side_ptr->side_number);
195 CHKERR moab.side_element(prism, 1, 6 + ee, edge);
197 if (side_ptr->side_number != ee + 6) {
198 if (side_ptr->side_number != ee) {
200 "data inconsistency for edge %d while in FE datastructure "
202 ee, side_ptr->side_number);
204 side_ptr->brother_side_number = ee + 6;
208 for (; ee < 6; ee++) {
210 rval = moab.side_element(prism, 1, ee, edge);
211 if (
rval != MB_SUCCESS || edge == 0)
213 int side_number, sense, offset;
214 rval = moab.side_number(prism, edge, side_number, sense, offset);
215 if (side_number == -1 ||
rval != MB_SUCCESS)
218 .insert(boost::shared_ptr<SideNumber>(
219 new SideNumber(edge, side_number, sense, offset)));
222 for (; nn < 3; nn++) {
224 CHKERR moab.side_element(prism, 0, nn, node);
225 boost::shared_ptr<SideNumber> side_ptr =
227 if (side_ptr->side_number != nn) {
229 "data inconsistency for node %d while in FE datastructure is "
231 nn, side_ptr->side_number);
233 CHKERR moab.side_element(prism, 0, nn + 3, node);
235 if (side_ptr->side_number != nn + 3) {
236 if (side_ptr->side_number != nn) {
238 "data inconsistency for node %d while in FE datastructure is "
240 nn, side_ptr->side_number);
242 side_ptr->brother_side_number = nn + 3;
253 CHKERR moab.get_adjacencies(&prism, 1, 0,
false, nodes,
254 moab::Interface::UNION);
257 CHKERR moab.get_connectivity(&prism, 1, topo_nodes,
true);
259 CHKERR moab.get_connectivity(&prism, 1, mid_nodes,
false);
260 mid_nodes = subtract(mid_nodes, topo_nodes);
261 nodes = subtract(nodes, mid_nodes);
263 adjacency.insert(adjacency.end(), nodes.begin(), nodes.end());
265 auto siit = side_table.get<0>().lower_bound(get_id_for_min_type<MBEDGE>());
267 side_table.get<0>().upper_bound(get_id_for_max_type<MBEDGE>());
268 for (; siit != hi_siit; siit++)
269 adjacency.push_back(siit->get()->ent);
272 auto siit = side_table.get<0>().lower_bound(get_id_for_min_type<MBTRI>());
274 side_table.get<0>().upper_bound(get_id_for_max_type<MBQUAD>());
275 for (; siit != hi_siit; siit++)
276 adjacency.push_back(siit->get()->ent);
279 adjacency.push_back(prism);
283 for (
auto ent : adjacency) {
285 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, -1, 0, 0)));
290 "this field is not implemented for TRI finite element");
297 std::vector<EntityHandle> &adjacency) {
303 CHKERR moab.get_entities_by_type(fe_ent, MBVERTEX, adjacency,
true);
305 CHKERR moab.get_entities_by_type(fe_ent, MBEDGE, adjacency,
true);
307 CHKERR moab.get_entities_by_dimension(fe_ent, 2, adjacency,
true);
309 CHKERR moab.get_entities_by_dimension(fe_ent, 3, adjacency,
true);
313 for (
auto ent : adjacency) {
315 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, -1, 0, 0)));
326 : meshset(_meshset) {
330 moab.tag_get_by_ptr(th_FEId, &
meshset, 1, (
const void **)&
tagId),
333 CHK_MOAB_THROW(moab.tag_get_handle(
"_FEName", th_FEName),
"get tag");
337 Tag th_FEIdCol, th_FEIdRow, th_FEIdData;
338 CHK_MOAB_THROW(moab.tag_get_handle(
"_FEIdCol", th_FEIdCol),
"get_tag");
342 CHK_MOAB_THROW(moab.tag_get_handle(
"_FEIdRow", th_FEIdRow),
"get tag");
346 CHK_MOAB_THROW(moab.tag_get_handle(
"_FEIdData", th_FEIdData),
"get tag");
364 os << e.
getNameRef() <<
" fe_id " << e.
getId().to_ulong() <<
" f_id_row "
371 boost::shared_ptr<FiniteElement> &fe) {
376 boost::shared_ptr<FiniteElement> &fe) {
381 boost::shared_ptr<FiniteElement> &fe) {
386 boost::shared_ptr<FiniteElement> &fe) {
391 boost::shared_ptr<FiniteElement> &fe) {
396 boost::shared_ptr<FiniteElement> &fe) {
401 boost::shared_ptr<FiniteElement> &fe) {
402 static_cast<BitFieldId *
>(fe->tag_BitFieldId_col_data)->reset();
406 boost::shared_ptr<FiniteElement> &fe) {
407 static_cast<BitFieldId *
>(fe->tag_BitFieldId_row_data)->reset();
411 boost::shared_ptr<FiniteElement> &fe) {
412 static_cast<BitFieldId *
>(fe->tag_BitFieldId_data)->reset();
417 const boost::shared_ptr<RefElement> &ref_finite_element,
418 const boost::shared_ptr<FiniteElement> &fe_ptr)
433 std::vector<EntityHandle> &adjacency) {
440 moab, *field_ptr, *this_fe_ptr, adjacency);
448 const boost::shared_ptr<EntFiniteElement> &sptr)
451boost::weak_ptr<FENumeredDofEntity>
453 auto comp = [idx](
const auto &
a) {
return a->getPetscGlobalDofIdx() == idx; };
456 if (
auto e = it.lock()) {
457 if (
auto cache = e->entityCacheColDofs.lock()) {
458 auto dit = std::find_if(
cache->loHi[0],
cache->loHi[1], comp);
459 if (dit !=
cache->loHi[1])
460 return boost::reinterpret_pointer_cast<FENumeredDofEntity>(*dit);
466 return boost::weak_ptr<FENumeredDofEntity>();
469boost::weak_ptr<FENumeredDofEntity>
472 auto comp = [idx](
const auto &
a) {
return a->getPetscGlobalDofIdx() == idx; };
475 if (
auto e = it.lock()) {
476 if (
auto cache = e->entityCacheColDofs.lock()) {
477 auto dit = std::find_if(
cache->loHi[0],
cache->loHi[1], comp);
478 if (dit !=
cache->loHi[1])
479 return boost::reinterpret_pointer_cast<FENumeredDofEntity>(*dit);
485 return boost::weak_ptr<FENumeredDofEntity>();
493template <
typename ENTSVIEW,
typename DOFSVIEW,
typename EXTRACTOR,
497 EXTRACTOR &&extractor, INSERTER &&inserter) {
500 auto hint = dofs_view->end();
501 using ValType =
typename std::remove_reference<
decltype(**hint)>::type;
503 for (
auto &it : *ents_view) {
504 if (
auto e = it.lock()) {
506 if (
auto cache = extractor(e).lock())
507 for (
auto dit =
cache->loHi[0]; dit !=
cache->loHi[1]; ++dit)
508 hint = inserter(dofs_view, hint,
509 boost::reinterpret_pointer_cast<ValType>(*dit));
518boost::shared_ptr<FEDofEntity_multiIndex>
522 boost::weak_ptr<EntityCacheDofs>
523 operator()(boost::shared_ptr<FieldEntity> &e) {
524 return e->entityCacheDataDofs;
529 FEDofEntity_multiIndex::iterator
530 operator()(boost::shared_ptr<FEDofEntity_multiIndex> &dofs_view,
531 FEDofEntity_multiIndex::iterator &hint,
532 boost::shared_ptr<FEDofEntity> &&dof) {
533 return dofs_view->emplace_hint(hint, dof);
537 auto data_dofs = boost::make_shared<FEDofEntity_multiIndex>();
544boost::shared_ptr<std::vector<boost::shared_ptr<FEDofEntity>>>
549 boost::weak_ptr<EntityCacheDofs>
550 operator()(boost::shared_ptr<FieldEntity> &e) {
551 return e->entityCacheDataDofs;
556 using Vec = std::vector<boost::shared_ptr<FEDofEntity>>;
557 using It = Vec::iterator;
558 It operator()(boost::shared_ptr<Vec> &dofs_view, It &hint,
559 boost::shared_ptr<FEDofEntity> &&dof) {
560 dofs_view->emplace_back(dof);
561 return dofs_view->end();
565 auto data_vector_dofs =
566 boost::make_shared<std::vector<boost::shared_ptr<FEDofEntity>>>();
571 return data_vector_dofs;
574boost::shared_ptr<FENumeredDofEntity_multiIndex>
579 boost::weak_ptr<EntityCacheNumeredDofs>
580 operator()(boost::shared_ptr<FieldEntity> &e) {
581 return e->entityCacheRowDofs;
587 using It = Idx::iterator;
588 It operator()(boost::shared_ptr<Idx> &dofs_view, It &hint,
589 boost::shared_ptr<FENumeredDofEntity> &&dof) {
590 return dofs_view->emplace_hint(hint, dof);
594 auto row_dofs = boost::make_shared<FENumeredDofEntity_multiIndex>();
602boost::shared_ptr<FENumeredDofEntity_multiIndex>
607 boost::weak_ptr<EntityCacheNumeredDofs>
608 operator()(boost::shared_ptr<FieldEntity> &e) {
609 return e->entityCacheColDofs;
615 using It = Idx::iterator;
616 It operator()(boost::shared_ptr<Idx> &dofs_view, It &hint,
617 boost::shared_ptr<FENumeredDofEntity> &&dof) {
618 return dofs_view->emplace_hint(hint, dof);
622 auto col_dofs = boost::make_shared<FENumeredDofEntity_multiIndex>();
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ 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
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
multi_index_container< boost::shared_ptr< FENumeredDofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< FENumeredDofEntity::interface_type_DofEntity, UId, &FENumeredDofEntity::getLocalUniqueId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FENumeredDofEntity::interface_type_DofEntity, EntityHandle, &FENumeredDofEntity::getEnt > > > > FENumeredDofEntity_multiIndex
MultiIndex container keeps FENumeredDofEntity.
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< ordered_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, signed char, &SideNumber::side_number > > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
implementation of Data Operators for Forces and Sources
std::ostream & operator<<(std::ostream &os, const EntitiesFieldData::EntData &e)
std::vector< boost::weak_ptr< FieldEntity > > FieldEntity_vector_view
static MoFEMErrorCode get_cache_data_dofs_view(ENTSVIEW &ents_view, DOFSVIEW &dofs_view, EXTRACTOR &&extractor, INSERTER &&inserter)
static constexpr DefEntTypeMap defVertexTypeMap
static constexpr DefEntTypeMap defEdgeTypeMap
std::array< bool, MBMAXTYPE > DefEntTypeMap
static constexpr DefEntTypeMap defQuadTypeMap
static constexpr DefEntTypeMap defTriTypeMap
static MoFEMErrorCode defaultMeshset(Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
static MoFEMErrorCode defaultVertex(Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
static MoFEMErrorCode defaultVolume(Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
static constexpr std::array< const DefEntTypeMap *, MBMAXTYPE > defTypeMap
static constexpr DefEntTypeMap defTetTypeMap
static constexpr DefEntTypeMap defHexTypeMap
static constexpr DefEntTypeMap defMeshsetTypeMap
static MoFEMErrorCode defaultEdge(Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
static MoFEMErrorCode defaultPrism(Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
static MoFEMErrorCode defaultFace(Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
static constexpr DefEntTypeMap defPrismTypeMap
Finite element data for entity.
EntFiniteElement(const boost::shared_ptr< RefElement > &ref_finite_element, const boost::shared_ptr< FiniteElement > &fe_ptr)
boost::shared_ptr< std::vector< boost::shared_ptr< FEDofEntity > > > getDataVectorDofsPtr() const
Get data data dos multi-index structure.
boost::shared_ptr< FieldEntity_vector_view > dataFieldEnts
boost::shared_ptr< FEDofEntity_multiIndex > getDataDofsPtr() const
Get the Data Dofs Ptr object.
MoFEMErrorCode getElementAdjacency(const boost::shared_ptr< Field > field_ptr, std::vector< EntityHandle > &adjacency)
Provide data structure for (tensor) field approximation.
EntityHandle getMeshset() const
Get field meshset.
FieldSpace getSpace() const
Get field approximation space.
void operator()(boost::shared_ptr< FiniteElement > &fe)
void operator()(boost::shared_ptr< FiniteElement > &fe)
void operator()(boost::shared_ptr< FiniteElement > &fe)
void operator()(boost::shared_ptr< FiniteElement > &fe)
void operator()(boost::shared_ptr< FiniteElement > &fe)
void operator()(boost::shared_ptr< FiniteElement > &fe)
void operator()(boost::shared_ptr< FiniteElement > &fe)
void operator()(boost::shared_ptr< FiniteElement > &fe)
void operator()(boost::shared_ptr< FiniteElement > &fe)
Finite element definition.
BitFieldId * tag_BitFieldId_col_data
tag stores col id_id for fields
void * tagName
ptr to tag storing FE name
unsigned int getBitNumber() const
Get bit identifying this element.
BitFieldId * tag_BitFieldId_data
tag stores data id_id for fields
BitFEId * tagId
ptr to tag storing FE id
BitFieldId getBitFieldIdRow() const
Get field ids on rows.
BitFEId getId() const
Get finite element id.
FiniteElement(Interface &moab, const EntityHandle _meshset)
BitFieldId * tag_BitFieldId_row_data
tag stores row id_id for fields
static constexpr int ent_shift
boost::string_ref getNameRef() const
Get finite element name.
BitFieldId getBitFieldIdData() const
Get field ids on data.
BitFieldId getBitFieldIdCol() const
Get field ids on columns.
int tagNameSize
numer of characters in FE name
EntityHandle meshset
meshset stores FE ents
std::array< ElementAdjacencyFunct, MBMAXTYPE > elementAdjacencyTable
Table of functions retrieving adjacencies for finite element User can alter and change default behavi...
Partitioned (Indexed) Finite Element in Problem.
boost::weak_ptr< FENumeredDofEntity > getRowDofsByPetscGlobalDofIdx(const int idx) const
get FE dof by petsc index
boost::weak_ptr< FENumeredDofEntity > getColDofsByPetscGlobalDofIdx(const int idx) const
get FE dof by petsc index
NumeredEntFiniteElement(const boost::shared_ptr< EntFiniteElement > &sptr)
boost::shared_ptr< EntFiniteElement > & getEntFiniteElement() const
boost::shared_ptr< FENumeredDofEntity_multiIndex > getRowDofsPtr() const
get FE dof on row
boost::shared_ptr< FENumeredDofEntity_multiIndex > getColDofsPtr() const
get FE dof on column
unsigned int part
Partition number.
keeps data about abstract refined finite element
keeps information about side number for the finite element
interface to EntFiniteElement
boost::shared_ptr< FieldEntity_vector_view > & getColFieldEntsPtr() const
FieldEntity_vector_view & getColFieldEnts() const
FieldEntity_vector_view & getRowFieldEnts() const
boost::shared_ptr< FieldEntity_vector_view > & getRowFieldEntsPtr() const
const boost::shared_ptr< RefElement > & getRefElement() const
boost::shared_ptr< FE > & getFiniteElementPtr() const
const boost::shared_ptr< SideNumber > & getSideNumberPtr(const EntityHandle ent) const
boost::shared_ptr< RefEntity > & getRefEntityPtr() const
SideNumber_multiIndex & getSideNumberTable() const
boost::shared_ptr< T > & getRefElement() const
boost::shared_ptr< T > sPtr
EntityType getEntType() const
EntityHandle getEnt() const