622 {
624
625#ifndef NDEBUG
627#endif
628
629
630
631 auto get_row_indices = [&]() ->
const VectorInt & {
632 if (auto e_ptr = row_data.getFieldEntities()[0]) {
633 if (auto stored_data_ptr =
634 e_ptr->getSharedStoragePtr<EssentialBcStorage>()) {
635 return stored_data_ptr->entityIndices;
636 }
637 }
638 return row_data.getIndices();
639 };
640
641 const auto &row_ind = get_row_indices();
642 const auto &col_ind = col_data.getIndices();
643
644 const auto nb_rows = row_ind.size();
645 const auto nb_cols = col_ind.size();
646
647#ifndef NDEBUG
648 if (mat.size1() != nb_rows) {
650 "Wrong mat size %zu != %zu", mat.size1(), nb_rows);
651 }
652 if (mat.size2() != nb_cols) {
654 "Wrong mat size %zu != %zu", mat.size2(), nb_cols);
655 }
656#endif
657
658
659 auto get_uid = [](auto &data) {
660 if (data.getFieldEntities().size() == 1) {
661
662 return data.getFieldEntities()[0]->getLocalUniqueId();
663
664 } else {
665
666
667
668
669
670
671 auto &uid0 = data.getFieldEntities()[0]->getLocalUniqueId();
676
677 for (
auto i = 1;
i < data.getFieldEntities().
size(); ++
i) {
678
679
681
682
684 data.getFieldEntities()[
i]->getLocalUniqueId())
685
686 );
687 }
688
690 field_id0,
691
693
694 );
695 }
696 };
697
698 auto uid_row = get_uid(row_data);
699 auto uid_col = get_uid(col_data);
700
703 .find(boost::make_tuple(uid_row, uid_col));
704
708
709
711
712
719 } else {
721 uid_row;
723 uid_col;
724 }
725
726
729#ifndef NDEBUG
730 if (!p.second) {
732 }
733#endif
734
735 auto asmb = [&](auto &sm) {
736 sm.resize(nb_rows, nb_cols, false);
737 noalias(sm) = mat;
738 };
739
740 asmb((*p.first)->getMat());
741
742 auto add_indices = [](
auto &storage,
auto &
ind) {
743 storage.resize(
ind.size(),
false);
744 noalias(storage) =
ind;
745 };
746
747 add_indices((*p.first)->getRowInd(), row_ind);
748 add_indices((*p.first)->getColInd(), col_ind);
749
750 } else {
751
752
753 auto asmb = [&](auto &sm) {
755
756#ifndef NDEBUG
757 if (sm.size1() != nb_rows) {
759 "Wrong mat or storage size %zu != %zu", sm.size1(), nb_rows);
760 }
761 if (sm.size2() != nb_cols) {
763 "Wrong mat or storage size %zu != %zu", sm.size2(), nb_cols);
764 }
765#endif
766
767 switch (iora) {
768 case ADD_VALUES:
769 sm += mat;
770 break;
771 case INSERT_VALUES:
772 noalias(sm) = mat;
773 break;
774 default:
776 "Assembly type not implemented");
777 }
779 };
780
781 CHKERR asmb((*it)->getMat());
782
783
784 }
785
786#ifndef NDEBUG
788#endif
789
791}
#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