13#include "libmesh/boundary_info.h"
14#include "libmesh/elem_side_builder.h"
25 "Input mesh the operation will be applied to");
26 params.
addParam<std::vector<BoundaryName>>(
27 "nodesets_to_convert",
28 "If specified, list of nodesets to convert. If not specified, all nodesets are converted");
37std::unique_ptr<MeshBase>
41 _input->get_boundary_info().build_side_list_from_node_list();
44 const auto & nodeset_names = getParam<std::vector<BoundaryName>>(
"nodesets_to_convert");
45 auto & binfo =
_input->get_boundary_info();
47 std::set<BoundaryID> nodeset_ids;
48 for (
const auto & nodeset_name : nodeset_names)
51 BoundaryID nodeset_id = std::numeric_limits<BoundaryID>::max();
52 for (
const auto & [
id,
name] : binfo.get_nodeset_name_map())
53 if (
name == nodeset_name)
55 if (MooseUtils::isDigits(nodeset_name))
56 nodeset_id = std::stoi(nodeset_name);
57 if (nodeset_id == std::numeric_limits<BoundaryID>::max())
59 "Nodeset '" + nodeset_name +
"' does not exist in the input mesh");
60 nodeset_ids.insert(nodeset_id);
62 _input->get_boundary_info().build_side_list_from_node_list(nodeset_ids);
65 return dynamic_pointer_cast<MeshBase>(
_input);
boundary_id_type BoundaryID
registerMooseObject("MooseApp", SideSetsFromNodeSetsGenerator)
MeshGenerators are objects that can modify or add to an existing mesh.
static InputParameters validParams()
const std::string & name() const
Get the name of the class.
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 ...
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
MeshGenerator for constructing side Sets from node sets.
static InputParameters validParams()
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
std::unique_ptr< MeshBase > & _input
Input mesh the operation will be applied to.
SideSetsFromNodeSetsGenerator(const InputParameters ¶meters)