247 {
248 return numeredRowDofsPtr->get<PetscLocalIdx_mi_tag>().lower_bound(locidx);
249 }
250
251
252
253 auto getNumeredRowDofsByLocIdxEnd(const DofIdx locidx) const {
254 return numeredRowDofsPtr->get<PetscLocalIdx_mi_tag>().upper_bound(locidx);
255 }
256
257
258
259 auto getNumeredColDofsByLocIdxBegin(const DofIdx locidx) const {
260 return numeredColDofsPtr->get<PetscLocalIdx_mi_tag>().lower_bound(locidx);
261 }
262
263
264
265 auto getNumeredColDofsByLocIdxEnd(const DofIdx locidx) const {
266 return numeredColDofsPtr->get<PetscLocalIdx_mi_tag>().upper_bound(locidx);
267 }
268
269
270
271
272
273
274
275
276
277
278
279
280#define _IT_NUMEREDDOF_ROW_BY_ENT_FOR_LOOP_(PROBLEMPTR, ENT, IT) \
281 auto IT = PROBLEMPTR->getNumeredRowDofsByEntBegin(ENT); \
282 IT != PROBLEMPTR->getNumeredRowDofsByEntEnd(ENT); \
283 IT++
284
285
286
287
288
289
290
291
292
293
294
295
296#define _IT_NUMEREDDOF_COL_BY_ENT_FOR_LOOP_(PROBLEMPTR, ENT, IT) \
297 auto IT = PROBLEMPTR->getNumeredColDofsByEntBegin(ENT); \
298 IT != PROBLEMPTR->getNumeredColDofsByEntEnd(ENT); \
299 IT++
300
301
302
303 auto getNumeredRowDofsByEntBegin(
const EntityHandle ent)
const {
304 return numeredRowDofsPtr->get<Ent_mi_tag>().lower_bound(ent);
305 }
306
307
308
309 auto getNumeredRowDofsByEntEnd(
const EntityHandle ent)
const {
310 return numeredRowDofsPtr->get<Ent_mi_tag>().upper_bound(ent);
311 }
312
313
314
315 auto getNumeredColDofsByEntBegin(
const EntityHandle ent)
const {
316 return numeredColDofsPtr->get<Ent_mi_tag>().lower_bound(ent);
317 }
318
319
320
321 auto getNumeredColDofsByEntEnd(
const EntityHandle ent)
const {
322 return numeredColDofsPtr->get<Ent_mi_tag>().upper_bound(ent);
323 }
324
325
326
327
328
329
330
331
332
333
334
335
336
337#define _IT_NUMEREDDOF_ROW_BY_BITNUMBER_FOR_LOOP_(PROBLEMPTR, \
338 FIELD_BIT_NUMBER, IT) \
339 auto IT = PROBLEMPTR->numeredRowDofsPtr->lower_bound( \
340 FieldEntity::getLoBitNumberUId(FIELD_BIT_NUMBER)); \
341 IT != PROBLEMPTR->numeredRowDofsPtr->upper_bound( \
342 FieldEntity::getHiBitNumberUId(FIELD_BIT_NUMBER)); \
343 IT++
344
345
346
347
348
349
350
351
352
353
354
355
356
357#define _IT_NUMEREDDOF_COL_BY_BITNUMBER_FOR_LOOP_(PROBLEMPTR, \
358 FIELD_BIT_NUMBER, IT) \
359 auto IT = PROBLEMPTR->numeredColDofsPtr->lower_bound( \
360 FieldEntity::getLoBitNumberUId(FIELD_BIT_NUMBER)); \
361 IT != PROBLEMPTR->numeredColDofsPtr->upper_bound( \
362 FieldEntity::getHiBitNumberUId(FIELD_BIT_NUMBER)); \
363 IT++
364
366
367 virtual ~Problem() = default;
368
370
371 inline auto getName() const {
372 return std::string((char *)tagName, tagNameSize);
373 }
374
375 inline DofIdx getNbDofsRow()
const {
return nbDofsRow; }
376 inline DofIdx getNbDofsCol()
const {
return nbDofsCol; }
377 inline DofIdx getNbLocalDofsRow()
const {
return nbLocDofsRow; }
378 inline DofIdx getNbLocalDofsCol()
const {
return nbLocDofsCol; }
379 inline DofIdx getNbGhostDofsRow()
const {
return nbGhostDofsRow; }
380 inline DofIdx getNbGhostDofsCol()
const {
return nbGhostDofsCol; }
381
382 inline BitRefLevel getBitRefLevel()
const {
return *tagBitRefLevel; }
383 inline BitRefLevel getBitRefLevelMask()
const {
return *tagBitRefLevelMask; }
384
385
386
387
388
389
390
391
392
393
394
395
396
398 const NumeredDofEntity **dof_ptr,
400
401
402
403
404
405
406
407
408
410 const NumeredDofEntity **dof_ptr,
412
413
414
415
416
417
418
419 boost::weak_ptr<NumeredDofEntity>
420 getRowDofsByPetscGlobalDofIdx(DofIdx idx) const;
421
422
423
424
425
426
427
428 boost::weak_ptr<NumeredDofEntity>
429 getColDofsByPetscGlobalDofIdx(DofIdx idx) const;
430
431
432
433
434
436
437 friend std::ostream &
operator<<(std::ostream &os,
const Problem &e);
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
463 const std::string name,
464 PetscLayout *layout) const;
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
489 PetscLayout *layout) const;
490
491 typedef multi_index_container<boost::weak_ptr<std::vector<NumeredDofEntity>>,
492 indexed_by<sequenced<>>>
493 SequenceDofContainer;
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509 inline auto &getRowDofsSequence() const { return sequenceRowDofContainer; }
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525 inline auto &getColDofsSequence() const { return sequenceColDofContainer; }
526
529
530
531
532
533
534
535
536
537
539 return emptyFieldBlocks;
540 }
541
542
543
544
545
546
547
548
549
550
552 addFieldToEmptyFieldBlocks(const BlockFieldPair add_fields) const {
553 emptyFieldBlocks.push_back(add_fields);
554 return emptyFieldBlocks.back();
555 }
556
557private:
558
559 mutable boost::shared_ptr<SequenceDofContainer> sequenceRowDofContainer;
560 mutable boost::shared_ptr<SequenceDofContainer> sequenceColDofContainer;
561
563};
564
567
568
569
570
571struct Problem::SubProblemData {
572
573 SmartPetscObj<IS>
574 rowIs;
575 SmartPetscObj<IS>
576 colIs;
577 SmartPetscObj<AO>
578 rowMap;
579 SmartPetscObj<AO>
580 colMap;
581
582 inline auto getSmartRowIs() { return rowIs; }
583 inline auto getSmartColIs() { return colIs; }
584 inline auto getSmartRowMap() { return rowMap; }
585 inline auto getSmartColMap() { return colMap; }
586
587
588
589
590
591
594 *is = rowIs;
595 PetscObjectReference((PetscObject)(*is));
597 }
598
599
600
601
602
603
606 *is = colIs;
607 PetscObjectReference((PetscObject)(*is));
609 };
610
611
612
613
614
615
618 *ao = rowMap;
619 PetscObjectReference((PetscObject)(*ao));
621 }
622
623
624
625
626
627
630 *ao = colMap;
631 PetscObjectReference((PetscObject)(*ao));
633 }
634
635 SubProblemData() = default;
636 virtual ~SubProblemData() = default;
637};
638
640
641
642
643
644
645
646typedef multi_index_container<
647 Problem,
648 indexed_by<
649 ordered_unique<tag<Meshset_mi_tag>,
650 member<Problem, EntityHandle, &Problem::meshset>>,
651 hashed_unique<tag<BitProblemId_mi_tag>,
652 const_mem_fun<Problem, BitProblemId, &Problem::getId>,
653 HashBit<BitProblemId>, EqBit<BitProblemId>>,
654 hashed_unique<tag<Problem_mi_tag>,
655 const_mem_fun<Problem, std::string, &Problem::getName>>>>
657
658
659
660
661struct ProblemChangeRefLevelBitAdd {
663 ProblemChangeRefLevelBitAdd(
const BitRefLevel _bit) :
bit(_bit){};
664 void operator()(Problem &p) { *(p.tagBitRefLevel) |=
bit; };
665};
666
667
668
669
670struct ProblemChangeRefLevelBitSet {
672 ProblemChangeRefLevelBitSet(
const BitRefLevel _bit) :
bit(_bit){};
673 void operator()(Problem &p) { *(p.tagBitRefLevel) =
bit; };
674};
675
676
677
678
679struct ProblemChangeRefLevelBitDofMaskSet {
681 ProblemChangeRefLevelBitDofMaskSet(
const BitRefLevel _bit) :
bit(_bit){};
682 void operator()(Problem &p) { *(p.tagBitRefLevelMask) =
bit; };
683};
684
685
686
687
688struct ProblemFiniteElementChangeBitAdd {
690 ProblemFiniteElementChangeBitAdd(const BitFEId _f_id) : f_id(_f_id){};
691 void operator()(Problem &p);
692};
693
694
695
696
697struct ProblemChangeRefLevelBitDofMaskAdd {
699 ProblemChangeRefLevelBitDofMaskAdd(
const BitRefLevel _bit) :
bit(_bit){};
700 void operator()(Problem &p) { *(p.tagBitRefLevelMask) |=
bit; };
701};
702
703
704
705
706struct ProblemFiniteElementChangeBitUnSet {
708 ProblemFiniteElementChangeBitUnSet(const BitFEId _f_id) : f_id(_f_id){};
709 void operator()(Problem &p);
710};
711
712
713
714
715struct ProblemZeroNbRowsChange {
716 void operator()(Problem &e);
717};
718
719
720
721
722struct ProblemZeroNbColsChange {
723 void operator()(Problem &e);
724};
725
726
727
728
729struct ProblemClearNumeredFiniteElementsChange {
730 void operator()(Problem &e);
731};
732
733
734
735
736struct ProblemClearSubProblemData {
737 void operator()(Problem &e) { e.subProblemData.reset(); }
738};
739
740
741
742
743struct ProblemClearComposedProblemData {
744 void operator()(Problem &e) { e.composedProblemsData.reset(); }
745};
746
748ComposedProblemsData::getRowIs(IS *is, const unsigned int pp) const {
750 if (pp <= rowIs.size()) {
752 rowIs.size());
753 }
754 *is = rowIs[pp].get();
755 PetscObjectReference((PetscObject)(*is));
757}
758
760ComposedProblemsData::getColIs(IS *is, const unsigned int pp) const {
762 if (pp <= colIs.size()) {
764 colIs.size());
765 }
766 *is = colIs[pp].get();
767 PetscObjectReference((PetscObject)(*is));
769}
770
771}
772
773#endif
774
775
776
777
778
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
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.
std::bitset< BITFEID_SIZE > BitFEId
Finite element Id.
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Problem Id.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
std::ostream & operator<<(std::ostream &os, const EntitiesFieldData::EntData &e)
Problem::EmptyFieldBlocks EmptyFieldBlocks
Problem::BlockFieldPair BlockFieldPair