v0.9.1
DofsMultiIndices.hpp
Go to the documentation of this file.
1 /** \file DofsMultiIndices.hpp
2  * \ingroup dof_multi_indices
3  * \brief Multi-Index contains, data structures for mofem dofs and other
4  * low-level functions
5  */
6 
7 /* MoFEM is free software: you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11 
12  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15  * License for more details.
16 
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>
19 */
20 
21 #ifndef __DOFSMULTIINDICES_HPP__
22 #define __DOFSMULTIINDICES_HPP__
23 
24 namespace MoFEM {
25 
26 /**
27  * \brief keeps information about DOF on the entity
28  * \ingroup dof_multi_indices
29  */
30 struct DofEntity : public interface_FieldEntity<FieldEntity> {
31 
32  virtual ~DofEntity() = default;
33 
37 
38  static inline UId getGlobalUniqueIdCalculate(const DofIdx dof,
39  const UId &ent_uid) {
40  // if(dof>=MAX_DOFS_ON_ENTITY) THROW_MESSAGE("dof >= MAX_DOFS_ON_ENTITY");
41  return static_cast<UId>(dof) | ent_uid;
42  }
43 
44  /**
45  * \brief Calculate UId for DOF
46  *
47  * UId is constructed such that all DOFs are ordered by processor, entity,
48  * field and dof index on entity, On entity dofs index is constructed such
49  * that coefficient number and dofs increase with dofs index on entity.
50  *
51  * @param dof dof index on entity
52  * @param ent_ptr pointer to field entity
53  * @return UId
54  */
55  static inline UId
57  const boost::shared_ptr<FieldEntity> &ent_ptr) {
58  return getGlobalUniqueIdCalculate(dof, ent_ptr->getGlobalUniqueId());
59  }
60 
61  static inline UId getGlobalUniqueIdCalculate_Low_Proc(const int owner_proc) {
64  }
65 
66  static inline UId getGlobalUniqueIdCalculate_Hi_Proc(const int owner_proc) {
70  }
71 
72  static inline ShortId
74  const boost::shared_ptr<FieldEntity> &ent_ptr) {
75  // if(sizeof(ShortId) < sizeof(char)+2) THROW_MESSAGE("sizeof(ShortId)<
76  // sizeof(char)+2")
77  return static_cast<ShortId>(dof) |
78  (static_cast<ShortId>(ent_ptr->getBitNumber()) << 9);
79  }
80 
81  bool active; ///< true if dof is active
82  UId globalUId; ///< global unique id for this dof
83 
84  DofEntity(const boost::shared_ptr<FieldEntity> &entity_ptr,
85  const ApproximationOrder dof_order,
86  const FieldCoefficientsNumber dof_rank, const DofIdx dof,
87  const bool is_active = false);
88 
89  /// @return get dof index on entity
90  inline DofIdx getEntDofIdx() const {
91  DofIdx dof;
92  memcpy(&dof, &globalUId, 2);
93  return DOF_UID_MASK & dof;
94  }
95 
96  /// @return get field data on dof
97  inline FieldData &getFieldData() const {
98  return const_cast<FieldData &>(
99  (*this->sPtr->getEntFieldDataPtr())[getEntDofIdx()]);
100  }
101 
102  /// @return get unique dof id
103  inline const UId &getGlobalUniqueId() const { return globalUId; }
104 
105  /// @return get entity unique dof id
106  inline const UId &getEntGlobalUniqueId() const {
107  return this->sPtr->getGlobalUniqueId();
108  }
109 
110  /** \brief get short uid it is unique in combination with entity handle
111  *
112  * EntityHandle are controlled by MOAB, which is unique in
113  * MOAB instance. However two MOAB instances, can have attached different
114  * EntityHandles to the same entity.
115  *
116  * Relation between MoAB EntityHandle can be handled by saving entity handle
117  * data into tag, see MB_TYPE_HANDLE. MOAB at time of file reading or
118  * creating new MOAB instance, substitute tag value by approbate entity
119  * handle.
120  *
121  * ShortId is created to handle problems related to saving data series, and
122  * reading those data using different MoAB instances.
123  *
124  */
127  }
128 
129  /// @return get dof entity handle
130  inline EntityHandle getEnt() const { return this->sPtr->getEnt(); }
131 
132  /// @return get dof approximation order
134  return getDofOrderMap()[getEntDofIdx()];
135  }
136 
137  /// @return get dof coefficient index
139  return getEntDofIdx() % getNbOfCoeffs();
140  }
141 
142  /// @return return true if dof us active
143  inline char getActive() const { return active ? 1 : 0; }
144 
145  friend std::ostream &operator<<(std::ostream &os, const DofEntity &e);
146 };
147 
148 /**
149  * \brief Interface to DofEntity
150  *
151  * In MoFEM DOFs classes (and Ent and Finite Element classes) are derived by
152  * interface, i.e. not class is derived but interface to it.
153  *
154  * \ingroup dof_multi_indices
155  */
156 template <typename T>
158 
159  virtual ~interface_DofEntity() = default;
160 
161  interface_DofEntity(const boost::shared_ptr<T> &sptr)
162  : interface_FieldEntity<T>(sptr) {}
163 
164  /// @return return dof unique id
165  inline const UId &getGlobalUniqueId() const {
166  return this->sPtr->getGlobalUniqueId();
167  }
168 
169  /// @return return entity unique id
170  inline const UId &getEntGlobalUniqueId() const {
171  return this->sPtr->getEntGlobalUniqueId();
172  }
173 
174  /// @return return short id (used by data recorder)
176  return this->sPtr->getNonNonuniqueShortId();
177  }
178 
179  /// @return return index of dof on the entity
180  inline DofIdx getEntDofIdx() const { return this->sPtr->getEntDofIdx(); }
181 
182  /// @return return data on dof
183  inline FieldData &getFieldData() const { return this->sPtr->getFieldData(); }
184 
185  /// @return return entity handle
186  inline EntityHandle getEnt() const { return this->sPtr->getEnt(); }
187 
188  /// @return get dof approximation order
190  return this->sPtr->getDofOrder();
191  }
192 
193  /// @return get dof coefficient index
195  return this->sPtr->getDofCoeffIdx();
196  }
197 
198  /// @return return true if dof is active
199  inline char getActive() const { return this->sPtr->getActive(); }
200 
201  /// @return get pointer to dof data structure
202  inline boost::shared_ptr<DofEntity> &getDofEntityPtr() const {
203  return this->sPtr;
204  }
205 
206  /// @return get pioneer do dof's entity data structure
207  inline boost::shared_ptr<FieldEntity> &getFieldEntityPtr() const {
208  return this->sPtr->getFieldEntityPtr();
209  }
210 
211 };
212 
213 /**
214  * \brief keeps information about indexed dofs for the problem
215  * \ingroup dof_multi_indices
216  *
217  * FIXME: Is too many iterator, this has to be manage more efficiently, some
218  * iterators could be moved to multi_indices views.
219  *
220  */
221 struct NumeredDofEntity : public interface_DofEntity<DofEntity> {
222 
223  virtual ~NumeredDofEntity() = default;
224 
231  unsigned int pArt;
232 
233  /// @return MoFEM DoF index
234  inline DofIdx getDofIdx() const { return dofIdx; }
235 
236  /// @return PETSc global DoF index
237  inline DofIdx getPetscGlobalDofIdx() const { return petscGloablDofIdx; }
238 
239  /// @return PETSc local DoF index
240  inline DofIdx getPetscLocalDofIdx() const { return petscLocalDofIdx; }
241 
242  /// @return Owning partition (i.e. process/processor)
243  inline unsigned int getPart() const { return pArt; }
244 
245  /// @return True if local index is set
246  inline bool getHasLocalIndex() const {
247  return !std::signbit(petscLocalDofIdx);
248  }
249 
250  NumeredDofEntity(const boost::shared_ptr<DofEntity> &dof_entity_ptr,
251  const int dof_idx = -1, const int petsc_gloabl_dof_idx = -1,
252  const int petsc_local_dof_idx = -1, const int part = -1);
253  friend std::ostream &operator<<(std::ostream &os, const NumeredDofEntity &e);
254 };
255 
256 /**
257  * \brief interface to NumeredDofEntity
258  * \ingroup dof_multi_indices
259  */
260 template <typename T>
262 
263  virtual ~interface_NumeredDofEntity() = default;
264 
265  interface_NumeredDofEntity(const boost::shared_ptr<T> &sptr)
266  : interface_DofEntity<T>(sptr){};
267 
268  /// @return get dof index on entity
269  inline DofIdx getDofIdx() const { return this->sPtr->getDofIdx(); }
270 
271  /// @return get petsc global index on entity
272  inline DofIdx getPetscGlobalDofIdx() const {
273  return this->sPtr->getPetscGlobalDofIdx();
274  }
275 
276  /// @return get pe
277  inline DofIdx getPetscLocalDofIdx() const {
278  return this->sPtr->getPetscLocalDofIdx();
279  }
280 
281  inline unsigned int getPart() const { return this->sPtr->getPart(); }
282 
283  inline bool getHasLocalIndex() const {
284  return this->sPtr->getHasLocalIndex();
285  }
286 
287  inline boost::shared_ptr<NumeredDofEntity> &getNumeredDofEntityPtr() const {
288  return this->sPtr;
289  };
290 };
291 
292 /**
293  * \brief keeps information about indexed dofs for the finite element
294  * \ingroup dof_multi_indices
295  */
296 struct FEDofEntity : public BaseFEEntity, interface_DofEntity<DofEntity> {
297 
298  virtual ~FEDofEntity() = default;
299 
303  FEDofEntity(const boost::shared_ptr<SideNumber> &side_number_ptr,
304  const boost::shared_ptr<DofEntity> &dof_ptr);
305  FEDofEntity(const boost::tuple<const boost::shared_ptr<SideNumber> &,
306  const boost::shared_ptr<DofEntity> &> &t);
307  friend std::ostream &operator<<(std::ostream &os, const FEDofEntity &e);
308 };
309 
310 /**
311  * \brief keeps information about indexed dofs for the finite element
312  * \ingroup dof_multi_indices
313  */
315  interface_NumeredDofEntity<NumeredDofEntity> {
316 
317  virtual ~FENumeredDofEntity() = default;
318 
324  FENumeredDofEntity(const boost::shared_ptr<SideNumber> &side_number_ptr,
325  const boost::shared_ptr<NumeredDofEntity> &dof_ptr);
327  const boost::tuple<const boost::shared_ptr<SideNumber> &,
328  const boost::shared_ptr<NumeredDofEntity> &> &t);
329  friend std::ostream &operator<<(std::ostream &os,
330  const FENumeredDofEntity &e);
331 };
332 
333 /**
334  * @relates multi_index_container
335  * \brief MultiIndex container keeps DofEntity
336  * \ingroup dof_multi_indices
337  */
338 typedef multi_index_container<
339  boost::shared_ptr<DofEntity>,
340  indexed_by<
341  // unique
342  ordered_unique<tag<Unique_mi_tag>,
343  member<DofEntity, UId, &DofEntity::globalUId>>,
344  // non_unique
345  ordered_non_unique<
346  tag<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>,
347  composite_key<
348  DofEntity,
349  const_mem_fun<DofEntity::interface_type_Field,
350  boost::string_ref, &DofEntity::getNameRef>,
351  const_mem_fun<DofEntity, EntityHandle, &DofEntity::getEnt>,
352  const_mem_fun<DofEntity, DofIdx, &DofEntity::getEntDofIdx>>>,
353  ordered_non_unique<tag<Unique_Ent_mi_tag>,
354  const_mem_fun<DofEntity, const UId &,
356  ordered_non_unique<
357  tag<FieldName_mi_tag>,
358  const_mem_fun<DofEntity::interface_type_Field, boost::string_ref,
360  ordered_non_unique<
361  tag<Ent_mi_tag>,
362  const_mem_fun<DofEntity, EntityHandle, &DofEntity::getEnt>>,
363  ordered_non_unique<
364  tag<Composite_Name_And_Ent_mi_tag>,
365  composite_key<
366  DofEntity,
367  const_mem_fun<DofEntity::interface_type_Field,
368  boost::string_ref, &DofEntity::getNameRef>,
369  const_mem_fun<DofEntity, EntityHandle, &DofEntity::getEnt>>>,
370  ordered_non_unique<
371  tag<Composite_Name_And_Type_mi_tag>,
372  composite_key<
373  DofEntity,
374  const_mem_fun<DofEntity::interface_type_Field,
375  boost::string_ref, &DofEntity::getNameRef>,
376  const_mem_fun<DofEntity::interface_type_RefEntity, EntityType,
379 
380 /** \brief Dof multi-index by field name
381  *
382  * \ingroup dof_multi_indices
383  */
386 
387 /** \brief Dof multi-index by entity
388  *
389  * \ingroup dof_multi_indices
390  */
392 
393 /** \brief Dof multi-index by field name and entity
394  *
395  * \ingroup dof_multi_indices
396  */
399 
400 /** \brief Dof multi-index by field name and entity type
401  *
402  * \ingroup dof_multi_indices
403  */
406 
407 /** \brief multi-index view on DofEntity by uid
408  \ingroup dof_multi_indices
409 */
410 typedef multi_index_container<
411  boost::shared_ptr<DofEntity>,
412  indexed_by<
413 
414  ordered_unique<const_mem_fun<DofEntity, const UId &,
416 
417  >>
419 
420 /** \brief vector view on DofEntity by uid
421  \ingroup dof_multi_indices
422 */
423 typedef std::vector<boost::weak_ptr<DofEntity>> DofEntity_vector_view;
424 
425 /** \brief multi-index view on DofEntity activity
426  \ingroup dof_multi_indices
427 */
428 typedef multi_index_container<
429  boost::shared_ptr<DofEntity>,
430  indexed_by<
431 
432  ordered_unique<const_mem_fun<DofEntity, const UId &,
434 
435  ordered_non_unique<
436  const_mem_fun<DofEntity, char, &DofEntity::getActive>>
437 
438  >>
440 
441 /**
442  * @relates multi_index_container
443  * \brief MultiIndex container keeps FEDofEntity
444  * \ingroup dof_multi_indices
445 
446  */
447 typedef multi_index_container<
448  boost::shared_ptr<FEDofEntity>,
449  indexed_by<
450 
451  ordered_unique<
452  tag<Unique_mi_tag>,
453  const_mem_fun<FEDofEntity::interface_type_DofEntity, const UId &,
455 
456  ordered_non_unique<tag<Ent_mi_tag>,
459 
460  ordered_non_unique<
461  tag<FieldName_mi_tag>,
462  const_mem_fun<FEDofEntity::interface_type_Field, boost::string_ref,
464 
465  ordered_non_unique<tag<EntType_mi_tag>,
467  EntityType, &FEDofEntity::getEntType>>,
468 
469  ordered_non_unique<
470  tag<Composite_Name_And_Type_mi_tag>,
471  composite_key<
472  FEDofEntity,
473  const_mem_fun<FEDofEntity::interface_type_Field,
474  boost::string_ref, &FEDofEntity::getNameRef>,
475  const_mem_fun<FEDofEntity::interface_type_RefEntity, EntityType,
477 
478  ordered_non_unique<
479  tag<Composite_Name_And_Ent_mi_tag>,
480  composite_key<
481  FEDofEntity,
482  const_mem_fun<FEDofEntity::interface_type_Field,
483  boost::string_ref, &FEDofEntity::getNameRef>,
486 
487  // This is only used by obsolete modules, should be removed with
488  // brother of Cephas, i.e. Pawel.
489  ordered_non_unique<
490  tag<Composite_Name_Type_And_Side_Number_mi_tag>,
491  composite_key<
492  FEDofEntity,
493  const_mem_fun<FEDofEntity::interface_type_Field,
494  boost::string_ref, &FEDofEntity::getNameRef>,
495  const_mem_fun<FEDofEntity::interface_type_RefEntity, EntityType,
499  boost::shared_ptr<SideNumber>,
501 
502  >>
504 
505 /** \brief Finite element DoF multi-index by field name
506  *
507  * \ingroup dof_multi_indices
508  */
511 
512 /** \brief Dof entity multi-index by field name and entity
513  *
514  * \ingroup dof_multi_indices
515  */
518 
519 /** \brief Dof entity multi-index by field name and entity type
520  *
521  * \ingroup dof_multi_indices
522  */
525 
526 /**
527  * @relates multi_index_container
528  * \brief MultiIndex container keeps FENumeredDofEntity
529 
530  * \ingroup dof_multi_indices
531  */
532 typedef multi_index_container<
533  boost::shared_ptr<FENumeredDofEntity>,
534  indexed_by<
535  ordered_unique<
536  tag<Unique_mi_tag>,
539  ordered_non_unique<
540  tag<Ent_mi_tag>,
543  ordered_non_unique<
544  tag<FieldName_mi_tag>,
546  boost::string_ref, &FENumeredDofEntity::getNameRef>>,
547  ordered_non_unique<
548  tag<Composite_Name_Type_And_Side_Number_mi_tag>,
549  composite_key<
552  boost::string_ref,
555  EntityType, &FENumeredDofEntity::getEntType>,
558  boost::shared_ptr<SideNumber>,
560  ordered_non_unique<
561  tag<Composite_Name_And_Type_mi_tag>,
562  composite_key<
565  boost::string_ref,
568  EntityType, &FENumeredDofEntity::getEntType>>>,
569  ordered_non_unique<
570  tag<Composite_Name_And_Ent_mi_tag>,
571  composite_key<
574  boost::string_ref,
579 
580 /** \brief Finite element numbered DoF multi-index by field name
581  *
582  * \ingroup dof_multi_indices
583  */
586 
587 /** \brief Dof entity multi-index by field name and entity
588  *
589  * \ingroup dof_multi_indices
590  */
591 typedef FENumeredDofEntity_multiIndex::index<
593 
594 /** \brief Dof entity multi-index by field name and entity type
595  *
596  * \ingroup dof_multi_indices
597  */
598 typedef FENumeredDofEntity_multiIndex::index<
600 
601 /** \brief Dof entity multi-index by UId
602  *
603  * \ingroup dof_multi_indices
604  */
607 
608 /** \brief Numbered DoF multi-index by entity
609  *
610  * \ingroup dof_multi_indices
611  */
614 
615 /**
616  * @relates multi_index_container
617  * \brief MultiIndex container keeps NumeredDofEntity
618  * \ingroup dof_multi_indices
619  */
620 typedef multi_index_container<
621  boost::shared_ptr<NumeredDofEntity>,
622 
623  // unique
624  indexed_by<
625  ordered_unique<
626  tag<Unique_mi_tag>,
629 
630  // non unique
631  ordered_non_unique<
632  tag<Unique_Ent_mi_tag>,
634  const UId &,
636 
637  ordered_non_unique<
638  tag<Part_mi_tag>,
639  member<NumeredDofEntity, unsigned int, &NumeredDofEntity::pArt>>,
640  ordered_non_unique<tag<Idx_mi_tag>, member<NumeredDofEntity, DofIdx,
642 
643  ordered_non_unique<
644  tag<FieldName_mi_tag>,
646  boost::string_ref, &NumeredDofEntity::getNameRef>>,
647 
648  ordered_non_unique<tag<PetscGlobalIdx_mi_tag>,
649  member<NumeredDofEntity, DofIdx,
651 
652  ordered_non_unique<tag<PetscLocalIdx_mi_tag>,
653  member<NumeredDofEntity, DofIdx,
655 
656  ordered_non_unique<
657  tag<Ent_mi_tag>,
660 
661  ordered_non_unique<
662  tag<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>,
663  composite_key<
666  boost::string_ref, &NumeredDofEntity::getNameRef>,
671 
672  ordered_non_unique<
673  tag<Composite_Name_And_Part_mi_tag>,
674  composite_key<
677  boost::string_ref, &NumeredDofEntity::getNameRef>,
678  member<NumeredDofEntity, unsigned int,
680 
681  ordered_non_unique<
682  tag<Composite_Name_Ent_And_Part_mi_tag>,
683  composite_key<
686  boost::string_ref, &NumeredDofEntity::getNameRef>,
689  member<NumeredDofEntity, unsigned int,
691 
692  >>
694 
695 /** \brief Numbered DoF multi-index by field name
696  *
697  * \ingroup dof_multi_indices
698  */
701 
702 /** \brief Numbered DoF multi-index by UId
703  *
704  * \ingroup dof_multi_indices
705  */
708 
709 /** \brief Numbered DoF multi-index by local index
710  *
711  * \ingroup dof_multi_indices
712  */
715 
716 /** \brief Numbered DoF multi-index by entity
717  *
718  * \ingroup dof_multi_indices
719  */
722 
723 /** \brief Numbered DoF multi-index by name entity and partition
724  *
725  * \ingroup dof_multi_indices
726  */
727 typedef NumeredDofEntity_multiIndex::index<
729 
730 typedef multi_index_container<
731  boost::shared_ptr<NumeredDofEntity>,
732  indexed_by<ordered_unique<
733  const_mem_fun<NumeredDofEntity::interface_type_DofEntity, const UId &,
736 
737 typedef multi_index_container<
738  boost::shared_ptr<NumeredDofEntity>,
739  indexed_by<hashed_unique<const_mem_fun<NumeredDofEntity, DofIdx,
742 
743 typedef multi_index_container<
744  boost::shared_ptr<NumeredDofEntity>,
745  indexed_by<ordered_non_unique<const_mem_fun<
748 
749 typedef multi_index_container<
750  boost::shared_ptr<NumeredDofEntity>,
751  indexed_by<ordered_non_unique<const_mem_fun<
755 
756 /**
757  * Activate or deactivate dofs (multi-index modifier)
758  * \ingroup dof_multi_indices
759  */
761  bool aCtive;
762  DofEntity_active_change(bool active);
763  void operator()(boost::shared_ptr<DofEntity> &dof);
764 };
765 
766 /**
767  * Change part and global pestc index (multi-index modifier)
768  * \ingroup dof_multi_indices
769  */
771  const unsigned int pArt;
774  const DofIdx petsc_gloabl_dof_idx)
775  : pArt(part), petscGloablDofIdx(petsc_gloabl_dof_idx){};
776  inline void operator()(boost::shared_ptr<NumeredDofEntity> &dof) const {
777  dof->pArt = pArt;
778  dof->petscGloablDofIdx = petscGloablDofIdx;
779  }
780 };
781 
783  const unsigned int pArt;
787  const unsigned int part, const DofIdx mofem_dof_idx,
788  const DofIdx petsc_gloabl_dof_idx)
789  : pArt(part), mofemDofIdx(mofem_dof_idx),
790  petscGloablDofIdx(petsc_gloabl_dof_idx){};
791  inline void operator()(boost::shared_ptr<NumeredDofEntity> &dof) const {
792  dof->pArt = pArt;
793  dof->petscGloablDofIdx = petscGloablDofIdx;
794  }
795 };
796 
798  const unsigned int pArt;
802  const DofIdx petsc_gloabl_dof_idx,
803  const DofIdx petsc_local_dof_idx)
804  : pArt(part), petscGloablDofIdx(petsc_gloabl_dof_idx),
805  petscLocalDofIdx(petsc_local_dof_idx){};
806  inline void operator()(boost::shared_ptr<NumeredDofEntity> &dof) const {
807  dof->pArt = pArt;
808  dof->petscGloablDofIdx = petscGloablDofIdx;
809  dof->petscLocalDofIdx = petscLocalDofIdx;
810  }
811 };
812 
813 /**
814  * Change part and local pestc index (multi-index modifier)
815  * \ingroup dof_multi_indices
816  */
819  NumeredDofEntity_local_idx_change(const DofIdx petsc_local_dof_idx)
820  : petscLocalDofIdx(petsc_local_dof_idx){};
821  inline void operator()(boost::shared_ptr<NumeredDofEntity> &dof) const {
822  dof->petscLocalDofIdx = petscLocalDofIdx;
823  }
824 };
825 
826 /**
827  * Change part and mofem index (multi-index modifier)
828  * \ingroup dof_multi_indices
829  */
833  : mofemIdx(mofem_idx){};
834  inline void operator()(boost::shared_ptr<NumeredDofEntity> &dof) const {
835  dof->dofIdx = mofemIdx;
836  }
837 };
838 
839 /**
840  * Change part and mofem/pestc global and local index (multi-index modifier)
841  * \ingroup dof_multi_indices
842  */
844  const unsigned int pArt;
849  const unsigned int part, const DofIdx mofem_idx,
850  const DofIdx petsc_gloabl_dof_idx, const DofIdx petsc_local_dof_idx)
851  : pArt(part), mofemIdx(mofem_idx),
852  petscGloablDofIdx(petsc_gloabl_dof_idx),
853  petscLocalDofIdx(petsc_local_dof_idx){};
854  inline void operator()(boost::shared_ptr<NumeredDofEntity> &dof) const {
855  dof->pArt = pArt;
856  dof->dofIdx = mofemIdx;
857  dof->petscGloablDofIdx = petscGloablDofIdx;
858  dof->petscLocalDofIdx = petscLocalDofIdx;
859  }
860 };
861 
862 /**
863  * Replace dofs shared_ptr
864  *
865  * DOFs on entities are stored by sequences. If DOFs to entities are added,
866  * whole entity sequence is change to preserve continuity in memory
867  *
868  * \ingroup dof_multi_indices
869  */
870 template <class T> struct Dof_shared_ptr_change {
871  boost::shared_ptr<T> &dofPtr;
872  Dof_shared_ptr_change(boost::shared_ptr<T> &dof_ptr) : dofPtr(dof_ptr){};
873  inline void operator()(boost::shared_ptr<T> &dof) { dof = dofPtr; }
874 };
875 
876 } // namespace MoFEM
877 #endif // __DOFSMULTIINDICES_HPP__
878 
879 /***************************************************************************/ /**
880  * \defgroup dof_multi_indices Dofs structures and multi-indices
881  * \ingroup mofem
882 ******************************************************************************/
void operator()(boost::shared_ptr< NumeredDofEntity > &dof) const
NumeredDofEntity_multiIndex::index< FieldName_mi_tag >::type NumeredDofEntityByFieldName
Numbered DoF multi-index by field name.
interface_RefEntity< NumeredDofEntity > interface_type_RefEntity
interface_Field< NumeredDofEntity > interface_type_Field
void operator()(boost::shared_ptr< NumeredDofEntity > &dof) const
void operator()(boost::shared_ptr< NumeredDofEntity > &dof) const
Keeps basic information about entity on the finite element.
DofIdx getPetscLocalDofIdx() const
multi_index_container< boost::shared_ptr< DofEntity >, indexed_by< ordered_unique< const_mem_fun< DofEntity, const UId &, &DofEntity::getGlobalUniqueId > > > > DofEntity_multiIndex_uid_view
multi-index view on DofEntity by uid
boost::shared_ptr< FieldEntity > sPtr
keeps information about indexed dofs for the finite element
friend std::ostream & operator<<(std::ostream &os, const NumeredDofEntity &e)
DofIdx getEntDofIdx() const
DofIdx getPetscGlobalDofIdx() const
interface_Field< DofEntity > interface_type_Field
FENumeredDofEntity(const boost::shared_ptr< SideNumber > &side_number_ptr, const boost::shared_ptr< NumeredDofEntity > &dof_ptr)
interface_NumeredDofEntity(const boost::shared_ptr< T > &sptr)
DofEntity_multiIndex::index< Ent_mi_tag >::type DofEntityByEnt
Dof multi-index by entity.
NumeredDofEntity_multiIndex::index< Ent_mi_tag >::type NumeredDofEntityByEnt
Numbered DoF multi-index by entity.
boost::shared_ptr< DofEntity > & getDofEntityPtr() const
FENumeredDofEntity_multiIndex::index< FieldName_mi_tag >::type FENumeredDofEntityByFieldName
Finite element numbered DoF multi-index by field name.
DofEntity(const boost::shared_ptr< FieldEntity > &entity_ptr, const ApproximationOrder dof_order, const FieldCoefficientsNumber dof_rank, const DofIdx dof, const bool is_active=false)
ShortId getNonNonuniqueShortId() const
get short uid it is unique in combination with entity handle
boost::shared_ptr< NumeredDofEntity > & getNumeredDofEntityPtr() const
FieldCoefficientsNumber getDofCoeffIdx() const
FieldData & getFieldData() const
keeps information about DOF on the entity
static ShortId getNonNonuniqueShortId(const DofIdx dof, const boost::shared_ptr< FieldEntity > &ent_ptr)
DofEntity_multiIndex::index< Composite_Name_And_Type_mi_tag >::type DofEntityByNameAndType
Dof multi-index by field name and entity type.
std::vector< boost::weak_ptr< DofEntity > > DofEntity_vector_view
vector view on DofEntity by uid
int ApproximationOrder
Approximation on the entity.
Definition: Types.hpp:37
boost::shared_ptr< SideNumber > sideNumberPtr
NumeredDofEntity_multiIndex::index< Composite_Name_Ent_And_Part_mi_tag >::type NumeredDofEntityByNameEntAndPart
Numbered DoF multi-index by name entity and partition.
multi_index_container< boost::shared_ptr< NumeredDofEntity >, indexed_by< hashed_unique< const_mem_fun< NumeredDofEntity, DofIdx, &NumeredDofEntity::getDofIdx > > > > NumeredDofEntity_multiIndex_idx_view_hashed
Interface to FieldEntityinterface to FieldEntity.
FENumeredDofEntity_multiIndex::index< Composite_Name_And_Ent_mi_tag >::type FENumeredDofEntityByNameAndEnt
Dof entity multi-index by field name and entity.
void operator()(boost::shared_ptr< NumeredDofEntity > &dof) const
multi_index_container< boost::shared_ptr< FENumeredDofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< FENumeredDofEntity::interface_type_DofEntity, const UId &, &FENumeredDofEntity::getGlobalUniqueId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FENumeredDofEntity::interface_type_DofEntity, EntityHandle, &FENumeredDofEntity::getEnt > >, ordered_non_unique< tag< FieldName_mi_tag >, const_mem_fun< FENumeredDofEntity::interface_type_Field, boost::string_ref, &FENumeredDofEntity::getNameRef > >, ordered_non_unique< tag< Composite_Name_Type_And_Side_Number_mi_tag >, composite_key< FENumeredDofEntity, const_mem_fun< FENumeredDofEntity::interface_type_Field, boost::string_ref, &FENumeredDofEntity::getNameRef >, const_mem_fun< FENumeredDofEntity::interface_type_RefEntity, EntityType, &FENumeredDofEntity::getEntType >, KeyFromKey< member< SideNumber, char, &SideNumber::side_number >, member< FENumeredDofEntity::BaseFEEntity, boost::shared_ptr< SideNumber >, &FENumeredDofEntity::sideNumberPtr > > > >, ordered_non_unique< tag< Composite_Name_And_Type_mi_tag >, composite_key< FENumeredDofEntity, const_mem_fun< FENumeredDofEntity::interface_type_Field, boost::string_ref, &FENumeredDofEntity::getNameRef >, const_mem_fun< FENumeredDofEntity::interface_type_RefEntity, EntityType, &FENumeredDofEntity::getEntType > > >, ordered_non_unique< tag< Composite_Name_And_Ent_mi_tag >, composite_key< FENumeredDofEntity, const_mem_fun< FENumeredDofEntity::interface_type_Field, boost::string_ref, &FENumeredDofEntity::getNameRef >, const_mem_fun< FENumeredDofEntity::interface_type_DofEntity, EntityHandle, &FENumeredDofEntity::getEnt > > > > > FENumeredDofEntity_multiIndex
MultiIndex container keeps FENumeredDofEntity.
const UId & getGlobalUniqueId() const
interface_DofEntity(const boost::shared_ptr< T > &sptr)
NumeredDofEntity_local_idx_change(const DofIdx petsc_local_dof_idx)
FieldCoefficientsNumber getNbOfCoeffs() const
virtual ~NumeredDofEntity()=default
const UId & getEntGlobalUniqueId() const
static UId getGlobalUniqueIdCalculate_Hi_Proc(const int owner_proc)
EntityHandle getEnt() const
NumeredDofEntity_multiIndex::index< PetscLocalIdx_mi_tag >::type NumeredDofEntityByLocalIdx
Numbered DoF multi-index by local index.
void operator()(boost::shared_ptr< T > &dof)
FENumeredDofEntity_multiIndex::index< Unique_mi_tag >::type FENumeredDofEntityByUId
Dof entity multi-index by UId.
virtual ~FENumeredDofEntity()=default
interface to NumeredDofEntity
interface_NumeredDofEntity< NumeredDofEntity > interface_type_NumeredDofEntity
friend std::ostream & operator<<(std::ostream &os, const FEDofEntity &e)
FieldData & getFieldData() const
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
multi_index_container< boost::shared_ptr< NumeredDofEntity >, indexed_by< ordered_unique< const_mem_fun< NumeredDofEntity::interface_type_DofEntity, const UId &, &NumeredDofEntity::getGlobalUniqueId > > > > NumeredDofEntity_multiIndex_uid_view_ordered
keeps information about indexed dofs for the finite element
FEDofEntity_multiIndex::index< FieldName_mi_tag >::type FEDofEntityByFieldName
Finite element DoF multi-index by field name.
interface_Field< FieldEntity > interface_type_Field
NumeredDofEntity_part_and_glob_idx_change(const unsigned int part, const DofIdx petsc_gloabl_dof_idx)
virtual ~interface_NumeredDofEntity()=default
interface_FieldEntity< FieldEntity > interface_type_FieldEntity
char getActive() const
friend std::ostream & operator<<(std::ostream &os, const FENumeredDofEntity &e)
multi_index_container< boost::shared_ptr< DofEntity >, indexed_by< ordered_unique< const_mem_fun< DofEntity, const UId &, &DofEntity::getGlobalUniqueId > >, ordered_non_unique< const_mem_fun< DofEntity, char, &DofEntity::getActive > > > > DofEntity_multiIndex_active_view
multi-index view on DofEntity activity
static UId getGlobalUniqueIdCalculate_Hi_Proc(const int owner_proc)
multi_index_container< boost::shared_ptr< NumeredDofEntity >, indexed_by< ordered_non_unique< const_mem_fun< NumeredDofEntity, DofIdx, &NumeredDofEntity::getPetscLocalDofIdx > > > > NumeredDofEntity_multiIndex_petsc_local_dof_view_ordered_non_unique
EntityHandle getEnt() const
virtual ~DofEntity()=default
ShortId getNonNonuniqueShortId() const
unsigned int getPart() const
NumeredDofEntity_part_and_all_indices_change(const unsigned int part, const DofIdx mofem_idx, const DofIdx petsc_gloabl_dof_idx, const DofIdx petsc_local_dof_idx)
interface_FieldEntity< DofEntity > interface_type_FieldEntity
NumeredDofEntity_part_and_mofem_glob_idx_change(const unsigned int part, const DofIdx mofem_dof_idx, const DofIdx petsc_gloabl_dof_idx)
multi_index_container< boost::shared_ptr< DofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, member< DofEntity, UId, &DofEntity::globalUId > >, ordered_non_unique< tag< Composite_Name_And_Ent_And_EntDofIdx_mi_tag >, composite_key< DofEntity, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt >, const_mem_fun< DofEntity, DofIdx, &DofEntity::getEntDofIdx > > >, ordered_non_unique< tag< Unique_Ent_mi_tag >, const_mem_fun< DofEntity, const UId &, &DofEntity::getEntGlobalUniqueId > >, ordered_non_unique< tag< FieldName_mi_tag >, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt > >, ordered_non_unique< tag< Composite_Name_And_Ent_mi_tag >, composite_key< DofEntity, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt > > >, ordered_non_unique< tag< Composite_Name_And_Type_mi_tag >, composite_key< DofEntity, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef >, const_mem_fun< DofEntity::interface_type_RefEntity, EntityType, &DofEntity::getEntType > > > > > DofEntity_multiIndex
MultiIndex container keeps DofEntity.
DofEntity_multiIndex::index< FieldName_mi_tag >::type DofEntityByFieldName
Dof multi-index by field name.
boost::shared_ptr< FieldEntity > & getFieldEntityPtr() const
const UId & getEntGlobalUniqueId() const
Dof_shared_ptr_change(boost::shared_ptr< T > &dof_ptr)
NumeredDofEntity_mofem_index_change(const DofIdx mofem_idx)
FENumeredDofEntity_multiIndex::index< Composite_Name_And_Type_mi_tag >::type FENumeredDofEntityByNameAndType
Dof entity multi-index by field name and entity type.
static UId getGlobalUniqueIdCalculate_Low_Proc(const int owner_proc)
static UId getGlobalUniqueIdCalculate(const DofIdx dof, const UId &ent_uid)
const UId & getGlobalUniqueId() const
boost::shared_ptr< T > & dofPtr
FEDofEntity_multiIndex::index< Composite_Name_And_Ent_mi_tag >::type FEDofEntityByNameAndEnt
Dof entity multi-index by field name and entity.
virtual ~FEDofEntity()=default
boost::shared_ptr< FieldEntity > & getFieldEntityPtr() const
interface_DofEntity< NumeredDofEntity > interface_type_DofEntity
friend std::ostream & operator<<(std::ostream &os, const DofEntity &e)
bool active
true if dof is active
multi_index_container< boost::shared_ptr< NumeredDofEntity >, indexed_by< ordered_non_unique< const_mem_fun< NumeredDofEntity::interface_type_DofEntity, FieldCoefficientsNumber, &NumeredDofEntity::getDofCoeffIdx > > > > NumeredDofEntity_multiIndex_coeff_idx_ordered_non_unique
multi_index_container< boost::shared_ptr< FEDofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< FEDofEntity::interface_type_DofEntity, const UId &, &FEDofEntity::getGlobalUniqueId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FEDofEntity::interface_type_DofEntity, EntityHandle, &FEDofEntity::getEnt > >, ordered_non_unique< tag< FieldName_mi_tag >, const_mem_fun< FEDofEntity::interface_type_Field, boost::string_ref, &FEDofEntity::getNameRef > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< FEDofEntity::interface_type_RefEntity, EntityType, &FEDofEntity::getEntType > >, ordered_non_unique< tag< Composite_Name_And_Type_mi_tag >, composite_key< FEDofEntity, const_mem_fun< FEDofEntity::interface_type_Field, boost::string_ref, &FEDofEntity::getNameRef >, const_mem_fun< FEDofEntity::interface_type_RefEntity, EntityType, &FEDofEntity::getEntType > > >, ordered_non_unique< tag< Composite_Name_And_Ent_mi_tag >, composite_key< FEDofEntity, const_mem_fun< FEDofEntity::interface_type_Field, boost::string_ref, &FEDofEntity::getNameRef >, const_mem_fun< FEDofEntity::interface_type_DofEntity, EntityHandle, &FEDofEntity::getEnt > > >, ordered_non_unique< tag< Composite_Name_Type_And_Side_Number_mi_tag >, composite_key< FEDofEntity, const_mem_fun< FEDofEntity::interface_type_Field, boost::string_ref, &FEDofEntity::getNameRef >, const_mem_fun< FEDofEntity::interface_type_RefEntity, EntityType, &FEDofEntity::getEntType >, KeyFromKey< member< SideNumber, char, &SideNumber::side_number >, member< FEDofEntity::BaseFEEntity, boost::shared_ptr< SideNumber >, &FEDofEntity::sideNumberPtr > > > > > > FEDofEntity_multiIndex
MultiIndex container keeps FEDofEntity.
FENumeredDofEntity_multiIndex::index< Ent_mi_tag >::type FENumeredDofEntityByEnt
Numbered DoF multi-index by entity.
ApproximationOrder getDofOrder() const
int ShortId
Unique Id in the field.
Definition: Types.hpp:42
ApproximationOrder getDofOrder() const
BaseFEEntity(const boost::shared_ptr< SideNumber > &side_number_ptr)
void operator()(boost::shared_ptr< DofEntity > &dof)
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
Definition: definitions.h:304
interface_DofEntity< DofEntity > interface_type_DofEntity
keeps information about indexed dofs for the problemFIXME: Is too many iterator, this has to be manag...
interface_RefEntity< FieldEntity > interface_type_RefEntity
int FieldCoefficientsNumber
Number of field coefficients.
Definition: Types.hpp:38
static UId getGlobalUniqueIdCalculate(const DofIdx dof, const boost::shared_ptr< FieldEntity > &ent_ptr)
Calculate UId for DOF.
interface_DofEntity< DofEntity > interface_type_DofEntity
Interface to DofEntity.
FieldCoefficientsNumber getDofCoeffIdx() const
FEDofEntity(const boost::shared_ptr< SideNumber > &side_number_ptr, const boost::shared_ptr< DofEntity > &dof_ptr)
int DofIdx
Index of DOF.
Definition: Types.hpp:29
std::array< int, MAX_DOFS_ON_ENTITY > & getDofOrderMap() const
get hash-map relating dof index on entity with its order
FEDofEntity_multiIndex::index< Composite_Name_And_Type_mi_tag >::type FEDofEntityByNameAndType
Dof entity multi-index by field name and entity type.
NumeredDofEntity_multiIndex::index< Unique_mi_tag >::type NumeredDofEntityByUId
Numbered DoF multi-index by UId.
NumeredDofEntity(const boost::shared_ptr< DofEntity > &dof_entity_ptr, const int dof_idx=-1, const int petsc_gloabl_dof_idx=-1, const int petsc_local_dof_idx=-1, const int part=-1)
virtual ~interface_DofEntity()=default
UId globalUId
global unique id for this dof
#define DOF_UID_MASK
Mask for DOF number on entity form UId.
Definition: definitions.h:305
void operator()(boost::shared_ptr< NumeredDofEntity > &dof) const
uint128_t UId
Unique Id.
Definition: Types.hpp:41
void operator()(boost::shared_ptr< NumeredDofEntity > &dof) const
DofEntity_multiIndex::index< Composite_Name_And_Ent_mi_tag >::type DofEntityByNameAndEnt
Dof multi-index by field name and entity.
NumeredDofEntity_part_and_indices_change(const unsigned int part, const DofIdx petsc_gloabl_dof_idx, const DofIdx petsc_local_dof_idx)
interface_RefEntity< DofEntity > interface_type_RefEntity
static UId getGlobalUniqueIdCalculate_Low_Proc(const int owner_proc)
multi_index_container< boost::shared_ptr< NumeredDofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, const UId &, &NumeredDofEntity::getGlobalUniqueId > >, ordered_non_unique< tag< Unique_Ent_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, const UId &, &NumeredDofEntity::getEntGlobalUniqueId > >, ordered_non_unique< tag< Part_mi_tag >, member< NumeredDofEntity, unsigned int, &NumeredDofEntity::pArt > >, ordered_non_unique< tag< Idx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::dofIdx > >, ordered_non_unique< tag< FieldName_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_Field, boost::string_ref, &NumeredDofEntity::getNameRef > >, ordered_non_unique< tag< PetscGlobalIdx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::petscGloablDofIdx > >, ordered_non_unique< tag< PetscLocalIdx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::petscLocalDofIdx > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, EntityHandle, &NumeredDofEntity::getEnt > >, ordered_non_unique< tag< Composite_Name_And_Ent_And_EntDofIdx_mi_tag >, composite_key< NumeredDofEntity, const_mem_fun< NumeredDofEntity::interface_type_Field, boost::string_ref, &NumeredDofEntity::getNameRef >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, EntityHandle, &NumeredDofEntity::getEnt >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, DofIdx, &NumeredDofEntity::getEntDofIdx > > >, ordered_non_unique< tag< Composite_Name_And_Part_mi_tag >, composite_key< NumeredDofEntity, const_mem_fun< NumeredDofEntity::interface_type_Field, boost::string_ref, &NumeredDofEntity::getNameRef >, member< NumeredDofEntity, unsigned int, &NumeredDofEntity::pArt > > >, ordered_non_unique< tag< Composite_Name_Ent_And_Part_mi_tag >, composite_key< NumeredDofEntity, const_mem_fun< NumeredDofEntity::interface_type_Field, boost::string_ref, &NumeredDofEntity::getNameRef >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, EntityHandle, &NumeredDofEntity::getEnt >, member< NumeredDofEntity, unsigned int, &NumeredDofEntity::pArt > > > > > NumeredDofEntity_multiIndex
MultiIndex container keeps NumeredDofEntity.
interface_Field< DofEntity > interface_type_Field