v0.13.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
MoFEM::EssentialPreProc< DisplacementCubitBcData > Struct Reference

Specialization for DisplacementCubitBcData. More...

#include <src/boundary_conditions/EssentialDisplacementCubitBcData.hpp>

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

Public Member Functions

 EssentialPreProc (MoFEM::Interface &m_field, boost::shared_ptr< FEMethod > fe_ptr, std::vector< boost::shared_ptr< ScalingMethod > > smv, bool get_coords=false)
 
MoFEMErrorCode operator() ()
 

Protected Attributes

MoFEM::InterfacemField
 
boost::weak_ptr< FEMethodfePtr
 
VecOfTimeScalingMethods vecOfTimeScalingMethods
 
bool getCoords
 

Detailed Description

Specialization for DisplacementCubitBcData.

Specialization to enforce blocksets which DisplacementCubitBcData ptr. That is to enforce displacement constraints. set

Template Parameters

Definition at line 24 of file EssentialDisplacementCubitBcData.hpp.

Constructor & Destructor Documentation

◆ EssentialPreProc()

MoFEM::EssentialPreProc< DisplacementCubitBcData >::EssentialPreProc ( MoFEM::Interface m_field,
boost::shared_ptr< FEMethod fe_ptr,
std::vector< boost::shared_ptr< ScalingMethod > >  smv,
bool  get_coords = false 
)

Member Function Documentation

◆ operator()()

Definition at line 21 of file EssentialDisplacementCubitBcData.cpp.

21 {
22 MOFEM_LOG_CHANNEL("WORLD");
24
25 if (auto fe_method_ptr = fePtr.lock()) {
26
27 auto bc_mng = mField.getInterface<BcManager>();
28 auto fb = mField.getInterface<FieldBlas>();
29 const auto problem_name = fe_method_ptr->problemPtr->getName();
30
31 for (auto bc : bc_mng->getBcMapByBlockName()) {
32 if (auto disp_bc = bc.second->dispBcPtr) {
33
34 auto &bc_id = bc.first;
35
36 auto regex_str = (boost::format("%s_(.*)") % problem_name).str();
37 if (std::regex_match(bc_id, std::regex(regex_str))) {
38
39 auto [field_name, block_name] =
40 BcManager::extractStringFromBlockId(bc_id, problem_name);
41
42 auto get_field_coeffs = [&](auto field_name) {
43 auto field_ptr = mField.get_field_structure(field_name);
44 return field_ptr->getNbOfCoeffs();
45 };
46 const auto nb_field_coeffs = get_field_coeffs(field_name);
47
48 MOFEM_LOG("WORLD", Sev::noisy)
49 << "Apply EssentialPreProc<DisplacementCubitBcData>: "
50 << problem_name << "_" << field_name << "_" << block_name;
51
52 double v;
53 int coeff;
54 std::array<std::vector<double>, 3> coords;
55 int idx;
56
57 auto lambda = [&](boost::shared_ptr<FieldEntity> field_entity_ptr) {
59 if (getCoords) {
60 field_entity_ptr->getEntFieldData()[coeff] =
61 coords[coeff][idx] + v;
62 ++idx;
63 } else {
64 field_entity_ptr->getEntFieldData()[coeff] = v;
65 }
67 };
68
69 auto verts = bc.second->bcEnts.subset_by_type(MBVERTEX);
70 if (getCoords) {
71 for (auto d : {0, 1, 2})
72 coords[d].resize(verts.size());
73 CHKERR mField.get_moab().get_coords(verts, &*coords[0].begin(),
74 &*coords[1].begin(),
75 &*coords[2].begin());
76 }
77
78 if (disp_bc->data.flag1) {
79 v = disp_bc->data.value1;
80 for (auto s : vecOfTimeScalingMethods) {
81 v *= s->getScale(fe_method_ptr->ts_t);
82 }
83 idx = 0;
84 coeff = 0;
85 CHKERR fb->fieldLambdaOnEntities(lambda, field_name, &verts);
86 }
87 if (disp_bc->data.flag2 && nb_field_coeffs > 1) {
88 v = disp_bc->data.value2;
89 for (auto s : vecOfTimeScalingMethods) {
90 v *= s->getScale(fe_method_ptr->ts_t);
91 }
92 idx = 0;
93 coeff = 1;
94 CHKERR fb->fieldLambdaOnEntities(lambda, field_name, &verts);
95 }
96 if (disp_bc->data.flag3 && nb_field_coeffs > 2) {
97 v = disp_bc->data.value3;
98 for (auto s : vecOfTimeScalingMethods) {
99 v *= s->getScale(fe_method_ptr->ts_t);
100 }
101 idx = 0;
102 coeff = 2;
103 CHKERR fb->fieldLambdaOnEntities(lambda, field_name, &verts);
104 }
105 }
106 }
107 }
108
109 } else {
110 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
111 "Can not lock shared pointer");
112 }
113
115}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
constexpr double lambda
virtual const Field * get_field_structure(const std::string &name, enum MoFEMTypes bh=MF_EXIST) const =0
get field structure
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Definition: LogManager.hpp:284
const double v
phase velocity of light in medium (cm/ns)
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.
Definition: BcManager.cpp:1045
virtual moab::Interface & get_moab()=0
FieldCoefficientsNumber getNbOfCoeffs() const
Get number of field coefficients.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.

Member Data Documentation

◆ fePtr

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

Definition at line 34 of file EssentialDisplacementCubitBcData.hpp.

◆ getCoords

Definition at line 36 of file EssentialDisplacementCubitBcData.hpp.

◆ mField

Definition at line 33 of file EssentialDisplacementCubitBcData.hpp.

◆ vecOfTimeScalingMethods

Definition at line 35 of file EssentialDisplacementCubitBcData.hpp.


The documentation for this struct was generated from the following files: