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")),
37 _node_id(getParam<
std::vector<dof_id_type>>(
"node_id")),
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'.");
62std::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);
92 return dynamic_pointer_cast<MeshBase>(
mesh);
registerMooseObject("MooseApp", MoveNodeGenerator)
MeshGenerators are objects that can modify or add to an existing mesh.
static InputParameters validParams()
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 ...
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Modifies the position of one or more node(s)
static InputParameters validParams()
const std::vector< Point > * _shift_position
The shift(s) to apply to each node.
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
std::unique_ptr< MeshBase > & _input
Mesh that possibly comes from another generator.
const std::vector< dof_id_type > _node_id
The id(s) of the node(s) to be moved.
MoveNodeGenerator(const InputParameters ¶meters)
const std::vector< Point > * _new_position
The new position(s) of the node.