17 std::vector<boost::shared_ptr<ScalingMethod>> smv,
bool get_coords)
18 : mField(m_field), fePtr(fe_ptr), vecOfTimeScalingMethods(smv),
19 getCoords(get_coords) {}
25 if (
auto fe_method_ptr = fePtr.lock()) {
27 auto bc_mng = mField.getInterface<
BcManager>();
29 const auto problem_name = fe_method_ptr->problemPtr->getName();
31 for (
auto bc : bc_mng->getBcMapByBlockName()) {
32 if (
auto disp_bc = bc.second->dispBcPtr) {
34 auto &bc_id = bc.first;
36 auto regex_str = (boost::format(
"%s_(.*)") % problem_name).str();
37 if (std::regex_match(bc_id, std::regex(regex_str))) {
43 auto field_ptr = mField.get_field_structure(
field_name);
44 return field_ptr->getNbOfCoeffs();
46 const auto nb_field_coeffs = get_field_coeffs(
field_name);
49 <<
"Apply EssentialPreProc<DisplacementCubitBcData>: "
50 << problem_name <<
"_" <<
field_name <<
"_" << block_name;
56 if (
auto ext_disp_bc =
59 for (
int a = 0;
a != 3; ++
a)
60 t_off(
a) = ext_disp_bc->rotOffset[
a];
63 auto scale_value = [&](
const double &
c) {
65 for (
auto s : vecOfTimeScalingMethods) {
66 val *= s->getScale(fe_method_ptr->ts_t);
71 if (disp_bc->data.flag1 == 1)
72 t_vals(0) = scale_value(-disp_bc->data.value1);
73 if (disp_bc->data.flag2 == 1)
74 t_vals(1) = scale_value(-disp_bc->data.value2);
75 if (disp_bc->data.flag3 == 1)
76 t_vals(2) = scale_value(-disp_bc->data.value3);
77 if (disp_bc->data.flag4 == 1)
78 t_angles(0) = scale_value(-disp_bc->data.value4);
79 if (disp_bc->data.flag5 == 1)
80 t_angles(1) = scale_value(-disp_bc->data.value5);
81 if (disp_bc->data.flag6 == 1)
82 t_angles(2) = scale_value(-disp_bc->data.value6);
85 std::array<std::vector<double>, 3> coords;
88 const bool is_rotation =
89 disp_bc->data.flag4 || disp_bc->data.flag5 || disp_bc->data.flag6;
91 auto lambda = [&](boost::shared_ptr<FieldEntity> field_entity_ptr) {
93 auto v = t_vals(coeff);
96 coords[0][idx], coords[1][idx], coords[2][idx]);
98 t_angles, t_coords, t_off)(coeff);
101 v += coords[coeff][idx];
104 field_entity_ptr->getEntFieldData()[coeff] =
v;
110 auto verts = bc.second->bcEnts.subset_by_type(MBVERTEX);
111 if (getCoords || is_rotation) {
112 for (
auto d : {0, 1, 2})
113 coords[d].resize(verts.size());
114 CHKERR mField.get_moab().get_coords(verts, &*coords[0].begin(),
116 &*coords[2].begin());
119 if (disp_bc->data.flag1 || disp_bc->data.flag5 ||
120 disp_bc->data.flag6) {
125 if (disp_bc->data.flag2 || disp_bc->data.flag4 ||
126 disp_bc->data.flag6) {
129 if (nb_field_coeffs > 1)
132 if (disp_bc->data.flag3 || disp_bc->data.flag4 ||
133 disp_bc->data.flag5 || is_rotation) {
136 if (nb_field_coeffs > 2)
145 "Can not lock shared pointer");
#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.
constexpr double lambda
surface tension
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
const double c
speed of light (cm/ns)
const double v
phase velocity of light in medium (cm/ns)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
constexpr auto field_name
Simple interface for fast problem set-up.
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.
Deprecated interface functions.
A specialized version of DisplacementCubitBcData that includes an additional rotation offset.
static FTensor::Tensor1< double, 3 > GetRotDisp(const FTensor::Tensor1< double, 3 > &angles, FTensor::Tensor1< double, 3 > coordinates, FTensor::Tensor1< double, 3 > offset=FTensor::Tensor1< double, 3 >{ 0., 0., 0.})
Calculates the rotated displacement given the rotation angles, coordinates, and an optional offset.
Class (Function) to enforce essential constrains.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.