378 auto get_row_indices = [&]() ->
const VectorInt & {
379 if (
auto e_ptr = row_data.getFieldEntities()[0]) {
380 if (
auto stored_data_ptr =
381 e_ptr->getSharedStoragePtr<EssentialBcStorage>()) {
382 return stored_data_ptr->entityIndices;
385 return row_data.getIndices();
388 const auto &row_ind = get_row_indices();
389 const auto &col_ind = col_data.getIndices();
391 auto zero_rows_and_cols = [&](
auto &mat,
auto &row_ind,
auto &col_ind) {
393 for (
auto i = 0;
i < row_ind.size(); ++
i) {
394 for (
auto j = 0;
j < col_ind.size(); ++
j) {
395 if (row_ind[
i] < 0 || col_ind[
j] < 0)
399 if (row_data.getFieldEntities()[0]->getLocalUniqueId() ==
400 col_data.getFieldEntities()[0]->getLocalUniqueId()) {
401 for (
auto i = 0;
i < row_ind.size(); ++
i) {
402 for (
auto j = 0;
j < col_ind.size(); ++
j) {
403 if (
i ==
j && row_ind[
i] < 0 && col_ind[
j] < 0) {
412 const auto nb_rows = row_ind.size();
413 const auto nb_cols = col_ind.size();
416 if (mat.size1() != nb_rows) {
418 "Wrong mat size %d != %d", mat.size1(), nb_rows);
420 if (mat.size2() != nb_cols) {
422 "Wrong mat size %d != %d", mat.size2(), nb_cols);
427 auto get_uid = [](
auto &data) {
428 if (data.getFieldEntities().size() == 1) {
430 return data.getFieldEntities()[0]->getLocalUniqueId();
439 auto &uid0 = data.getFieldEntities()[0]->getLocalUniqueId();
445 for (
auto i = 1;
i < data.getFieldEntities().size(); ++
i) {
452 data.getFieldEntities()[
i]->getLocalUniqueId())
466 auto uid_row = get_uid(row_data);
467 auto uid_col = get_uid(col_data);
471 .find(boost::make_tuple(uid_row, uid_col));
503 auto asmb = [&](
auto &sm) {
504 sm.resize(nb_rows, nb_cols,
false);
508 asmb((*p.first)->getMat());
509 zero_rows_and_cols((*p.first)->getMat(), row_ind, col_ind);
511 auto add_indices = [](
auto &storage,
auto &
ind) {
512 storage.resize(
ind.size(),
false);
513 noalias(storage) =
ind;
516 add_indices((*p.first)->getRowInd(), row_ind);
517 add_indices((*p.first)->getColInd(), col_ind);
522 auto asmb = [&](
auto &sm) {
526 if (sm.size1() != nb_rows) {
528 "Wrong mat or storage size %d != %d", sm.size1(), nb_rows);
530 if (sm.size2() != nb_cols) {
532 "Wrong mat or storage size %d != %d", sm.size2(), nb_cols);
545 "Assembly type not implemented");
550 CHKERR asmb((*it)->getMat());
551 CHKERR zero_rows_and_cols((*it)->getMat(), row_ind, col_ind);