12 #include "libmesh/node.h" 23 params.
addRequiredParam<std::vector<dof_id_type>>(
"node_id",
"Id of modified node");
25 params.
addParam<std::vector<Point>>(
"new_position",
"New position in vector space");
26 params.
addParam<std::vector<Point>>(
"shift_position",
27 "Shifts to apply to the position in vector space");
36 _input(getMesh(
"input")),
38 _new_position(nullptr),
39 _shift_position(nullptr)
42 mooseError(
"You must specify either 'shift_position' or 'new_position'! " 43 "You have specified either both or none");
47 _new_position = &getParam<std::vector<Point>>(
"new_position");
50 paramError(
"node_id",
"Must be the same length as 'new_position'.");
58 paramError(
"node_id",
"Must be the same length as 'shift_position'.");
62 std::unique_ptr<MeshBase>
65 std::unique_ptr<MeshBase>
mesh = std::move(
_input);
70 std::size_t num_found = 0;
80 Point pt((*node)(0), (*node)(1), (*node)(2));
88 mesh->comm().sum(num_found);
const std::vector< Point > * _new_position
The new position(s) of the node.
const std::vector< Point > * _shift_position
The shift(s) to apply to each node.
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.
MoveNodeGenerator(const InputParameters ¶meters)
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
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 ...
static InputParameters validParams()
registerMooseObject("MooseApp", MoveNodeGenerator)
Modifies the position of one or more node(s)
const std::vector< dof_id_type > _node_id
The id(s) of the node(s) to be moved.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
std::unique_ptr< MeshBase > & _input
Mesh that possibly comes from another generator.
MeshGenerators are objects that can modify or add to an existing mesh.
static InputParameters validParams()