37constexpr std::array<const DefaultElementAdjacency::DefEntTypeMap *, MBMAXTYPE>
42 std::vector<EntityHandle> &adjacency) {
46 adjacency.push_back(fe.
getEnt());
48 for (
auto ent : adjacency)
53 for (
auto ent : adjacency) {
55 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, -1, 0, 0)));
60 "this field is not implemented for VERTEX finite element");
69 std::vector<EntityHandle> &adjacency) {
71 EntityHandle fe_ent = fe.
getEnt();
75 CHKERR moab.get_connectivity(&fe_ent, 1, adjacency,
true);
78 adjacency.push_back(fe_ent);
80 for (
auto e : adjacency)
85 for (
auto e : adjacency) {
87 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(e, -1, 0, 0)));
92 "this field is not implemented for EDGE finite element");
101 std::vector<EntityHandle> &adjacency) {
104 const EntityHandle fe_ent = fe.
getEnt();
107 CHKERR moab.get_connectivity(&fe_ent, 1, adjacency,
true);
109 CHKERR moab.get_adjacencies(&fe_ent, 1, 1,
false, adjacency,
110 moab::Interface::UNION);
113 adjacency.push_back(fe_ent);
115 for (
auto ent : adjacency)
120 for (
auto ent : adjacency) {
122 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, -1, 0, 0)));
127 "this field is not implemented for TRI finite element");
135 std::vector<EntityHandle> &adjacency) {
137 EntityHandle fe_ent = fe.
getEnt();
140 CHKERR moab.get_connectivity(&fe_ent, 1, adjacency,
true);
142 CHKERR moab.get_adjacencies(&fe_ent, 1, 1,
false, adjacency,
143 moab::Interface::UNION);
145 CHKERR moab.get_adjacencies(&fe_ent, 1, 2,
false, adjacency,
146 moab::Interface::UNION);
148 adjacency.push_back(fe_ent);
150 for (
auto ent : adjacency)
155 for (
auto ent : adjacency) {
157 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, -1, 0, 0)));
162 "this field is not implemented for TRI finite element");
171 std::vector<EntityHandle> &adjacency) {
173 const EntityHandle prism = fe.
getEnt();
177 EntityHandle face_side3, face_side4;
178 CHKERR moab.side_element(prism, 2, 3, face_side3);
179 CHKERR moab.side_element(prism, 2, 4, face_side4);
182 for (
int qq = 0; qq < 3; qq++) {
183 EntityHandle quad = 0;
184 rval = moab.side_element(prism, 2, qq, quad);
185 if (
rval != MB_SUCCESS || quad == 0)
187 int side_number, sense, offset;
188 rval = moab.side_number(prism, quad, side_number, sense, offset);
189 if (side_number == -1 ||
rval != MB_SUCCESS)
192 .insert(boost::shared_ptr<SideNumber>(
193 new SideNumber(quad, side_number, sense, offset)));
196 for (; ee < 3; ee++) {
197 EntityHandle edge = 0;
198 CHKERR moab.side_element(prism, 1, ee, edge);
199 boost::shared_ptr<SideNumber> side_ptr =
201 if (side_ptr->side_number != ee) {
203 "data inconsistency for edge %d while in FE datastructure is "
205 ee, side_ptr->side_number);
207 CHKERR moab.side_element(prism, 1, 6 + ee, edge);
209 if (side_ptr->side_number != ee + 6) {
210 if (side_ptr->side_number != ee) {
212 "data inconsistency for edge %d while in FE datastructure "
214 ee, side_ptr->side_number);
216 side_ptr->brother_side_number = ee + 6;
220 for (; ee < 6; ee++) {
221 EntityHandle edge = 0;
222 rval = moab.side_element(prism, 1, ee, edge);
223 if (
rval != MB_SUCCESS || edge == 0)
225 int side_number, sense, offset;
226 rval = moab.side_number(prism, edge, side_number, sense, offset);
227 if (side_number == -1 ||
rval != MB_SUCCESS)
230 .insert(boost::shared_ptr<SideNumber>(
231 new SideNumber(edge, side_number, sense, offset)));
234 for (; nn < 3; nn++) {
236 CHKERR moab.side_element(prism, 0, nn, node);
237 boost::shared_ptr<SideNumber> side_ptr =
239 if (side_ptr->side_number != nn) {
241 "data inconsistency for node %d while in FE datastructure is "
243 nn, side_ptr->side_number);
245 CHKERR moab.side_element(prism, 0, nn + 3, node);
247 if (side_ptr->side_number != nn + 3) {
248 if (side_ptr->side_number != nn) {
250 "data inconsistency for node %d while in FE datastructure is "
252 nn, side_ptr->side_number);
254 side_ptr->brother_side_number = nn + 3;
265 CHKERR moab.get_adjacencies(&prism, 1, 0,
false, nodes,
266 moab::Interface::UNION);
269 CHKERR moab.get_connectivity(&prism, 1, topo_nodes,
true);
271 CHKERR moab.get_connectivity(&prism, 1, mid_nodes,
false);
272 mid_nodes = subtract(mid_nodes, topo_nodes);
273 nodes = subtract(nodes, mid_nodes);
275 adjacency.insert(adjacency.end(), nodes.begin(), nodes.end());
277 auto siit = side_table.get<0>().lower_bound(get_id_for_min_type<MBEDGE>());
279 side_table.get<0>().upper_bound(get_id_for_max_type<MBEDGE>());
280 for (; siit != hi_siit; siit++)
281 adjacency.push_back(siit->get()->ent);
284 auto siit = side_table.get<0>().lower_bound(get_id_for_min_type<MBTRI>());
286 side_table.get<0>().upper_bound(get_id_for_max_type<MBQUAD>());
287 for (; siit != hi_siit; siit++)
288 adjacency.push_back(siit->get()->ent);
291 adjacency.push_back(prism);
295 for (
auto ent : adjacency) {
297 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, -1, 0, 0)));
302 "this field is not implemented for TRI finite element");
309 std::vector<EntityHandle> &adjacency) {
311 EntityHandle fe_ent = fe.
getEnt();
315 CHKERR moab.get_entities_by_type(fe_ent, MBVERTEX, adjacency,
true);
317 CHKERR moab.get_entities_by_type(fe_ent, MBEDGE, adjacency,
true);
319 CHKERR moab.get_entities_by_dimension(fe_ent, 2, adjacency,
true);
321 CHKERR moab.get_entities_by_dimension(fe_ent, 3, adjacency,
true);
325 for (
auto ent : adjacency) {
327 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, -1, 0, 0)));
338 : meshset(_meshset) {
340 rval = moab.tag_get_handle(
"_FEId", th_FEId);
345 rval = moab.tag_get_handle(
"_FEName", th_FEName);
350 Tag th_FEIdCol, th_FEIdRow, th_FEIdData;
351 rval = moab.tag_get_handle(
"_FEIdCol", th_FEIdCol);
353 rval = moab.tag_get_by_ptr(th_FEIdCol, &
meshset, 1,
356 rval = moab.tag_get_handle(
"_FEIdRow", th_FEIdRow);
358 rval = moab.tag_get_by_ptr(th_FEIdRow, &
meshset, 1,
361 rval = moab.tag_get_handle(
"_FEIdData", th_FEIdData);
363 rval = moab.tag_get_by_ptr(th_FEIdData, &
meshset, 1,
380 os << e.
getNameRef() <<
" fe_id " << e.
getId().to_ulong() <<
" f_id_row "
387 boost::shared_ptr<FiniteElement> &fe) {
392 boost::shared_ptr<FiniteElement> &fe) {
397 boost::shared_ptr<FiniteElement> &fe) {
402 boost::shared_ptr<FiniteElement> &fe) {
407 boost::shared_ptr<FiniteElement> &fe) {
412 boost::shared_ptr<FiniteElement> &fe) {
417 boost::shared_ptr<FiniteElement> &fe) {
418 static_cast<BitFieldId *
>(fe->tag_BitFieldId_col_data)->reset();
422 boost::shared_ptr<FiniteElement> &fe) {
423 static_cast<BitFieldId *
>(fe->tag_BitFieldId_row_data)->reset();
427 boost::shared_ptr<FiniteElement> &fe) {
428 static_cast<BitFieldId *
>(fe->tag_BitFieldId_data)->reset();
433 const boost::shared_ptr<RefElement> &ref_finite_element,
434 const boost::shared_ptr<FiniteElement> &fe_ptr)
449 std::vector<EntityHandle> &adjacency) {
456 moab, *field_ptr, *this_fe_ptr, adjacency);
464 const boost::shared_ptr<EntFiniteElement> &sptr)
467boost::weak_ptr<FENumeredDofEntity>
469 auto comp = [idx](
const auto &
a) {
return a->getPetscGlobalDofIdx() == idx; };
472 if (
auto e = it.lock()) {
473 if (
auto cache = e->entityCacheColDofs.lock()) {
474 auto dit = std::find_if(
cache->loHi[0],
cache->loHi[1], comp);
475 if (dit !=
cache->loHi[1])
476 return boost::reinterpret_pointer_cast<FENumeredDofEntity>(*dit);
482 return boost::weak_ptr<FENumeredDofEntity>();
485boost::weak_ptr<FENumeredDofEntity>
488 auto comp = [idx](
const auto &
a) {
return a->getPetscGlobalDofIdx() == idx; };
491 if (
auto e = it.lock()) {
492 if (
auto cache = e->entityCacheColDofs.lock()) {
493 auto dit = std::find_if(
cache->loHi[0],
cache->loHi[1], comp);
494 if (dit !=
cache->loHi[1])
495 return boost::reinterpret_pointer_cast<FENumeredDofEntity>(*dit);
501 return boost::weak_ptr<FENumeredDofEntity>();
509template <
typename ENTSVIEW,
typename DOFSVIEW,
typename EXTRACTOR,
513 EXTRACTOR &&extractor, INSERTER &&inserter) {
516 auto hint = dofs_view->end();
517 using ValType =
typename std::remove_reference<
decltype(**hint)>
::type;
519 for (
auto &it : *ents_view) {
520 if (
auto e = it.lock()) {
522 if (
auto cache = extractor(e).lock())
523 for (
auto dit =
cache->loHi[0]; dit !=
cache->loHi[1]; ++dit)
524 hint = inserter(dofs_view, hint,
525 boost::reinterpret_pointer_cast<ValType>(*dit));
534boost::shared_ptr<FEDofEntity_multiIndex>
538 boost::weak_ptr<EntityCacheDofs>
539 operator()(boost::shared_ptr<FieldEntity> &e) {
540 return e->entityCacheDataDofs;
545 FEDofEntity_multiIndex::iterator
546 operator()(boost::shared_ptr<FEDofEntity_multiIndex> &dofs_view,
547 FEDofEntity_multiIndex::iterator &hint,
548 boost::shared_ptr<FEDofEntity> &&dof) {
549 return dofs_view->emplace_hint(hint, dof);
553 auto data_dofs = boost::make_shared<FEDofEntity_multiIndex>();
560boost::shared_ptr<std::vector<boost::shared_ptr<FEDofEntity>>>
565 boost::weak_ptr<EntityCacheDofs>
566 operator()(boost::shared_ptr<FieldEntity> &e) {
567 return e->entityCacheDataDofs;
572 using Vec = std::vector<boost::shared_ptr<FEDofEntity>>;
573 using It = Vec::iterator;
574 It operator()(boost::shared_ptr<Vec> &dofs_view, It &hint,
575 boost::shared_ptr<FEDofEntity> &&dof) {
576 dofs_view->emplace_back(dof);
577 return dofs_view->end();
581 auto data_vector_dofs =
582 boost::make_shared<std::vector<boost::shared_ptr<FEDofEntity>>>();
587 return data_vector_dofs;
590boost::shared_ptr<FENumeredDofEntity_multiIndex>
595 boost::weak_ptr<EntityCacheNumeredDofs>
596 operator()(boost::shared_ptr<FieldEntity> &e) {
597 return e->entityCacheRowDofs;
603 using It = Idx::iterator;
604 It operator()(boost::shared_ptr<Idx> &dofs_view, It &hint,
605 boost::shared_ptr<FENumeredDofEntity> &&dof) {
606 return dofs_view->emplace_hint(hint, dof);
610 auto row_dofs = boost::make_shared<FENumeredDofEntity_multiIndex>();
618boost::shared_ptr<FENumeredDofEntity_multiIndex>
623 boost::weak_ptr<EntityCacheNumeredDofs>
624 operator()(boost::shared_ptr<FieldEntity> &e) {
625 return e->entityCacheColDofs;
631 using It = Idx::iterator;
632 It operator()(boost::shared_ptr<Idx> &dofs_view, It &hint,
633 boost::shared_ptr<FENumeredDofEntity> &&dof) {
634 return dofs_view->emplace_hint(hint, dof);
638 auto col_dofs = boost::make_shared<FENumeredDofEntity_multiIndex>();
#define MOAB_THROW(err)
Check error code of MoAB function and throw MoFEM exception.
#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 ...
@ 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.
const FTensor::Tensor2< T, Dim, Dim > Vec
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)
DeprecatedCoreInterface Interface
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
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
Get entity type.
EntityHandle getEnt() const
Get the entity handle.