11 #include "libmesh/mesh_modification.h" 14 #include "libmesh/mesh_tools.h" 22 "TRANSLATE=1 TRANSLATE_CENTER_ORIGIN=2 TRANSLATE_MIN_ORIGIN=3 ROTATE=4 SCALE=5");
26 params.
addRequiredParam<MeshGeneratorName>(
"input",
"The mesh we want to modify");
31 "The type of transformation to perform (TRANSLATE, TRANSLATE_CENTER_ORIGIN, " 32 "TRANSLATE_MIN_ORIGIN, ROTATE, SCALE)");
35 "The value to use for the transformation. When using TRANSLATE or SCALE, the " 36 "xyz coordinates are applied in each direction respectively. When using " 37 "ROTATE, the values are interpreted as the Euler angles phi, theta and psi " 45 _input(getMesh(
"input")),
46 _transform(getParam<
MooseEnum>(
"transform"))
51 "The parameter 'vector_value' must be supplied with 'transform' = ",
55 std::unique_ptr<MeshBase>
58 std::unique_ptr<MeshBase>
mesh = std::move(
_input);
63 const auto bbox = MeshTools::create_bounding_box(*
mesh);
65 vector_value = -0.5 * (bbox.max() + bbox.min());
67 vector_value = -bbox.min();
70 vector_value = getParam<RealVectorValue>(
"vector_value");
77 MeshTools::Modification::translate(*
mesh, vector_value(0), vector_value(1), vector_value(2));
80 MeshTools::Modification::rotate(*
mesh, vector_value(0), vector_value(1), vector_value(2));
83 MeshTools::Modification::scale(*
mesh, vector_value(0), vector_value(1), vector_value(2));
87 mesh->set_isnt_prepared();
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
static InputParameters validParams()
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
MeshGenerators are objects that can modify or add to an existing mesh.