v0.14.0
Public Member Functions | Protected Attributes | List of all members
MoFEM::EssentialPostProcLhs< DisplacementCubitBcData > Struct Reference

Specialization for DisplacementCubitBcData. More...

#include <src/boundary_conditions/EssentialDisplacementCubitBcData.hpp>

Collaboration diagram for MoFEM::EssentialPostProcLhs< DisplacementCubitBcData >:
[legend]

Public Member Functions

 EssentialPostProcLhs (MoFEM::Interface &m_field, boost::shared_ptr< FEMethod > fe_ptr, double diag, SmartPetscObj< Mat > lhs=nullptr, SmartPetscObj< AO > ao=nullptr)
 
virtual ~EssentialPostProcLhs ()=default
 
MoFEMErrorCode operator() ()
 

Protected Attributes

MoFEM::InterfacemField
 
boost::weak_ptr< FEMethodfePtr
 
double vDiag
 
SmartPetscObj< Mat > vLhs
 
SmartPetscObj< AO > vAO
 

Detailed Description

Specialization for DisplacementCubitBcData.

Template Parameters
Examples
adolc_plasticity.cpp, plastic.cpp, and seepage.cpp.

Definition at line 134 of file EssentialDisplacementCubitBcData.hpp.

Constructor & Destructor Documentation

◆ EssentialPostProcLhs()

MoFEM::EssentialPostProcLhs< DisplacementCubitBcData >::EssentialPostProcLhs ( MoFEM::Interface m_field,
boost::shared_ptr< FEMethod fe_ptr,
double  diag,
SmartPetscObj< Mat >  lhs = nullptr,
SmartPetscObj< AO >  ao = nullptr 
)

Definition at line 313 of file EssentialDisplacementCubitBcData.cpp.

316  : mField(m_field), fePtr(fe_ptr), vDiag(diag), vLhs(lhs), vAO(ao) {}

◆ ~EssentialPostProcLhs()

Member Function Documentation

◆ operator()()

Definition at line 318 of file EssentialDisplacementCubitBcData.cpp.

318  {
319  MOFEM_LOG_CHANNEL("WORLD");
321 
322  if (auto fe_method_ptr = fePtr.lock()) {
323 
324  auto bc_mng = mField.getInterface<BcManager>();
325  auto is_mng = mField.getInterface<ISManager>();
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 
339  auto [field_name, block_name] =
340  BcManager::extractStringFromBlockId(bc_id, problem_name);
341 
342  MOFEM_LOG("WORLD", Sev::noisy)
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(
356  prb_name, ROW, field_name, 0, 0, is_xyz[0], &ents);
357  }
358  if (disp_bc->data.flag2 || is_rotation) {
359  CHKERR is_mng->isCreateProblemFieldAndRank(
360  prb_name, ROW, field_name, 1, 1, is_xyz[1], &ents);
361  }
362  if (disp_bc->data.flag3 || is_rotation) {
363  CHKERR is_mng->isCreateProblemFieldAndRank(
364  prb_name, ROW, field_name, 2, 2, is_xyz[2], &ents);
365  }
366 
367  auto get_is_sum = [](auto is1, auto is2) {
368  IS is;
369  CHK_THROW_MESSAGE(ISExpand(is1, is2, &is), "is sum");
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  // User is responsible for assembly if vLhs is provided
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  }
398  if (vAO) {
399  MOFEM_LOG("WORLD", Sev::noisy) << "Apply AO to IS";
400  CHKERR AOApplicationToPetscIS(vAO, is_sum);
401  }
402  // ISView(is_sum, PETSC_VIEWER_STDOUT_WORLD);
403  CHKERR MatZeroRowsColumnsIS(B, is_sum, vDiag, PETSC_NULL, PETSC_NULL);
404  }
405  }
406 
407  } else {
408  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
409  "Can not lock shared pointer");
410  }
411 
413 }

Member Data Documentation

◆ fePtr

boost::weak_ptr<FEMethod> MoFEM::EssentialPostProcLhs< DisplacementCubitBcData >::fePtr
protected

Definition at line 146 of file EssentialDisplacementCubitBcData.hpp.

◆ mField

Definition at line 145 of file EssentialDisplacementCubitBcData.hpp.

◆ vAO

Definition at line 149 of file EssentialDisplacementCubitBcData.hpp.

◆ vDiag

Definition at line 147 of file EssentialDisplacementCubitBcData.hpp.

◆ vLhs

Definition at line 148 of file EssentialDisplacementCubitBcData.hpp.


The documentation for this struct was generated from the following files:
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
MoFEM::BcManager::extractStringFromBlockId
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.
Definition: BcManager.cpp:1381
MOFEM_LOG_CHANNEL
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Definition: LogManager.hpp:284
CHK_THROW_MESSAGE
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
Definition: definitions.h:609
MoFEM::EssentialPostProcLhs< DisplacementCubitBcData >::fePtr
boost::weak_ptr< FEMethod > fePtr
Definition: EssentialDisplacementCubitBcData.hpp:146
MoFEM::EssentialPostProcLhs< DisplacementCubitBcData >::mField
MoFEM::Interface & mField
Definition: EssentialDisplacementCubitBcData.hpp:145
ROW
@ ROW
Definition: definitions.h:136
MoFEM::EssentialPostProcLhs< DisplacementCubitBcData >::vDiag
double vDiag
Definition: EssentialDisplacementCubitBcData.hpp:147
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::EssentialPostProcLhs< DisplacementCubitBcData >::vLhs
SmartPetscObj< Mat > vLhs
Definition: EssentialDisplacementCubitBcData.hpp:148
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
MoFEM::EssentialPostProcLhs< DisplacementCubitBcData >::vAO
SmartPetscObj< AO > vAO
Definition: EssentialDisplacementCubitBcData.hpp:149