349 {
351
352#ifndef NDEBUG
354#endif
355
356
357
358 auto get_row_indices = [&]() -> const VectorInt & {
359 if (auto e_ptr = row_data.getFieldEntities()[0]) {
360 if (auto stored_data_ptr =
361 e_ptr->getSharedStoragePtr<EssentialBcStorage>()) {
362 return stored_data_ptr->entityIndices;
363 }
364 }
365 return row_data.getIndices();
366 };
367
368 const auto &row_ind = get_row_indices();
369 const auto &col_ind = col_data.getIndices();
370
371 const auto nb_rows = row_ind.size();
372 const auto nb_cols = col_ind.size();
373
374#ifndef NDEBUG
375 if (mat.size1() != nb_rows) {
377 "Wrong mat size %ld != %ld", mat.size1(), nb_rows);
378 }
379 if (mat.size2() != nb_cols) {
381 "Wrong mat size %ld != %ld", mat.size2(), nb_cols);
382 }
383#endif
384
385
386 auto get_uid = [](auto &data) {
387 if (data.getFieldEntities().size() == 1) {
388
389 return data.getFieldEntities()[0]->getLocalUniqueId();
390
391 } else {
392
393
394
395
396
397
398 auto &uid0 = data.getFieldEntities()[0]->getLocalUniqueId();
403
404 for (
auto i = 1;
i < data.getFieldEntities().size(); ++
i) {
405
406
408
409
411 data.getFieldEntities()[
i]->getLocalUniqueId())
412
413 );
414 }
415
417 field_id0,
418
420
421 );
422 }
423 };
424
425 auto uid_row = get_uid(row_data);
426 auto uid_col = get_uid(col_data);
427
428 auto it =
430 .find(boost::make_tuple(uid_row, uid_col));
431
432 if (it ==
434 .end()) {
435
436
438
439
446 } else {
448 uid_row;
450 uid_col;
451 }
452
453
456#ifndef NDEBUG
457 if (!p.second) {
459 }
460#endif
461
462 auto asmb = [&](auto &sm) {
463 sm.resize(nb_rows, nb_cols, false);
464 noalias(sm) = mat;
465 };
466
467 asmb((*p.first)->getMat());
468
469 auto add_indices = [](
auto &storage,
auto &
ind) {
470 storage.resize(
ind.size(),
false);
471 noalias(storage) =
ind;
472 };
473
474 add_indices((*p.first)->getRowInd(), row_ind);
475 add_indices((*p.first)->getColInd(), col_ind);
476
477 } else {
478
479
480 auto asmb = [&](auto &sm) {
482
483#ifndef NDEBUG
484 if (sm.size1() != nb_rows) {
486 "Wrong mat or storage size %ld != %ld", sm.size1(), nb_rows);
487 }
488 if (sm.size2() != nb_cols) {
490 "Wrong mat or storage size %ld != %ld", sm.size2(), nb_cols);
491 }
492#endif
493
494 switch (iora) {
495 case ADD_VALUES:
496 sm += mat;
497 break;
498 case INSERT_VALUES:
499 noalias(sm) = mat;
500 break;
501 default:
503 "Assembly type not implemented");
504 }
506 };
507
508 CHKERR asmb((*it)->getMat());
509
510
511 }
512
513#ifndef NDEBUG
515#endif
516
518}
#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
static size_t maxIndexCounter
static boost::ptr_vector< VectorInt > rowIndices
static boost::ptr_vector< SchurElemMats > schurElemMats
static SchurElemStorage schurL2Storage
static PetscLogEvent MOFEM_EVENT_schurMatSetValues