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 data structure 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 data structure "
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);
312 for (
auto ent : adjacency) {
314 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, -1, 0, 0)));
325 : meshset(_meshset) {
329 moab.tag_get_by_ptr(th_FEId, &
meshset, 1, (
const void **)&
tagId),
332 CHK_MOAB_THROW(moab.tag_get_handle(
"_FEName", th_FEName),
"get tag");
336 Tag th_FEIdCol, th_FEIdRow, th_FEIdData;
337 CHK_MOAB_THROW(moab.tag_get_handle(
"_FEIdCol", th_FEIdCol),
"get_tag");
341 CHK_MOAB_THROW(moab.tag_get_handle(
"_FEIdRow", th_FEIdRow),
"get tag");
345 CHK_MOAB_THROW(moab.tag_get_handle(
"_FEIdData", th_FEIdData),
"get tag");
363 os << e.
getNameRef() <<
" fe_id " << e.
getId().to_ulong() <<
" f_id_row "
370 boost::shared_ptr<FiniteElement> &fe) {
375 boost::shared_ptr<FiniteElement> &fe) {
380 boost::shared_ptr<FiniteElement> &fe) {
385 boost::shared_ptr<FiniteElement> &fe) {
390 boost::shared_ptr<FiniteElement> &fe) {
395 boost::shared_ptr<FiniteElement> &fe) {
400 boost::shared_ptr<FiniteElement> &fe) {
401 static_cast<BitFieldId *
>(fe->tag_BitFieldId_col_data)->reset();
405 boost::shared_ptr<FiniteElement> &fe) {
406 static_cast<BitFieldId *
>(fe->tag_BitFieldId_row_data)->reset();
410 boost::shared_ptr<FiniteElement> &fe) {
411 static_cast<BitFieldId *
>(fe->tag_BitFieldId_data)->reset();
416 const boost::shared_ptr<RefElement> &ref_finite_element,
417 const boost::shared_ptr<FiniteElement> &fe_ptr)
432 std::vector<EntityHandle> &adjacency) {
439 moab, *field_ptr, *this_fe_ptr, adjacency);
447 const boost::shared_ptr<EntFiniteElement> &sptr)
450boost::weak_ptr<FENumeredDofEntity>
452 auto comp = [idx](
const auto &
a) {
return a->getPetscGlobalDofIdx() == idx; };
455 if (
auto e = it.lock()) {
456 if (
auto cache = e->entityCacheColDofs.lock()) {
457 auto dit = std::find_if(cache->loHi[0], cache->loHi[1], comp);
458 if (dit != cache->loHi[1])
459 return boost::reinterpret_pointer_cast<FENumeredDofEntity>(*dit);
465 return boost::weak_ptr<FENumeredDofEntity>();
468boost::weak_ptr<FENumeredDofEntity>
471 auto comp = [idx](
const auto &
a) {
return a->getPetscGlobalDofIdx() == idx; };
474 if (
auto e = it.lock()) {
475 if (
auto cache = e->entityCacheColDofs.lock()) {
476 auto dit = std::find_if(cache->loHi[0], cache->loHi[1], comp);
477 if (dit != cache->loHi[1])
478 return boost::reinterpret_pointer_cast<FENumeredDofEntity>(*dit);
484 return boost::weak_ptr<FENumeredDofEntity>();
492template <
typename ENTSVIEW,
typename DOFSVIEW,
typename EXTRACTOR,
496 EXTRACTOR &&extractor, INSERTER &&inserter) {
499 auto hint = dofs_view->end();
500 using ValType =
typename std::remove_reference<
decltype(**hint)>::type;
502 for (
auto &it : *ents_view) {
503 if (
auto e = it.lock()) {
505 if (
auto cache = extractor(e).lock())
506 for (
auto dit = cache->loHi[0]; dit != cache->loHi[1]; ++dit)
507 hint = inserter(dofs_view, hint,
508 boost::reinterpret_pointer_cast<ValType>(*dit));
517boost::shared_ptr<FEDofEntity_multiIndex>
521 boost::weak_ptr<EntityCacheDofs>
522 operator()(boost::shared_ptr<FieldEntity> &e) {
523 return e->entityCacheDataDofs;
528 FEDofEntity_multiIndex::iterator
529 operator()(boost::shared_ptr<FEDofEntity_multiIndex> &dofs_view,
530 FEDofEntity_multiIndex::iterator &hint,
531 boost::shared_ptr<FEDofEntity> &&dof) {
532 return dofs_view->emplace_hint(hint, dof);
536 auto data_dofs = boost::make_shared<FEDofEntity_multiIndex>();
543boost::shared_ptr<std::vector<boost::shared_ptr<FEDofEntity>>>
548 boost::weak_ptr<EntityCacheDofs>
549 operator()(boost::shared_ptr<FieldEntity> &e) {
550 return e->entityCacheDataDofs;
555 using Vec = std::vector<boost::shared_ptr<FEDofEntity>>;
556 using It = Vec::iterator;
557 It operator()(boost::shared_ptr<Vec> &dofs_view, It &hint,
558 boost::shared_ptr<FEDofEntity> &&dof) {
559 dofs_view->emplace_back(dof);
560 return dofs_view->end();
564 auto data_vector_dofs =
565 boost::make_shared<std::vector<boost::shared_ptr<FEDofEntity>>>();
570 return data_vector_dofs;
573boost::shared_ptr<FENumeredDofEntity_multiIndex>
578 boost::weak_ptr<EntityCacheNumeredDofs>
579 operator()(boost::shared_ptr<FieldEntity> &e) {
580 return e->entityCacheRowDofs;
586 using It = Idx::iterator;
587 It operator()(boost::shared_ptr<Idx> &dofs_view, It &hint,
588 boost::shared_ptr<FENumeredDofEntity> &&dof) {
589 return dofs_view->emplace_hint(hint, dof);
593 auto row_dofs = boost::make_shared<FENumeredDofEntity_multiIndex>();
601boost::shared_ptr<FENumeredDofEntity_multiIndex>
606 boost::weak_ptr<EntityCacheNumeredDofs>
607 operator()(boost::shared_ptr<FieldEntity> &e) {
608 return e->entityCacheColDofs;
614 using It = Idx::iterator;
615 It operator()(boost::shared_ptr<Idx> &dofs_view, It &hint,
616 boost::shared_ptr<FENumeredDofEntity> &&dof) {
617 return dofs_view->emplace_hint(hint, dof);
621 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