v0.13.2
Loading...
Searching...
No Matches
ProblemsMultiIndices.hpp
Go to the documentation of this file.
1/** \file ProblemsMultiIndices.hpp
2 * \brief Multi-index containers, data structures for problems and other
3 * low-level functions
4 */
5
6#ifndef __PROBLEMSMULTIINDICES_HPP__
7#define __PROBLEMSMULTIINDICES_HPP__
8
9namespace MoFEM {
10
11struct Problem;
12
13/**
14 * Data structure created when composite problem is created
15 */
17
18 std::vector<const Problem *> rowProblemsAdd;
19 std::vector<const Problem *> colProblemsAdd;
20
21 std::vector<IS> rowIs;
22 std::vector<IS> colIs;
23
24 inline MoFEMErrorCode getRowIs(IS *is, const unsigned int pp) const;
25
26 inline MoFEMErrorCode getColIs(IS *is, const unsigned int pp) const;
27
28 virtual ~ComposedProblemsData();
29};
30
31/** \brief keeps basic data about problem
32 * \ingroup problems_multi_indices
33 *
34 * This is low level structure with information about problem, what elements
35 * compose problem and what DOFs are on rows and columns.
36 *
37 * \todo fix names following name convention
38 *
39 */
40struct Problem {
41
42 EntityHandle meshset; ///< Problem meshset (on tag of this meshset all data
43 ///< related to problem are stored)
44 BitProblemId *tagId; ///< Unique problem ID
45 const char *tagName; ///< Problem name
46 int tagNameSize; ///< Size of problem name
47 BitFEId *tagBitFEId; ///< IDs of finite elements in problem
48 BitRefLevel *tagBitRefLevel; ///< BitRef level of finite elements in problem
49 BitRefLevel *tagBitRefLevelMask; ///< BItRefMask of elements in problem
50
51 mutable DofIdx nbDofsRow; ///< Global number of DOFs in row
52 mutable DofIdx nbDofsCol; ///< Global number of DOFs in col
53 mutable DofIdx nbLocDofsRow; ///< Local number of DOFs in row
54 mutable DofIdx nbLocDofsCol; ///< Local number of DOFs in colIs
55 mutable DofIdx nbGhostDofsRow; ///< Number of ghost DOFs in row
56 mutable DofIdx nbGhostDofsCol; ///< Number of ghost DOFs in col
57
58 mutable boost::shared_ptr<NumeredDofEntity_multiIndex>
59 numeredRowDofsPtr; ///< store DOFs on rows for this problem
60 mutable boost::shared_ptr<NumeredDofEntity_multiIndex>
61 numeredColDofsPtr; ///< store DOFs on columns for this problem
62 mutable boost::shared_ptr<NumeredEntFiniteElement_multiIndex>
63 numeredFiniteElementsPtr; ///< store finite elements
64
65 /**
66 * \brief get access to numeredRowDofsPtr storing DOFs on rows
67 */
68 inline auto &getNumeredRowDofsPtr() const { return numeredRowDofsPtr; }
69
70 /**
71 * \brief get access to numeredColDofsPtr storing DOFs on cols
72 */
73 inline auto &getNumeredColDofsPtr() const { return numeredColDofsPtr; }
74
75 /**
76 * \brief get access to reference for multi-index storing finite elements
77 */
78 inline const auto &getNumeredFiniteElementsPtr() const {
80 }
81
82 /**
83 * \brief Subproblem problem data
84 */
85 struct SubProblemData;
86
87 /**
88 * Pointer to data structure. This pointer has allocated data only for
89 * sub problems.
90 */
91 mutable boost::shared_ptr<SubProblemData> subProblemData;
92
93 /**
94 * \brief Get main problem of sub-problem is
95 * @return sub problem data structure
96 */
97 inline boost::shared_ptr<SubProblemData> &getSubData() const {
98 return subProblemData;
99 }
100
101 /**
102 * Pointer to data structure from which this problem is composed
103 */
104 mutable boost::shared_ptr<ComposedProblemsData> composedProblemsData;
105
106 /**
107 * \brief Het composed problems data structure
108 */
109 inline auto &getComposedProblemsData() const { return composedProblemsData; }
110
111 /**
112 * \brief get DOFs from problem
113 *
114 * Note that \e ent_dof_idx is not coefficient number, is local number of DOFs
115 * on the entity. The coefficient number and local index of DOFs or entity are
116 * the same on vertices and H1 approximation.
117 *
118 * @param field_bit_number field name field_bit_number = (use
119 * m_field.get_field_bit_number(field_name);
120 * @param ent entity handle
121 * @param ent_dof_idx index of DOFs on entity
122 * @param row_or_col ROW or COL
123 * @param dof_ptr shared pointer to DOFs if found
124 * @return error code
125 */
127 const int field_bit_number, const EntityHandle ent, const int ent_dof_idx,
128 const RowColData row_or_col,
129 boost::shared_ptr<NumeredDofEntity> &dof_ptr) const;
130
131/**
132 * \brief use with loops to iterate row DOFs
133 * \ingroup problems_multi_indices
134 *
135 * \code
136 * for(_IT_NUMEREDDOF_ROW_FOR_LOOP_(PROBLEMPTR,IT)) {
137 * ...
138 * }
139 * \endcode
140 *
141 */
142#define _IT_NUMEREDDOF_ROW_FOR_LOOP_(PROBLEMPTR, IT) \
143 NumeredDofEntity_multiIndex::iterator IT = \
144 PROBLEMPTR->getNumeredRowDofsBegin(); \
145 IT != PROBLEMPTR->getNumeredRowDofsEnd(); \
146 IT++
147
148/**
149 * use with loops to iterate col DOFs
150 * \ingroup problems_multi_indices
151 *
152 * \code
153 * for(_IT_NUMEREDDOF_COL_FOR_LOOP_(PROBLEMPTR,IT)) {
154 * ...
155 * }
156 * \endcode
157 *
158 */
159#define _IT_NUMEREDDOF_COL_FOR_LOOP_(PROBLEMPTR, IT) \
160 NumeredDofEntity_multiIndex::iterator IT = \
161 PROBLEMPTR->getNumeredColDofsBegin(); \
162 IT != PROBLEMPTR->getNumeredColDofsEnd(); \
163 IT++
164
165 /// get begin iterator for numeredRowDofsPtr (insted you can use
166 /// #_IT_NUMEREDDOFMOFEMENTITY_ROW_FOR_LOOP_ for loops)
167 NumeredDofEntity_multiIndex::iterator getNumeredRowDofsBegin() const {
168 return numeredRowDofsPtr->begin();
169 }
170
171 /// get end iterator for numeredRowDofsPtr (insted you can use
172 /// #_IT_NUMEREDDOFMOFEMENTITY_ROW_FOR_LOOP_ for loops)
173 NumeredDofEntity_multiIndex::iterator getNumeredRowDofsEnd() const {
174 return numeredRowDofsPtr->end();
175 }
176
177 /// get begin iterator for numeredColDofsPtr (insted you can use
178 /// #_IT_NUMEREDDOFMOFEMENTITY_COL_FOR_LOOP_ for loops)
179 NumeredDofEntity_multiIndex::iterator getNumeredColDofsBegin() const {
180 return numeredColDofsPtr->begin();
181 }
182
183 /// get end iterator for numeredColDofsPtr (insted you can use
184 /// #_IT_NUMEREDDOFMOFEMENTITY_COL_FOR_LOOP_ for loops)
185 NumeredDofEntity_multiIndex::iterator getNumeredColDofsEnd() const {
186 return numeredColDofsPtr->end();
187 }
188
189/**
190 * \brief use with loops to iterate row DOFs
191 * \ingroup problems_multi_indices
192 *
193 * \code
194 * for(_IT_NUMEREDDOF_ROW_BY_LOCIDX_FOR_LOOP_(PROBLEMPTR,IT)) {
195 * ...
196 * }
197 * \endcode
198 *
199 */
200#define _IT_NUMEREDDOF_ROW_BY_LOCIDX_FOR_LOOP_(PROBLEMPTR, IT) \
201 NumeredDofEntityByLocalIdx::iterator IT = \
202 PROBLEMPTR->getNumeredRowDofsByLocIdxBegin(0); \
203 IT != PROBLEMPTR->getNumeredRowDofsByLocIdxEnd( \
204 PROBLEMPTR->getNbLocalDofsRow() - 1); \
205 IT++
206
207/**
208 * \brief use with loops to iterate col DOFs
209 *
210 * \code
211 * for(_IT_NUMEREDDOF_COL_BY_LOCIDX_FOR_LOOP_(PROBLEMPTR,IT)) {
212 * ...
213 * }
214 * \endcode
215 *
216 */
217#define _IT_NUMEREDDOF_COL_BY_LOCIDX_FOR_LOOP_(PROBLEMPTR, IT) \
218 NumeredDofEntityByUId::iterator IT = \
219 PROBLEMPTR->getNumeredColDofsByLocIdxBegin(0); \
220 IT != PROBLEMPTR->getNumeredColDofsByLocIdxEnd( \
221 PROBLEMPTR->getNbLocalDofsRow() - 1); \
222 IT++
223
224 /// get begin iterator for numeredRowDofsPtr (insted you can use
225 /// #_IT_NUMEREDDOF_ROW_FOR_LOOP_ for loops)
226 auto getNumeredRowDofsByLocIdxBegin(const DofIdx locidx) const {
227 return numeredRowDofsPtr->get<PetscLocalIdx_mi_tag>().lower_bound(locidx);
228 }
229
230 /// get end iterator for numeredRowDofsPtr (insted you can use
231 /// #_IT_NUMEREDDOF_ROW_FOR_LOOP_ for loops)
232 auto getNumeredRowDofsByLocIdxEnd(const DofIdx locidx) const {
233 return numeredRowDofsPtr->get<PetscLocalIdx_mi_tag>().upper_bound(locidx);
234 }
235
236 /// get begin iterator for numeredColDofsPtr (insted you can use
237 /// #_IT_NUMEREDDOF_COL_FOR_LOOP_ for loops)
238 auto getNumeredColDofsByLocIdxBegin(const DofIdx locidx) const {
239 return numeredColDofsPtr->get<PetscLocalIdx_mi_tag>().lower_bound(locidx);
240 }
241
242 /// get end iterator for numeredColDofsPtr (insted you can use
243 /// #_IT_NUMEREDDOF_COL_FOR_LOOP_ for loops)
244 auto getNumeredColDofsByLocIdxEnd(const DofIdx locidx) const {
245 return numeredColDofsPtr->get<PetscLocalIdx_mi_tag>().upper_bound(locidx);
246 }
247
248/**
249 * \brief use with loops to iterate row DOFs
250 * \ingroup problems_multi_indices
251 *
252 * \code
253 * for(_IT_NUMEREDDOF_BY_ENT_ROW_FOR_LOOP_(PROBLEMPTR,ENT,IT)) {
254 * ...
255 * }
256 * \endcode
257 *
258 */
259#define _IT_NUMEREDDOF_ROW_BY_ENT_FOR_LOOP_(PROBLEMPTR, ENT, IT) \
260 auto IT = PROBLEMPTR->getNumeredRowDofsByEntBegin(ENT); \
261 IT != PROBLEMPTR->getNumeredRowDofsByEntEnd(ENT); \
262 IT++
263
264/**
265 * \brief use with loops to iterate col DOFs
266 * \ingroup problems_multi_indices
267 *
268 * \code
269 * for(_IT_NUMEREDDOF_COL_BY_ENT_FOR_LOOP_(PROBLEMPTR,ENT,IT)) {
270 * ...
271 * }
272 * \endcode
273 *
274 */
275#define _IT_NUMEREDDOF_COL_BY_ENT_FOR_LOOP_(PROBLEMPTR, ENT, IT) \
276 auto IT = PROBLEMPTR->getNumeredColDofsByEntBegin(ENT); \
277 IT != PROBLEMPTR->getNumeredColDofsByEntEnd(ENT); \
278 IT++
279
280 /// get begin iterator for numeredRowDofsPtr (insted you can use
281 /// #_IT_NUMEREDDOF_ROW_BY_ENT_FOR_LOOP_ for loops)
283 return numeredRowDofsPtr->get<Ent_mi_tag>().lower_bound(ent);
284 }
285
286 /// get end iterator for numeredRowDofsPtr (insted you can use
287 /// #_IT_NUMEREDDOF_ROW_BY_ENT_FOR_LOOP_ for loops)
289 return numeredRowDofsPtr->get<Ent_mi_tag>().upper_bound(ent);
290 }
291
292 /// get begin iterator for numeredColDofsPtr (insted you can use
293 /// #_IT_NUMEREDDOF_COL_BY_ENT_FOR_LOOP_ for loops)
295 return numeredColDofsPtr->get<Ent_mi_tag>().lower_bound(ent);
296 }
297
298 /// get end iterator for numeredColDofsPtr (insted you can use
299 /// #_IT_NUMEREDDOF_COL_BY_ENT_FOR_LOOP_ for loops)
301 return numeredColDofsPtr->get<Ent_mi_tag>().upper_bound(ent);
302 }
303
304/**
305 * use with loops to iterate row DOFs
306 * \ingroup problems_multi_indices
307 *
308 * \code
309 * for(_IT_NUMEREDDOF_BY_NAME_ROW_FOR_LOOP_(PROBLEMPTR,m_field.get_field_bit_number(FIELD_BIT_NUMBER),IT))
310 * {
311 * ...
312 * }
313 * \endcode
314 *
315 */
316#define _IT_NUMEREDDOF_ROW_BY_BITNUMBER_FOR_LOOP_(PROBLEMPTR, \
317 FIELD_BIT_NUMBER, IT) \
318 auto IT = PROBLEMPTR->numeredRowDofsPtr->lower_bound( \
319 FieldEntity::getLoBitNumberUId(FIELD_BIT_NUMBER)); \
320 IT != PROBLEMPTR->numeredRowDofsPtr->upper_bound( \
321 FieldEntity::getHiBitNumberUId(FIELD_BIT_NUMBER)); \
322 IT++
323
324/**
325 * \brief use with loops to iterate col DOFs
326 * \ingroup problems_multi_indices
327 *
328 * \code
329 * for(_IT_NUMEREDDOF_COL_BY_BITNUMBER_FOR_LOOP_(PROBLEMPTR,m_field.get_field_bit_number(FIELD_BIT_NUMBER),IT))
330 * {
331 * ...
332 * }
333 * \endcode
334 *
335 */
336#define _IT_NUMEREDDOF_COL_BY_BITNUMBER_FOR_LOOP_(PROBLEMPTR, \
337 FIELD_BIT_NUMBER, IT) \
338 auto IT = PROBLEMPTR->numeredColDofsPtr->lower_bound( \
339 FieldEntity::getLoBitNumberUId(FIELD_BIT_NUMBER)); \
340 IT != PROBLEMPTR->numeredColDofsPtr->upper_bound( \
341 FieldEntity::getHiBitNumberUId(FIELD_BIT_NUMBER)); \
342 IT++
343
344 Problem(Interface &moab, const EntityHandle meshset);
345
346 virtual ~Problem() = default;
347
348 inline BitProblemId getId() const { return *((BitProblemId *)tagId); }
349
350 inline auto getName() const {
351 return std::string((char *)tagName, tagNameSize);
352 }
353
354 inline DofIdx getNbDofsRow() const { return nbDofsRow; }
355 inline DofIdx getNbDofsCol() const { return nbDofsCol; }
356 inline DofIdx getNbLocalDofsRow() const { return nbLocDofsRow; }
357 inline DofIdx getNbLocalDofsCol() const { return nbLocDofsCol; }
358 inline DofIdx getNbGhostDofsRow() const { return nbGhostDofsRow; }
359 inline DofIdx getNbGhostDofsCol() const { return nbGhostDofsCol; }
360
361 inline BitRefLevel getBitRefLevel() const { return *tagBitRefLevel; }
363
364 // DEPRECATED inline BitRefLevel getMaskBitRefLevel() const {
365 // return *tagBitRefLevelMask;
366 // }
367
368 /**
369 * @brief Get the Row Dofs By Petsc Global Dof Idx object
370 *
371 * @param idx
372 * @param dof_ptr
373 * @param bh
374 * @return MoFEMErrorCode
375 */
377 const NumeredDofEntity **dof_ptr,
378 MoFEMTypes bh = MF_EXIST) const;
379
380 /**
381 * @brief Get the Col Dofs By Petsc Global Dof Idx object
382 *
383 * @param idx
384 * @param dof_ptr
385 * @param bh
386 * @return MoFEMErrorCode
387 */
389 const NumeredDofEntity **dof_ptr,
390 MoFEMTypes bh = MF_EXIST) const;
391
392 /**
393 * @brief Get the Row Dofs By Petsc Global Dof Idx object
394 *
395 * @param idx
396 * @return boost::weak_ptr<NumeredDofEntity>
397 */
398 boost::weak_ptr<NumeredDofEntity>
400
401 /**
402 * @brief Get the Col Dofs By Petsc Global Dof Idx object
403 *
404 * @param idx
405 * @return boost::weak_ptr<NumeredDofEntity>
406 */
407 boost::weak_ptr<NumeredDofEntity>
409
410 BitFEId getBitFEId() const;
411
412 friend std::ostream &operator<<(std::ostream &os, const Problem &e);
413
414 /**
415 * \brief Get number of finite elements by name on processors
416 *
417 * Size retuned IS is equal to size of processors.
418 *
419 * What PetscLayout see,
420 <http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/IS/index.html>
421 *
422 * Example of usage for layout
423 * \code
424
425 PetscInt rstart, rend;
426 ierr = PetscLayoutGetRange(layout, &rstart, &rend); CHKERRG(ierr);
427 int global_size;
428 ierr = PetscLayoutGetSize(layout,&global_size); CHKERRG(ierr);
429
430 \endcode
431 *
432 * @param comm Communicator
433 * @param name Finite element name
434 * @param layout Get number of elements on each processor
435 * @return error code
436 */
438 const std::string name,
439 PetscLayout *layout) const;
440
441 /**
442 * \brief Get number of finite elements on processors
443 *
444 * Size retuned IS is equal to size of processors.
445 *
446 * What PetscLayout see,
447 <http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/IS/index.html>
448 *
449 * Example of usage for layout
450 * \code
451
452 PetscInt rstart, rend;
453 ierr = PetscLayoutGetRange(layout, &rstart, &rend); CHKERRG(ierr);
454 int global_size;
455 ierr = PetscLayoutGetSize(layout,&global_size); CHKERRG(ierr);
456
457 \endcode
458 *
459 * @param comm Communicator
460 * @param layout Get number of elements on each processor
461 * @return error code
462 */
464 PetscLayout *layout) const;
465
466 typedef multi_index_container<boost::weak_ptr<std::vector<NumeredDofEntity>>,
467 indexed_by<sequenced<>>>
469
470 /**
471 * \brief Get reference to sequence data numbered dof container
472 *
473 * In sequence data container data are physically stored. The purpose of this
474 * is to allocate NumeredDofEntity data in bulk, having only one allocation
475 instead
476 * each time entity is inserted. That makes code efficient.
477 *
478 * The vector in sequence is destroyed if last entity inside that vector is
479 * destroyed. All MoFEM::NumeredDofEntity have aliased shared_ptr which points
480 to the vector.
481
482 * @return MoFEM::Problem::SequenceDofContainer
483 */
484 inline auto &getRowDofsSequence() const { return sequenceRowDofContainer; }
485
486 /**
487 * \brief Get reference to sequence data numbered dof container
488 *
489 * In sequence data container data are physically stored. The purpose of this
490 * is to allocate NumeredDofEntity data in bulk, having only one allocation
491 instead
492 * each time entity is inserted. That makes code efficient.
493 *
494 * The vector in sequence is destroyed if last entity inside that vector is
495 * destroyed. All MoFEM::NumeredDofEntity have aliased shared_ptr which points
496 to the vector.
497
498 * @return MoFEM::Problem::SequenceDofContainer
499 */
500 inline auto &getColDofsSequence() const { return sequenceColDofContainer; }
501
502 using EmptyFieldBlocks = std::pair<BitFieldId, BitFieldId>;
503
504 /**
505 * @brief Get the empty field blocks
506 *
507 * Emtpy field blocks is a pair contains IDs of the fields for which matrix
508 * has zero entries.
509 *
510 * @return EmptyFieldBlocks&
511 */
513 return emptyFieldBlocks;
514 }
515
516 /**
517 * @brief Add fields to the empty field blocks
518 *
519 * Emtpy field blocks is a pair contains IDs of the fields for which matrix
520 * has zero entries.
521 *
522 * @param add_fields
523 * @return EmptyFieldBlocks&
524 */
525 inline EmptyFieldBlocks &
527 emptyFieldBlocks.first |= add_fields.first;
528 emptyFieldBlocks.second |= add_fields.second;
529 return emptyFieldBlocks;
530 }
531
532private:
533 // Keep vector of DoFS on entity
534 mutable boost::shared_ptr<SequenceDofContainer> sequenceRowDofContainer;
535 mutable boost::shared_ptr<SequenceDofContainer> sequenceColDofContainer;
536
538};
539
541
542/**
543 * \brief Subproblem problem data
544 */
546
548 rowIs; ///< indices of main problem of which sub problem is this
550 colIs; ///< indices of main problem of which sub problem is this
552 rowMap; ///< mapping form main problem indices to sub-problem indices
554 colMap; ///< mapping form main problem indices to sub-problem indices
555
556 inline auto getSmartRowIs() { return rowIs; }
557 inline auto getSmartColIs() { return colIs; }
558 inline auto getSmartRowMap() { return rowMap; }
559 inline auto getSmartColMap() { return colMap; }
560
561 /**
562 * get row Is for sub problem
563 * @param is create is
564 * @return error code
565 */
566 inline MoFEMErrorCode getRowIs(IS *is) {
568 PetscObjectReference((PetscObject)rowIs);
569 *is = rowIs;
571 }
572
573 /**
574 * get col Is for sub problem
575 * @param is create is
576 * @return error code
577 */
578 inline MoFEMErrorCode getColIs(IS *is) {
580 PetscObjectReference((PetscObject)colIs);
581 *is = colIs;
583 };
584
585 /**
586 * get row AO mapping for sub problem
587 * @param ao get mapping
588 * @return error code
589 */
590 inline MoFEMErrorCode getRowMap(AO *ao) {
592 PetscObjectReference((PetscObject)rowMap);
593 *ao = rowMap;
595 }
596
597 /**
598 * get col AO mapping for sub problem
599 * @param ao get mapping
600 * @return error code
601 */
602 inline MoFEMErrorCode getColMap(AO *ao) {
604 PetscObjectReference((PetscObject)colMap);
605 *ao = colMap;
607 }
608
609 SubProblemData() = default;
610 virtual ~SubProblemData() = default;
611};
612
614
615/**
616 * @relates multi_index_container
617 * \brief MultiIndex for entities for Problem
618 * \ingroup fe_multi_indices
619 */
620typedef multi_index_container<
621 Problem,
622 indexed_by<
623 ordered_unique<tag<Meshset_mi_tag>,
624 member<Problem, EntityHandle, &Problem::meshset>>,
625 hashed_unique<tag<BitProblemId_mi_tag>,
626 const_mem_fun<Problem, BitProblemId, &Problem::getId>,
628 hashed_unique<tag<Problem_mi_tag>,
629 const_mem_fun<Problem, std::string, &Problem::getName>>>>
631
632/** \brief add ref level to problem
633 * \ingroup problems_multi_indices
634 */
638 void operator()(Problem &p) { *(p.tagBitRefLevel) |= bit; };
639};
640
641/** \brief set ref level to problem
642 * \ingroup problems_multi_indices
643 */
647 void operator()(Problem &p) { *(p.tagBitRefLevel) = bit; };
648};
649
650/** \brief set prof dof bit ref mask
651 * \ingroup problems_multi_indices
652 */
656 void operator()(Problem &p) { *(p.tagBitRefLevelMask) = bit; };
657};
658
659/** \brief add finite element to problem
660 * \ingroup problems_multi_indices
661 */
665 void operator()(Problem &p);
666};
667
668/** \brief set prof dof bit ref mask
669 * \ingroup problems_multi_indices
670 */
674 void operator()(Problem &p) { *(p.tagBitRefLevelMask) |= bit; };
675};
676
677/** \brief remove finite element from problem
678 * \ingroup problems_multi_indices
679 */
683 void operator()(Problem &p);
684};
685
686/** \brief zero nb. of DOFs in row
687 * \ingroup problems_multi_indices
688 */
690 void operator()(Problem &e);
691};
692
693/** \brief zero nb. of DOFs in col
694 * \ingroup problems_multi_indices
695 */
697 void operator()(Problem &e);
698};
699
700/** \brief clear problem finite elements
701 * \ingroup problems_multi_indices
702 */
704 void operator()(Problem &e);
705};
706
707/**
708 * \brief Clear sub-problem data structure
709 */
711 void operator()(Problem &e) { e.subProblemData.reset(); }
712};
713
714/**
715 * \brief Clear composed problem data structure
716 */
719};
720
721inline MoFEMErrorCode
722ComposedProblemsData::getRowIs(IS *is, const unsigned int pp) const {
724 PetscObjectReference((PetscObject)rowIs[pp]);
725 if (pp <= rowIs.size()) {
726 SETERRQ1(PETSC_COMM_WORLD, MOFEM_INVALID_DATA, "Exceed size of array pp<%d",
727 rowIs.size());
728 }
729 *is = rowIs[pp];
731}
732
733inline MoFEMErrorCode
734ComposedProblemsData::getColIs(IS *is, const unsigned int pp) const {
736 PetscObjectReference((PetscObject)colIs[pp]);
737 if (pp <= colIs.size()) {
738 SETERRQ1(PETSC_COMM_WORLD, MOFEM_INVALID_DATA, "Exceed size of array pp<%d",
739 colIs.size());
740 }
741 *is = colIs[pp];
743}
744
745} // namespace MoFEM
746
747#endif //__PROBLEMSMULTIINDICES_HPP__
748
749/**
750 * \defgroup problems_multi_indices Problems structures and multi-indices
751 * \ingroup mofem
752 ******************************************************************************/
static Index< 'p', 3 > p
RowColData
RowColData.
Definition: definitions.h:123
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
Definition: definitions.h:97
@ MF_EXIST
Definition: definitions.h:100
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
@ MOFEM_INVALID_DATA
Definition: definitions.h:36
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
multi_index_container< Problem, indexed_by< ordered_unique< tag< Meshset_mi_tag >, member< Problem, EntityHandle, &Problem::meshset > >, hashed_unique< tag< BitProblemId_mi_tag >, const_mem_fun< Problem, BitProblemId, &Problem::getId >, HashBit< BitProblemId >, EqBit< BitProblemId > >, hashed_unique< tag< Problem_mi_tag >, const_mem_fun< Problem, std::string, &Problem::getName > > > > Problem_multiIndex
MultiIndex for entities for Problem.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
Definition: Types.hpp:43
int DofIdx
Index of DOF.
Definition: Types.hpp:18
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Problem Id.
Definition: Types.hpp:44
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:40
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
Problem::EmptyFieldBlocks EmptyFieldBlocks
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1975
std::vector< const Problem * > rowProblemsAdd
MoFEMErrorCode getRowIs(IS *is, const unsigned int pp) const
MoFEMErrorCode getColIs(IS *is, const unsigned int pp) const
std::vector< const Problem * > colProblemsAdd
keeps information about indexed dofs for the problem
SmartPetscObj< AO > rowMap
mapping form main problem indices to sub-problem indices
virtual ~SubProblemData()=default
SmartPetscObj< IS > rowIs
indices of main problem of which sub problem is this
SmartPetscObj< AO > colMap
mapping form main problem indices to sub-problem indices
SmartPetscObj< IS > colIs
indices of main problem of which sub problem is this
ProblemChangeRefLevelBitAdd(const BitRefLevel _bit)
ProblemChangeRefLevelBitDofMaskAdd(const BitRefLevel _bit)
ProblemChangeRefLevelBitDofMaskSet(const BitRefLevel _bit)
ProblemChangeRefLevelBitSet(const BitRefLevel _bit)
Clear composed problem data structure.
Clear sub-problem data structure.
remove finite element from problem
keeps basic data about problem
MoFEMErrorCode getNumberOfElementsByPart(MPI_Comm comm, PetscLayout *layout) const
Get number of finite elements on processors.
auto getNumeredRowDofsByEntBegin(const EntityHandle ent) const
NumeredDofEntity_multiIndex::iterator getNumeredRowDofsBegin() const
auto getNumeredRowDofsByLocIdxBegin(const DofIdx locidx) const
auto getNumeredColDofsByLocIdxEnd(const DofIdx locidx) const
DofIdx getNbLocalDofsRow() const
MoFEMErrorCode getNumberOfElementsByNameAndPart(MPI_Comm comm, const std::string name, PetscLayout *layout) const
Get number of finite elements by name on processors.
DofIdx getNbDofsRow() const
const char * tagName
Problem name.
BitRefLevel getBitRefLevel() const
boost::shared_ptr< SequenceDofContainer > sequenceColDofContainer
BitProblemId * tagId
Unique problem ID.
auto & getColDofsSequence() const
Get reference to sequence data numbered dof container.
std::pair< BitFieldId, BitFieldId > EmptyFieldBlocks
MoFEMErrorCode getDofByNameEntAndEntDofIdx(const int field_bit_number, const EntityHandle ent, const int ent_dof_idx, const RowColData row_or_col, boost::shared_ptr< NumeredDofEntity > &dof_ptr) const
get DOFs from problem
virtual ~Problem()=default
auto getNumeredColDofsByEntEnd(const EntityHandle ent) const
BitRefLevel getBitRefLevelMask() const
auto getNumeredRowDofsByEntEnd(const EntityHandle ent) const
EmptyFieldBlocks & getEmptyFieldBlocks() const
Get the empty field blocks.
boost::shared_ptr< SubProblemData > & getSubData() const
Get main problem of sub-problem is.
DofIdx nbGhostDofsCol
Number of ghost DOFs in col.
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredRowDofsPtr
store DOFs on rows for this problem
EmptyFieldBlocks & addFieldToEmptyFieldBlocks(const EmptyFieldBlocks add_fields) const
Add fields to the empty field blocks.
boost::shared_ptr< NumeredEntFiniteElement_multiIndex > numeredFiniteElementsPtr
store finite elements
NumeredDofEntity_multiIndex::iterator getNumeredRowDofsEnd() const
auto getNumeredColDofsByLocIdxBegin(const DofIdx locidx) const
friend std::ostream & operator<<(std::ostream &os, const Problem &e)
boost::shared_ptr< SequenceDofContainer > sequenceRowDofContainer
MoFEMErrorCode getRowDofsByPetscGlobalDofIdx(DofIdx idx, const NumeredDofEntity **dof_ptr, MoFEMTypes bh=MF_EXIST) const
Get the Row Dofs By Petsc Global Dof Idx object.
boost::shared_ptr< ComposedProblemsData > composedProblemsData
const auto & getNumeredFiniteElementsPtr() const
get access to reference for multi-index storing finite elements
DofIdx getNbGhostDofsCol() const
EmptyFieldBlocks emptyFieldBlocks
auto getNumeredColDofsByEntBegin(const EntityHandle ent) const
DofIdx nbLocDofsRow
Local number of DOFs in row.
BitFEId getBitFEId() const
BitProblemId getId() const
DofIdx nbDofsCol
Global number of DOFs in col.
auto & getComposedProblemsData() const
Het composed problems data structure.
DofIdx getNbDofsCol() const
DofIdx getNbLocalDofsCol() const
DofIdx nbGhostDofsRow
Number of ghost DOFs in row.
auto & getNumeredColDofsPtr() const
get access to numeredColDofsPtr storing DOFs on cols
boost::shared_ptr< SubProblemData > subProblemData
DofIdx nbLocDofsCol
Local number of DOFs in colIs.
int tagNameSize
Size of problem name.
MoFEMErrorCode getColDofsByPetscGlobalDofIdx(DofIdx idx, const NumeredDofEntity **dof_ptr, MoFEMTypes bh=MF_EXIST) const
Get the Col Dofs By Petsc Global Dof Idx object.
BitFEId * tagBitFEId
IDs of finite elements in problem.
BitRefLevel * tagBitRefLevelMask
BItRefMask of elements in problem.
NumeredDofEntity_multiIndex::iterator getNumeredColDofsEnd() const
DofIdx nbDofsRow
Global number of DOFs in row.
DofIdx getNbGhostDofsRow() const
multi_index_container< boost::weak_ptr< std::vector< NumeredDofEntity > >, indexed_by< sequenced<> > > SequenceDofContainer
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredColDofsPtr
store DOFs on columns for this problem
BitRefLevel * tagBitRefLevel
BitRef level of finite elements in problem.
NumeredDofEntity_multiIndex::iterator getNumeredColDofsBegin() const
auto getNumeredRowDofsByLocIdxEnd(const DofIdx locidx) const
auto & getNumeredRowDofsPtr() const
get access to numeredRowDofsPtr storing DOFs on rows
auto & getRowDofsSequence() const
Get reference to sequence data numbered dof container.
intrusive_ptr for managing petsc objects