318 {
321
322 if (
auto fe_method_ptr =
fePtr.lock()) {
323
326
327 const auto problem_name = fe_method_ptr->problemPtr->getName();
328
329 SmartPetscObj<IS> is_sum;
330
331 for (auto bc : bc_mng->getBcMapByBlockName()) {
332 if (auto disp_bc = bc.second->dispBcPtr) {
333
334 auto &bc_id = bc.first;
335
336 auto regex_str = (boost::format("%s_(.*)") % problem_name).str();
337 if (std::regex_match(bc_id, std::regex(regex_str))) {
338
341
343 << "Apply EssentialPreProc<DisplacementCubitBcData>: "
344 << problem_name <<
"_" <<
field_name <<
"_" << block_name;
345
346 const bool is_rotation =
347 disp_bc->data.flag4 || disp_bc->data.flag5 || disp_bc->data.flag6;
348
349 auto ents = bc.second->bcEnts;
350
351 std::array<SmartPetscObj<IS>, 3> is_xyz;
352 auto prb_name = fe_method_ptr->problemPtr->getName();
353
354 if (disp_bc->data.flag1 || is_rotation) {
355 CHKERR is_mng->isCreateProblemFieldAndRank(
357 }
358 if (disp_bc->data.flag2 || is_rotation) {
359 CHKERR is_mng->isCreateProblemFieldAndRank(
361 }
362 if (disp_bc->data.flag3 || is_rotation) {
363 CHKERR is_mng->isCreateProblemFieldAndRank(
365 }
366
367 auto get_is_sum = [](auto is1, auto is2) {
368 IS is;
370 return SmartPetscObj<IS>(is);
371 };
372
373 for (auto &is : is_xyz) {
374 if (is) {
375 if (!is_sum) {
376 is_sum = is;
377 } else {
378 is_sum = get_is_sum(is_sum, is);
379 }
380 }
381 }
382 }
383 }
384 }
385
386 if (is_sum) {
387 if (
auto fe_ptr =
fePtr.lock()) {
388 SmartPetscObj<Mat>
B =
389 vLhs ?
vLhs : SmartPetscObj<Mat>(fe_ptr->B,
true);
390
391 if ((*fe_ptr->matAssembleSwitch) && !
vLhs) {
392 if (*fe_ptr->matAssembleSwitch) {
393 CHKERR MatAssemblyBegin(
B, MAT_FINAL_ASSEMBLY);
394 CHKERR MatAssemblyEnd(
B, MAT_FINAL_ASSEMBLY);
395 *fe_ptr->matAssembleSwitch = false;
396 }
397 }
399 MOFEM_LOG(
"WORLD", Sev::noisy) <<
"Apply AO to IS";
400 CHKERR AOApplicationToPetscIS(
vAO, is_sum);
401 }
402
403 CHKERR MatZeroRowsColumnsIS(
B, is_sum,
vDiag, PETSC_NULL, PETSC_NULL);
404 }
405 }
406
407 } else {
409 "Can not lock shared pointer");
410 }
411
413}
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#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 MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
constexpr auto field_name
static std::pair< std::string, std::string > extractStringFromBlockId(const std::string block_id, const std::string prb_name)
Extract block name and block name form block id.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.