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