579 {
581
582#ifndef NDEBUG
584#endif
585
586
587
588 auto get_row_indices = [&]() ->
const VectorInt & {
589 if (auto e_ptr = row_data.getFieldEntities()[0]) {
590 if (auto stored_data_ptr =
591 e_ptr->getSharedStoragePtr<EssentialBcStorage>()) {
592 return stored_data_ptr->entityIndices;
593 }
594 }
595 return row_data.getIndices();
596 };
597
598 const auto &row_ind = get_row_indices();
599 const auto &col_ind = col_data.getIndices();
600
601 const auto nb_rows = row_ind.size();
602 const auto nb_cols = col_ind.size();
603
604#ifndef NDEBUG
605 if (mat.size1() != nb_rows) {
607 "Wrong mat size %zu != %zu", mat.size1(), nb_rows);
608 }
609 if (mat.size2() != nb_cols) {
611 "Wrong mat size %zu != %zu", mat.size2(), nb_cols);
612 }
613#endif
614
615
616 auto get_uid = [](auto &data) {
617 if (data.getFieldEntities().size() == 1) {
618
619 return data.getFieldEntities()[0]->getLocalUniqueId();
620
621 } else {
622
623
624
625
626
627
628 auto &uid0 = data.getFieldEntities()[0]->getLocalUniqueId();
633
634 for (
auto i = 1;
i < data.getFieldEntities().
size(); ++
i) {
635
636
638
639
641 data.getFieldEntities()[
i]->getLocalUniqueId())
642
643 );
644 }
645
647 field_id0,
648
650
651 );
652 }
653 };
654
655 auto uid_row = get_uid(row_data);
656 auto uid_col = get_uid(col_data);
657
658 auto it =
660 .find(boost::make_tuple(uid_row, uid_col));
661
662 if (it ==
664 .end()) {
665
666
668
669
676 } else {
678 uid_row;
680 uid_col;
681 }
682
683
686#ifndef NDEBUG
687 if (!p.second) {
689 }
690#endif
691
692 auto asmb = [&](auto &sm) {
693 sm.resize(nb_rows, nb_cols, false);
694 noalias(sm) = mat;
695 };
696
697 asmb((*p.first)->getMat());
698
699 auto add_indices = [](
auto &storage,
auto &
ind) {
700 storage.resize(
ind.size(),
false);
701 noalias(storage) =
ind;
702 };
703
704 add_indices((*p.first)->getRowInd(), row_ind);
705 add_indices((*p.first)->getColInd(), col_ind);
706
707 } else {
708
709
710 auto asmb = [&](auto &sm) {
712
713#ifndef NDEBUG
714 if (sm.size1() != nb_rows) {
716 "Wrong mat or storage size %zu != %zu", sm.size1(), nb_rows);
717 }
718 if (sm.size2() != nb_cols) {
720 "Wrong mat or storage size %zu != %zu", sm.size2(), nb_cols);
721 }
722#endif
723
724 switch (iora) {
725 case ADD_VALUES:
726 sm += mat;
727 break;
728 case INSERT_VALUES:
729 noalias(sm) = mat;
730 break;
731 default:
733 "Assembly type not implemented");
734 }
736 };
737
738 CHKERR asmb((*it)->getMat());
739
740
741 }
742
743#ifndef NDEBUG
745#endif
746
748}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
FTensor::Index< 'i', SPACE_DIM > i
UBlasMatrix< double > MatrixDouble
UBlasVector< int > VectorInt
auto type_from_handle(const EntityHandle h)
get type from entity handle
auto id_from_handle(const EntityHandle h)
auto ent_form_type_and_id(const EntityType type, const EntityID id)
get entity handle from type and id
static auto getHandleFromUniqueId(const UId uid)
Get the Handle From Unique Id.
static auto getFieldBitNumberFromUniqueId(const UId uid)
Get the Field Bit Number From Unique Id.
UId getLocalUniqueIdCalculate()
Get the Local Unique Id Calculate object.
static boost::ptr_vector< VectorInt > colIndices
static boost::ptr_vector< MatrixDouble > locMats
SchurElemMats(const size_t idx, const UId uid_row, const UId uid_col)
static size_t maxIndexCounter
static boost::ptr_vector< VectorInt > rowIndices
static boost::ptr_vector< SchurElemMats > schurElemMats
static SchurElemStorage schurL2Storage
static PetscLogEvent MOFEM_EVENT_schurMatSetValues