v0.14.0
Loading...
Searching...
No Matches
FEMultiIndices.hpp
Go to the documentation of this file.
1/** \file FEMultiIndices.hpp
2 * \brief Multi-index contains, data structures for mofem finite elements and
3 * other low-level functions
4 *
5 * \todo Add proc into feUId to reduce number of keys is multi-index
6 */
7
8#ifndef __FEMMULTIINDICES_HPP__
9#define __FEMMULTIINDICES_HPP__
10
11namespace MoFEM {
12
13struct EntFiniteElement;
14
15/** \brief user adjacency function
16 * \ingroup fe_multi_indices
17 */
18using ElementAdjacencyFunct = boost::function<MoFEMErrorCode(
19 Interface &moab, const Field &field, const EntFiniteElement &fe,
20 std::vector<EntityHandle> &adjacency)>;
21
22/**
23 * \brief Finite element definition
24 * \ingroup fe_multi_indices
25 */
27
28 EntityHandle meshset; ///< meshset stores FE ents
29 BitFEId *tagId; ///< ptr to tag storing FE id
30 void *tagName; ///< ptr to tag storing FE name
31 int tagNameSize; ///< numer of characters in FE name
32 BitFieldId *tag_BitFieldId_col_data; ///< tag stores col id_id for fields
33 BitFieldId *tag_BitFieldId_row_data; ///< tag stores row id_id for fields
34 BitFieldId *tag_BitFieldId_data; ///< tag stores data id_id for fields
36
37 FiniteElement(Interface &moab, const EntityHandle _meshset);
38
39 /**
40 * @brief Get finite element uid
41 *
42 * @return const UId&
43 */
44 inline const UId &getFEUId() const { return feUId; }
45
46 /**
47 * \brief Get finite element id
48 * @return Finite element Id
49 */
50 inline BitFEId getId() const { return *tagId; }
51
52 /**
53 * \brief Get meshset containing element entities
54 * @return Meshset
55 */
56 inline EntityHandle getMeshset() const { return meshset; }
57
58 /**
59 * \brief Get finite element name
60 * @return string_ref
61 */
62 inline boost::string_ref getNameRef() const {
63 return boost::string_ref((char *)tagName, tagNameSize);
64 }
65
66 /**
67 * \brief Get finite element name
68 * @return string
69 */
70 inline std::string getName() const {
71 return std::string((char *)tagName, tagNameSize);
72 }
73
74 /**
75 * \brief Get field ids on columns
76 * @return Bit field ids
77 */
80 }
81
82 /**
83 * \brief Get field ids on rows
84 * @return Bit field ids
85 */
88 }
89
90 /**
91 * \brief Get field ids on data
92 * @return Bit field ids
93 */
96 }
97
98 /**
99 * \brief Get bit identifying this element
100 *
101 * Each element like field is identified by bit set. Each element has unique
102 * bit set, this function returns number of that bit.
103 *
104 * @return Bit number
105 */
106 inline unsigned int getBitNumber() const {
107 return ffsl(((BitFieldId *)tagId)->to_ulong());
108 }
109
110 /**
111 * \brief Table of functions retrieving adjacencies for finite element
112 * User can alter and change default behavior
113 */
114 std::array<ElementAdjacencyFunct, MBMAXTYPE> elementAdjacencyTable;
115
116 /**
117 * \brief print finite element
118 */
119 friend std::ostream &operator<<(std::ostream &os, const FiniteElement &e);
120
121private:
122 static constexpr int ent_shift = 64; // EntityHandle size
123};
124
125/** \brief default adjacency map
126 * \ingroup fe_multi_indices
127 */
129
130 static MoFEMErrorCode defaultVertex(Interface &moab, const Field &field,
131 const EntFiniteElement &fe,
132 std::vector<EntityHandle> &adjacency);
133 static MoFEMErrorCode defaultEdge(Interface &moab, const Field &field,
134 const EntFiniteElement &fe,
135 std::vector<EntityHandle> &adjacency);
136 static MoFEMErrorCode defaultFace(Interface &moab, const Field &field,
137 const EntFiniteElement &fe,
138 std::vector<EntityHandle> &adjacency);
139 static MoFEMErrorCode defaultVolume(Interface &moab, const Field &field,
140 const EntFiniteElement &fe,
141 std::vector<EntityHandle> &adjacency);
142 static MoFEMErrorCode defaultPrism(Interface &moab, const Field &field,
143 const EntFiniteElement &fe,
144 std::vector<EntityHandle> &adjacency);
145 static MoFEMErrorCode defaultMeshset(Interface &moab, const Field &field,
146 const EntFiniteElement &fe,
147 std::vector<EntityHandle> &adjacency);
148
149 using DefEntTypeMap = std::array<bool, MBMAXTYPE>;
150
151 static constexpr DefEntTypeMap defVertexTypeMap = {
152 // clang-format off
153 true, // MBVERTEX
154 false, // MBEDGE
155 false, // MBTRI
156 false, // MBQUAD
157 false, // MBPOLYGON
158 false, // MBTET
159 false, // MBPYRAMID
160 false, // MBPRISM
161 false, // MBKNIFE
162 false, // MBHEX
163 false, // MBPOLYHEDRON
164 false // MBENTITYSET
165 // clang-format on
166 };
167
168 static constexpr DefEntTypeMap defEdgeTypeMap = {
169 // clang-format off
170 true, // MBVERTEX
171 true, // MBEDGE
172 false, // MBTRI
173 false, // MBQUAD
174 false, // MBPOLYGON
175 false, // MBTET
176 false, // MBPYRAMID
177 false, // MBPRISM
178 false, // MBKNIFE
179 false, // MBHEX
180 false, // MBPOLYHEDRON
181 false // MBENTITYSET
182 // clang-format on
183 };
184
185 static constexpr DefEntTypeMap defTriTypeMap = {
186 // clang-format off
187 true, // MBVERTEX
188 true, // MBEDGE
189 true, // MBTRI
190 false, // MBQUAD
191 false, // MBPOLYGON
192 false, // MBTET
193 false, // MBPYRAMID
194 false, // MBPRISM
195 false, // MBKNIFE
196 false, // MBHEX
197 false, // MBPOLYHEDRON
198 false // MBENTITYSET
199 // clang-format on
200 };
201
202 static constexpr DefEntTypeMap defQuadTypeMap = {
203 // clang-format off
204 true, // MBVERTEX
205 true, // MBEDGE
206 false, // MBTRI
207 true, // MBQUAD
208 false, // MBPOLYGON
209 false, // MBTET
210 false, // MBPYRAMID
211 false, // MBPRISM
212 false, // MBKNIFE
213 false, // MBHEX
214 false, // MBPOLYHEDRON
215 false // MBENTITYSET
216 // clang-format on
217 };
218
219 static constexpr DefEntTypeMap defTetTypeMap = {
220 // clang-format off
221 true, // MBVERTEX
222 true, // MBEDGE
223 true, // MBTRI
224 false, // MBQUAD
225 false, // MBPOLYGON
226 true, // MBTET
227 false, // MBPYRAMID
228 false, // MBPRISM
229 false, // MBKNIFE
230 false, // MBHEX
231 false, // MBPOLYHEDRON
232 false // MBENTITYSET
233 // clang-format on
234 };
235
236 static constexpr DefEntTypeMap defHexTypeMap = {
237 // clang-format off
238 true, // MBVERTEX
239 true, // MBEDGE
240 false, // MBTRI
241 true, // MBQUAD
242 false, // MBPOLYGON
243 false, // MBTET
244 false, // MBPYRAMID
245 false, // MBPRISM
246 false, // MBKNIFE
247 true, // MBHEX
248 false, // MBPOLYHEDRON
249 false // MBENTITYSET
250 // clang-format on
251 };
252
253 static constexpr DefEntTypeMap defPrismTypeMap = {
254 // clang-format off
255 true, // MBVERTEX
256 true, // MBEDGE
257 true, // MBTRI
258 true, // MBQUAD
259 false, // MBPOLYGON
260 false, // MBTET
261 false, // MBPYRAMID
262 true, // MBPRISM
263 false, // MBKNIFE
264 false, // MBHEX
265 false, // MBPOLYHEDRON
266 false // MBENTITYSET
267 // clang-format on
268 };
269
270 static constexpr DefEntTypeMap defMeshsetTypeMap = {
271 // clang-format off
272 true, // MBVERTEX
273 true, // MBEDGE
274 true, // MBTRI
275 true, // MBQUAD
276 true, // MBPOLYGON
277 true, // MBTET
278 true, // MBPYRAMID
279 true, // MBPRISM
280 true, // MBKNIFE
281 true, // MBHEX
282 true, // MBPOLYHEDRON
283 true // MBENTITYSET
284 // clang-format on
285 };
286
287 static constexpr std::array<const DefEntTypeMap *, MBMAXTYPE> defTypeMap = {
288 // clang-format off
289 &defVertexTypeMap, // MBVERTEX
290 &defEdgeTypeMap, // MBEDGE
291 &defTriTypeMap, // MBTRI
292 &defQuadTypeMap, // MBQUAD
293 nullptr, // MBPOLYGON
294 &defTetTypeMap, // MBTET
295 nullptr, // MBPYRAMID
296 &defPrismTypeMap, // MBPRISM
297 nullptr, // MBKNIFE
298 &defHexTypeMap, // MBHEX
299 nullptr, // MBPOLYHEDRON
300 &defMeshsetTypeMap // MBENTITYSET
301 // clang-format on
302 };
303
304 static inline bool getDefTypeMap(const EntityType fe_type,
305 const EntityType ent_type) {
306 if (auto ptr = defTypeMap[fe_type])
307 return (*ptr)[ent_type];
308 THROW_MESSAGE("DefTypeMap is not defined by this element. This is propably "
309 "new implementation, and has to be implemented");
310 return false;
311 }
312};
313
314/**
315 * \brief Inetface for FE
316 * \ingroup fe_multi_indices
317 */
318template <typename FE, typename REFENT>
320
321 interface_FiniteElementImpl(const boost::shared_ptr<FE> fe_ptr,
322 const boost::shared_ptr<REFENT> ref_ents_ptr)
323 : interface_RefElement<REFENT>(ref_ents_ptr){};
324 virtual ~interface_FiniteElementImpl() = default;
325};
326
327template <typename FE, typename REFENT>
329 interface_FiniteElement(const boost::shared_ptr<FE> fe_ptr,
330 const boost::shared_ptr<REFENT> ref_ents_ptr)
331 : interface_RefElement<REFENT>(ref_ents_ptr), sFiniteElementPtr(fe_ptr){};
332
333 virtual ~interface_FiniteElement() = default;
334
335 /**
336 * @copydoc MoFEM::FiniteElement::getFEUId
337 */
338 inline const UId &getFEUId() const {
339 return getFiniteElementPtr()->getFEUId();
340 }
341
342 /**
343 * @copydoc MoFEM::FiniteElement::getId
344 */
345 inline BitFEId getId() const { return getFiniteElementPtr()->getId(); }
346
347 /**
348 * @copydoc MoFEM::FiniteElement::getMeshset
349 */
350 inline EntityHandle getMeshset() const {
351 return getFiniteElementPtr()->getMeshset();
352 }
353
354 /**
355 * @copydoc MoFEM::FiniteElement::getNameRef
356 */
357 inline boost::string_ref getNameRef() const {
358 return getFiniteElementPtr()->getNameRef();
359 }
360
361 /**
362 * @copydoc MoFEM::FiniteElement::getName
363 */
364 inline std::string getName() const {
365 return getFiniteElementPtr()->getName();
366 }
367
368 /**
369 * @copydoc MoFEM::FiniteElement::getBitFieldIdCol
370 */
372 return getFiniteElementPtr()->getBitFieldIdCol();
373 }
374
375 /**
376 * @copydoc MoFEM::FiniteElement::getBitFieldIdRow
377 */
379 return getFiniteElementPtr()->getBitFieldIdRow();
380 }
381
382 /**
383 * @copydoc MoFEM::FiniteElement::getBitFieldIdData
384 */
386 return getFiniteElementPtr()->getBitFieldIdData();
387 }
388
389 /**
390 * @copydoc MoFEM::FiniteElement::getBitNumber
391 */
392 inline unsigned int getBitNumber() const {
393 return getFiniteElementPtr()->getBitNumber();
394 }
395
396 inline boost::shared_ptr<FE> &getFiniteElementPtr() const {
397 return sFiniteElementPtr;
398 }
399
400private:
401 mutable boost::shared_ptr<FE> sFiniteElementPtr;
402};
403
404template <typename T>
406 : public interface_FiniteElementImpl<T, T> {
407
408 interface_FiniteElement(const boost::shared_ptr<T> fe_ptr,
409 const boost::shared_ptr<T> ref_ents_ptr)
410 : interface_FiniteElementImpl<T, T>(fe_ptr, ref_ents_ptr) {}
411
412 /**
413 * @copydoc MoFEM::FiniteElement::getFEUId
414 */
415 inline const UId &getFEUId() const {
416 return getFiniteElementPtr()->getFEUId();
417 }
418
419 /**
420 * @copydoc MoFEM::FiniteElement::getId
421 */
422 inline BitFEId getId() const { return getFiniteElementPtr()->getId(); }
423
424 /**
425 * @copydoc MoFEM::FiniteElement::getMeshset
426 */
427 inline EntityHandle getMeshset() const {
428 return getFiniteElementPtr()->getMeshset();
429 }
430
431 /**
432 * @copydoc MoFEM::FiniteElement::getNameRef
433 */
434 inline boost::string_ref getNameRef() const {
435 return getFiniteElementPtr()->getNameRef();
436 }
437
438 /**
439 * @copydoc MoFEM::FiniteElement::getName
440 */
441 inline std::string getName() const {
442 return getFiniteElementPtr()->getName();
443 }
444
445 /**
446 * @copydoc MoFEM::FiniteElement::getBitFieldIdCol
447 */
449 return getFiniteElementPtr()->getBitFieldIdCol();
450 }
451
452 /**
453 * @copydoc MoFEM::FiniteElement::getBitFieldIdRow
454 */
456 return getFiniteElementPtr()->getBitFieldIdRow();
457 }
458
459 /**
460 * @copydoc MoFEM::FiniteElement::getBitFieldIdData
461 */
463 return getFiniteElementPtr()->getBitFieldIdData();
464 }
465
466 /**
467 * @copydoc MoFEM::FiniteElement::getBitNumber
468 */
469 inline unsigned int getBitNumber() const {
470 return getFiniteElementPtr()->getBitNumber();
471 }
472
473 inline boost::shared_ptr<FiniteElement> &getFiniteElementPtr() const {
474 return boost::static_pointer_cast<T>(this->getRefElement())
475 ->getFiniteElementPtr();
476 };
477};
478
480 std::array<DofEntity_multiIndex::iterator, 2> loHi;
481};
482
484 std::array<NumeredDofEntity_multiIndex::iterator, 2> loHi;
485};
486
487using CacheTuple = std::tuple<
488
489 std::vector<EntityCacheDofs>, std::vector<EntityCacheNumeredDofs>,
490 std::vector<EntityCacheNumeredDofs>
491
492 >;
493
494using CacheTupleWeakPtr = boost::weak_ptr<CacheTuple>;
495using CacheTupleSharedPtr = boost::shared_ptr<CacheTuple>;
496
497/**
498 * \brief Finite element data for entity
499 * \ingroup fe_multi_indices
500 */
502 : public interface_FiniteElement<FiniteElement, RefElement> {
503
508
509 EntFiniteElement(const boost::shared_ptr<RefElement> &ref_finite_element,
510 const boost::shared_ptr<FiniteElement> &fe_ptr);
511 virtual ~EntFiniteElement() = default;
512
513 /**
514 * \brief Get unique UId for finite element entity
515 * @return UId
516 */
517 inline UId getLocalUniqueId() const { return getLocalUniqueIdCalculate(); }
518
520 UId fe_uid) {
521 return fe_uid |= ent;
522 }
523
524 /**
525 * \brief Generate UId for finite element entity
526 * @return finite element entity unique Id
527 */
531
532 // TODO: [CORE-61] Get FEDofs by entity type
533
534 /**
535 * @brief Get the Data Dofs Ptr object
536 *
537 * @return boost::shared_ptr<FEDofEntity_multiIndex>
538 */
539 boost::shared_ptr<FEDofEntity_multiIndex> getDataDofsPtr() const;
540
541 /**
542 * \brief Get data data dos multi-index structure
543 * @return Reference multi-index FEDofEntity_multiIndex
544 */
545 boost::shared_ptr<std::vector<boost::shared_ptr<FEDofEntity>>>
546 getDataVectorDofsPtr() const;
547
549 return *getDataFieldEntsPtr();
550 };
551
552 inline boost::shared_ptr<FieldEntity_vector_view> &
557
559 return *getRowFieldEntsPtr();
560 };
561
562 inline boost::shared_ptr<FieldEntity_vector_view> &
567
569 return *getColFieldEntsPtr();
570 };
571
572 inline boost::shared_ptr<FieldEntity_vector_view> &
577
578 friend std::ostream &operator<<(std::ostream &os, const EntFiniteElement &e);
579
580 template <typename FE_ENTS, typename MOFEM_DOFS, typename MOFEM_DOFS_VIEW,
581 typename INSERTER>
582 static MoFEMErrorCode
583 getDofView(const FE_ENTS &fe_ents_view, const MOFEM_DOFS &mofem_dofs,
584 MOFEM_DOFS_VIEW &dofs_view, INSERTER &&inserter) {
586
587 auto hint = dofs_view.end();
588 using ValType = typename std::remove_reference<decltype(**hint)>::type;
589
590 for (auto &it : fe_ents_view) {
591 if (auto e = it.lock()) {
592 const auto &uid = e->getLocalUniqueId();
593 auto dit = mofem_dofs.lower_bound(uid);
594 if (dit != mofem_dofs.end()) {
595 const auto hi_dit = mofem_dofs.upper_bound(
596 uid | static_cast<UId>(MAX_DOFS_ON_ENTITY - 1));
597 for (; dit != hi_dit; ++dit)
598 hint = inserter(dofs_view, hint,
599 boost::reinterpret_pointer_cast<ValType>(*dit));
600 }
601 }
602 }
604 }
605
606 template <typename MOFEM_DOFS, typename MOFEM_DOFS_VIEW>
607 inline MoFEMErrorCode getRowDofView(const MOFEM_DOFS &mofem_dofs,
608 MOFEM_DOFS_VIEW &dofs_view) {
609
610 auto hint = dofs_view.end();
611 using ValType = typename std::remove_reference<decltype(**hint)>::type;
612 using IndexType = MOFEM_DOFS_VIEW;
613
614 struct Inserter {
615 using Idx = IndexType;
616 using It = typename Idx::iterator;
617 It operator()(Idx &dofs_view, It &hint,
618 boost::shared_ptr<ValType> &&dof) {
619 return dofs_view.emplace_hint(hint, dof);
620 }
621 };
622
623 return getDofView(getRowFieldEnts(), mofem_dofs, dofs_view, Inserter());
624 }
625
626 template <typename MOFEM_DOFS, typename MOFEM_DOFS_VIEW>
627 inline MoFEMErrorCode
628 getColDofView(const MOFEM_DOFS &mofem_dofs, MOFEM_DOFS_VIEW &dofs_view,
629 const int operation_type = moab::Interface::UNION) {
630
631 auto hint = dofs_view.end();
632 using ValType = typename std::remove_reference<decltype(**hint)>::type;
633 using IndexType = MOFEM_DOFS_VIEW;
634
635 struct Inserter {
636 using Idx = IndexType;
637 using It = typename Idx::iterator;
638 It operator()(Idx &dofs_view, It &hint,
639 boost::shared_ptr<ValType> &&dof) {
640 return dofs_view.emplace_hint(hint, dof);
641 }
642 };
643
644 return getDofView(getColFieldEnts(), mofem_dofs, dofs_view, operation_type);
645 }
646
647 MoFEMErrorCode getElementAdjacency(const boost::shared_ptr<Field> field_ptr,
648 std::vector<EntityHandle> &adjacency);
649
650private:
651 mutable boost::shared_ptr<FieldEntity_vector_view> dataFieldEnts;
652 mutable boost::shared_ptr<FieldEntity_vector_view> rowFieldEnts;
653 mutable boost::shared_ptr<FieldEntity_vector_view> colFieldEnts;
654};
655
656/**
657 * \brief interface to EntFiniteElement
658 * \ingroup fe_multi_indices
659 */
660template <typename T>
662
663 interface_EntFiniteElement(const boost::shared_ptr<T> &sptr)
664 : interface_FiniteElement<T, T>(sptr, sptr) {}
665 virtual ~interface_EntFiniteElement() = default;
666
667 inline auto getDataDofsPtr() const { return this->sPtr->getDataDofsPtr(); }
668
669 inline auto getDataVectorDofsPtr() const {
670 return this->sPtr->getDataVectorDofsPtr();
671 };
672
674 return this->sPtr->getDataFieldEnts();
675 };
676
677 inline boost::shared_ptr<FieldEntity_vector_view> &getDataFieldEntsPtr() {
678 return this->sPtr->getDataFieldEntsPtr();
679 };
680
682 return this->sPtr->getRowFieldEnts();
683 };
684
685 inline boost::shared_ptr<FieldEntity_vector_view> &
687 return this->sPtr->getRowFieldEntsPtr();
688 }
689
691 return this->sPtr->getColFieldEnts();
692 };
693
694 inline boost::shared_ptr<FieldEntity_vector_view> &
696 return this->sPtr->getColFieldEntsPtr();
697 };
698
699 /**
700 * \brief Get unique UId for finite element entity
701 * @return UId
702 */
703 inline UId getLocalUniqueId() const { return this->sPtr->getLocalUniqueId(); }
704
706 return this->sPtr->getSideNumberTable();
707 }
708
709 inline MoFEMErrorCode getElementAdjacency(const Field *field_ptr,
710 Range &adjacency) {
711 return this->getElementAdjacency(field_ptr, adjacency);
712 }
713
714 inline const boost::shared_ptr<RefElement> &getRefElement() const {
715 return this->sPtr->getRefElement();
716 }
717};
718
719/** \brief Partitioned (Indexed) Finite Element in Problem
720
721 * This type of structure is used to compose problem. Problem is build from
722 * indexed finite elements. This data structure carry information about
723 * partition, which is specific to problem.
724
725
726 * \ingroup fe_multi_indices
727 */
729 : public interface_EntFiniteElement<EntFiniteElement> {
730
731 virtual ~NumeredEntFiniteElement() = default;
732
737
738 unsigned int part; ///< Partition number
739
740 inline boost::shared_ptr<EntFiniteElement> &getEntFiniteElement() const {
741 return this->sPtr;
742 }
743
744 /**
745 * \Construct indexed finite element
746 */
747 NumeredEntFiniteElement(const boost::shared_ptr<EntFiniteElement> &sptr);
748
749 /**
750 * \brief Get partition number
751 * @return [description]
752 */
753 inline unsigned int getPart() const { return part; };
754
755 /** \brief get FE dof on row
756 * \ingroup mofem_dofs
757 */
758 boost::shared_ptr<FENumeredDofEntity_multiIndex> getRowDofsPtr() const;
759
760 /** \brief get FE dof on column
761 * \ingroup mofem_dofs
762 */
763 boost::shared_ptr<FENumeredDofEntity_multiIndex> getColDofsPtr() const;
764
765 /** \brief get FE dof by petsc index
766 * \ingroup mofem_dofs
767 */
768 boost::weak_ptr<FENumeredDofEntity>
769 getRowDofsByPetscGlobalDofIdx(const int idx) const;
770
771 /** \brief get FE dof by petsc index
772 * \ingroup mofem_dofs
773 */
774 boost::weak_ptr<FENumeredDofEntity>
775 getColDofsByPetscGlobalDofIdx(const int idx) const;
776
777 friend std::ostream &operator<<(std::ostream &os,
778 const NumeredEntFiniteElement &e);
779};
780
781/**
782 * @relates multi_index_container
783 * \brief MultiIndex container for EntFiniteElement
784 * \ingroup fe_multi_indices
785 *
786 */
787using EntFiniteElement_multiIndex = multi_index_container<
788 boost::shared_ptr<EntFiniteElement>,
789 indexed_by<
790
791 ordered_unique<tag<Unique_mi_tag>,
792 const_mem_fun<EntFiniteElement, UId,
794
795 ordered_non_unique<
796 tag<Ent_mi_tag>,
799
800 >>;
801
802/**
803 @relates multi_index_container
804 \brief MultiIndex for entities for NumeredEntFiniteElement
805 \ingroup fe_multi_indices
806 */
807using NumeredEntFiniteElement_multiIndex = multi_index_container<
808 boost::shared_ptr<NumeredEntFiniteElement>,
809 indexed_by<
810 ordered_unique<
811 tag<Unique_mi_tag>,
812 const_mem_fun<
815 ordered_non_unique<tag<Part_mi_tag>,
816 member<NumeredEntFiniteElement, unsigned int,
818 ordered_non_unique<
819 tag<Ent_mi_tag>,
822 ordered_non_unique<
823 tag<Composite_Name_And_Part_mi_tag>,
824 composite_key<
825 NumeredEntFiniteElement,
826 const_mem_fun<
828 boost::string_ref, &NumeredEntFiniteElement::getNameRef>,
829 member<NumeredEntFiniteElement, unsigned int,
831
832/**
833 @relates multi_index_container
834 \brief MultiIndex for entities for FiniteElement
835 \ingroup fe_multi_indices
836 */
837typedef multi_index_container<
838 boost::shared_ptr<FiniteElement>,
839 indexed_by<hashed_unique<tag<FiniteElement_Meshset_mi_tag>,
840 member<FiniteElement, EntityHandle,
842 hashed_unique<
843 tag<BitFEId_mi_tag>,
844 const_mem_fun<FiniteElement, BitFEId, &FiniteElement::getId>,
845 HashBit<BitFEId>, EqBit<BitFEId>>,
846 ordered_unique<tag<FiniteElement_name_mi_tag>,
847 const_mem_fun<FiniteElement, boost::string_ref,
850
851// modificators
852
853/**
854 * \brief Change finite element part
855 *
856 * \ingroup fe_multi_indices
857 */
859 unsigned int pArt;
860 NumeredEntFiniteElement_change_part(unsigned int part) : pArt(part){};
861 void operator()(boost::shared_ptr<NumeredEntFiniteElement> &fe) {
862 fe->part = pArt;
863 }
865};
866
867/**
868 * \brief Add field to column
869 *
870 * \ingroup fe_multi_indices
871 */
875 : fIdCol(f_id_col){};
876 void operator()(boost::shared_ptr<FiniteElement> &fe);
877};
878
879/**
880 * \brief Add field to row
881 *
882 * \ingroup fe_multi_indices
883 */
887 : fIdRow(f_id_row){};
888 void operator()(boost::shared_ptr<FiniteElement> &fe);
889};
890
891/**
892 * \brief Add field to data
893 *
894 * \ingroup fe_multi_indices
895 */
899 : fIdData(f_id_data){};
900 void operator()(boost::shared_ptr<FiniteElement> &fe);
901};
902
903/**
904 * \brief Unset field from column
905 *
906 * \ingroup fe_multi_indices
907 */
911 : fIdCol(f_id_col){};
912 void operator()(boost::shared_ptr<FiniteElement> &fe);
913};
914
915/**
916 * \brief Unset field from row
917 *
918 * \ingroup fe_multi_indices
919 */
923 : fIdRow(f_id_row){};
924 void operator()(boost::shared_ptr<FiniteElement> &fe);
925};
926
927/**
928 * \brief Unset field from data
929 *
930 * \ingroup fe_multi_indices
931 */
935 : fIdData(f_id_data){};
936 void operator()(boost::shared_ptr<FiniteElement> &fe);
937};
938
939/**
940 * \brief Reset field from column
941 *
942 * \ingroup fe_multi_indices
943 */
946 void operator()(boost::shared_ptr<FiniteElement> &fe);
947};
948
949/**
950 * \brief Reset field from row
951 *
952 * \ingroup fe_multi_indices
953 */
956 void operator()(boost::shared_ptr<FiniteElement> &fe);
957};
958
959/**
960 * \brief Reset field from data
961 *
962 * \ingroup fe_multi_indices
963 */
966 void operator()(boost::shared_ptr<FiniteElement> &fe);
967};
968
969} // namespace MoFEM
970
971#endif // __FEMMULTIINDICES_HPP__
972
973/**
974 * \defgroup fe_multi_indices Finite elements structures and multi-indices
975 * \ingroup mofem
976 **/
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#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< 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.
boost::function< MoFEMErrorCode( Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)> ElementAdjacencyFunct
user adjacency function
multi_index_container< boost::shared_ptr< EntFiniteElement >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< EntFiniteElement, UId, &EntFiniteElement::getLocalUniqueId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< EntFiniteElement::interface_type_RefEntity, EntityHandle, &EntFiniteElement::getEnt > > > > EntFiniteElement_multiIndex
MultiIndex container for EntFiniteElement.
multi_index_container< boost::shared_ptr< FiniteElement >, indexed_by< hashed_unique< tag< FiniteElement_Meshset_mi_tag >, member< FiniteElement, EntityHandle, &FiniteElement::meshset > >, hashed_unique< tag< BitFEId_mi_tag >, const_mem_fun< FiniteElement, BitFEId, &FiniteElement::getId >, HashBit< BitFEId >, EqBit< BitFEId > >, ordered_unique< tag< FiniteElement_name_mi_tag >, const_mem_fun< FiniteElement, boost::string_ref, &FiniteElement::getNameRef > > > > FiniteElement_multiIndex
MultiIndex for entities for FiniteElement.
multi_index_container< boost::shared_ptr< NumeredEntFiniteElement >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< NumeredEntFiniteElement::interface_type_EntFiniteElement, UId, &NumeredEntFiniteElement::getLocalUniqueId > >, ordered_non_unique< tag< Part_mi_tag >, member< NumeredEntFiniteElement, unsigned int, &NumeredEntFiniteElement::part > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< NumeredEntFiniteElement::interface_type_RefEntity, EntityHandle, &NumeredEntFiniteElement::getEnt > >, ordered_non_unique< tag< Composite_Name_And_Part_mi_tag >, composite_key< NumeredEntFiniteElement, const_mem_fun< NumeredEntFiniteElement::interface_type_FiniteElement, boost::string_ref, &NumeredEntFiniteElement::getNameRef >, member< NumeredEntFiniteElement, unsigned int, &NumeredEntFiniteElement::part > > > > > NumeredEntFiniteElement_multiIndex
MultiIndex for entities for NumeredEntFiniteElement.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition Types.hpp:43
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
Definition Types.hpp:42
uint128_t UId
Unique Id.
Definition Types.hpp:31
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
boost::weak_ptr< CacheTuple > CacheTupleWeakPtr
std::tuple< std::vector< EntityCacheDofs >, std::vector< EntityCacheNumeredDofs >, std::vector< EntityCacheNumeredDofs > > CacheTuple
std::vector< boost::weak_ptr< FieldEntity > > FieldEntity_vector_view
boost::shared_ptr< CacheTuple > CacheTupleSharedPtr
static constexpr DefEntTypeMap defVertexTypeMap
static constexpr DefEntTypeMap defEdgeTypeMap
std::array< bool, MBMAXTYPE > DefEntTypeMap
static constexpr DefEntTypeMap defQuadTypeMap
static bool getDefTypeMap(const EntityType fe_type, const EntityType ent_type)
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
Deprecated interface functions.
Finite element data for entity.
UId getLocalUniqueIdCalculate() const
Generate UId for finite element entity.
EntFiniteElement(const boost::shared_ptr< RefElement > &ref_finite_element, const boost::shared_ptr< FiniteElement > &fe_ptr)
friend std::ostream & operator<<(std::ostream &os, const EntFiniteElement &e)
boost::shared_ptr< std::vector< boost::shared_ptr< FEDofEntity > > > getDataVectorDofsPtr() const
Get data data dos multi-index structure.
boost::shared_ptr< FieldEntity_vector_view > & getDataFieldEntsPtr() const
boost::shared_ptr< FieldEntity_vector_view > dataFieldEnts
boost::shared_ptr< FEDofEntity_multiIndex > getDataDofsPtr() const
Get the Data Dofs Ptr object.
boost::shared_ptr< FieldEntity_vector_view > & getColFieldEntsPtr() const
FieldEntity_vector_view & getRowFieldEnts() const
static MoFEMErrorCode getDofView(const FE_ENTS &fe_ents_view, const MOFEM_DOFS &mofem_dofs, MOFEM_DOFS_VIEW &dofs_view, INSERTER &&inserter)
static UId getLocalUniqueIdCalculate(const EntityHandle ent, UId fe_uid)
MoFEMErrorCode getColDofView(const MOFEM_DOFS &mofem_dofs, MOFEM_DOFS_VIEW &dofs_view, const int operation_type=moab::Interface::UNION)
UId getLocalUniqueId() const
Get unique UId for finite element entity.
interface_RefEntity< RefElement > interface_type_RefEntity
MoFEMErrorCode getRowDofView(const MOFEM_DOFS &mofem_dofs, MOFEM_DOFS_VIEW &dofs_view)
boost::shared_ptr< FieldEntity_vector_view > & getRowFieldEntsPtr() const
virtual ~EntFiniteElement()=default
boost::shared_ptr< FieldEntity_vector_view > colFieldEnts
FieldEntity_vector_view & getColFieldEnts() const
MoFEMErrorCode getElementAdjacency(const boost::shared_ptr< Field > field_ptr, std::vector< EntityHandle > &adjacency)
FieldEntity_vector_view & getDataFieldEnts() const
boost::shared_ptr< FieldEntity_vector_view > rowFieldEnts
std::array< DofEntity_multiIndex::iterator, 2 > loHi
std::array< NumeredDofEntity_multiIndex::iterator, 2 > loHi
Provide data structure for (tensor) field approximation.
FiniteElement_change_bit_add(const BitFieldId f_id_data)
void operator()(boost::shared_ptr< FiniteElement > &fe)
void operator()(boost::shared_ptr< FiniteElement > &fe)
FiniteElement_change_bit_off(const BitFieldId f_id_data)
void operator()(boost::shared_ptr< FiniteElement > &fe)
void operator()(boost::shared_ptr< FiniteElement > &fe)
FiniteElement_col_change_bit_add(const BitFieldId f_id_col)
void operator()(boost::shared_ptr< FiniteElement > &fe)
FiniteElement_col_change_bit_off(const BitFieldId f_id_col)
void operator()(boost::shared_ptr< FiniteElement > &fe)
FiniteElement_row_change_bit_add(const BitFieldId f_id_row)
void operator()(boost::shared_ptr< FiniteElement > &fe)
void operator()(boost::shared_ptr< FiniteElement > &fe)
FiniteElement_row_change_bit_off(const BitFieldId f_id_row)
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.
EntityHandle getMeshset() const
Get meshset containing element entities.
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.
std::string getName() const
Get finite element name.
BitFEId getId() const
Get finite element id.
const UId & getFEUId() const
Get finite element uid.
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.
friend std::ostream & operator<<(std::ostream &os, const FiniteElement &e)
print finite element
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...
void operator()(boost::shared_ptr< NumeredEntFiniteElement > &fe)
void operator()(NumeredEntFiniteElement &fe)
Partitioned (Indexed) Finite Element in Problem.
interface_FiniteElement< EntFiniteElement, EntFiniteElement > interface_type_FiniteElement
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
unsigned int getPart() const
Get partition number.
friend std::ostream & operator<<(std::ostream &os, const NumeredEntFiniteElement &e)
virtual ~NumeredEntFiniteElement()=default
boost::shared_ptr< FENumeredDofEntity_multiIndex > getRowDofsPtr() const
get FE dof on row
interface_EntFiniteElement< EntFiniteElement > interface_type_EntFiniteElement
boost::shared_ptr< FENumeredDofEntity_multiIndex > getColDofsPtr() const
get FE dof on column
unsigned int part
Partition number.
interface to EntFiniteElement
boost::shared_ptr< FieldEntity_vector_view > & getDataFieldEntsPtr()
FieldEntity_vector_view & getDataFieldEnts() const
SideNumber_multiIndex & getSideNumberTable() const
virtual ~interface_EntFiniteElement()=default
UId getLocalUniqueId() const
Get unique UId for finite element entity.
boost::shared_ptr< FieldEntity_vector_view > & getColFieldEntsPtr() const
MoFEMErrorCode getElementAdjacency(const Field *field_ptr, Range &adjacency)
FieldEntity_vector_view & getColFieldEnts() const
interface_EntFiniteElement(const boost::shared_ptr< T > &sptr)
FieldEntity_vector_view & getRowFieldEnts() const
boost::shared_ptr< FieldEntity_vector_view > & getRowFieldEntsPtr() const
const boost::shared_ptr< RefElement > & getRefElement() const
const UId & getFEUId() const
Get finite element uid.
boost::string_ref getNameRef() const
Get finite element name.
EntityHandle getMeshset() const
Get meshset containing element entities.
BitFieldId getBitFieldIdData() const
Get field ids on data.
unsigned int getBitNumber() const
Get bit identifying this element.
BitFEId getId() const
Get finite element id.
BitFieldId getBitFieldIdCol() const
Get field ids on columns.
BitFieldId getBitFieldIdRow() const
Get field ids on rows.
std::string getName() const
Get finite element name.
interface_FiniteElement(const boost::shared_ptr< T > fe_ptr, const boost::shared_ptr< T > ref_ents_ptr)
boost::shared_ptr< FiniteElement > & getFiniteElementPtr() const
std::string getName() const
Get finite element name.
const UId & getFEUId() const
Get finite element uid.
boost::shared_ptr< FE > & getFiniteElementPtr() const
virtual ~interface_FiniteElement()=default
boost::shared_ptr< FE > sFiniteElementPtr
BitFEId getId() const
Get finite element id.
interface_FiniteElement(const boost::shared_ptr< FE > fe_ptr, const boost::shared_ptr< REFENT > ref_ents_ptr)
BitFieldId getBitFieldIdData() const
Get field ids on data.
BitFieldId getBitFieldIdRow() const
Get field ids on rows.
unsigned int getBitNumber() const
Get bit identifying this element.
BitFieldId getBitFieldIdCol() const
Get field ids on columns.
EntityHandle getMeshset() const
Get meshset containing element entities.
boost::string_ref getNameRef() const
Get finite element name.
interface_FiniteElementImpl(const boost::shared_ptr< FE > fe_ptr, const boost::shared_ptr< REFENT > ref_ents_ptr)
virtual ~interface_FiniteElementImpl()=default
interface_RefEntity< REFENT > interface_type_RefEntity
boost::shared_ptr< REFENT > & getRefElement() const