15 #include "libmesh/replicated_mesh.h" 16 #include "libmesh/unstructured_mesh.h" 25 params.
addRequiredParam<std::vector<MeshGeneratorName>>(
"inputs",
"The input MeshGenerators.");
31 _input_names(getParam<
std::vector<MeshGeneratorName>>(
"inputs")),
32 _meshes(getMeshes(
"inputs"))
36 paramError(
"input_names",
"You need to specify at least one MeshGenerator as an input.");
39 std::unique_ptr<MeshBase>
58 #ifdef LIBMESH_ENABLE_UNIQUE_ID 59 mesh->parallel_max_unique_id();
65 mesh->copy_nodes_and_elements(*other_mesh,
73 BoundaryInfo & boundary =
mesh->get_boundary_info();
74 const BoundaryInfo & other_boundary = other_mesh->get_boundary_info();
76 for (
const auto & t : other_boundary.build_node_list())
77 boundary.add_node(std::get<0>(t) + node_delta, std::get<1>(t));
79 for (
const auto & t : other_boundary.build_side_list())
80 boundary.add_side(std::get<0>(t) + elem_delta, std::get<1>(t), std::get<2>(t));
82 for (
const auto & t : other_boundary.build_edge_list())
83 boundary.add_edge(std::get<0>(t) + elem_delta, std::get<1>(t), std::get<2>(t));
85 for (
const auto & t : other_boundary.build_shellface_list())
86 boundary.add_shellface(std::get<0>(t) + elem_delta, std::get<1>(t), std::get<2>(t));
88 const auto & boundary_ids = boundary.get_boundary_ids();
89 const auto & other_boundary_ids = other_boundary.get_boundary_ids();
90 for (
auto id : other_boundary_ids)
93 if (boundary_ids.count(
id))
95 if (boundary.get_sideset_name(
id) !=
"" &&
96 boundary.get_sideset_name(
id) != other_boundary.get_sideset_name(
id))
99 " exists but has different names in the merged meshes ('",
100 boundary.get_sideset_name(
id),
102 other_boundary.get_sideset_name(
id),
105 boundary.sideset_name(
id) = other_boundary.get_sideset_name(
id);
107 if (boundary.get_nodeset_name(
id) !=
"" &&
108 boundary.get_nodeset_name(
id) != other_boundary.get_nodeset_name(
id))
111 " exists but has different names in the merged meshes ('",
112 boundary.get_nodeset_name(
id),
114 other_boundary.get_nodeset_name(
id),
117 boundary.nodeset_name(
id) = other_boundary.get_nodeset_name(
id);
122 mesh->set_isnt_prepared();
const std::vector< std::unique_ptr< MeshBase > * > _meshes
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
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.
registerMooseObject("MooseApp", MeshCollectionGenerator)
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()
static InputParameters validParams()
MeshCollectionGenerator(const InputParameters ¶meters)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
Collects multiple meshes into a single (unconnected) mesh.
const std::vector< MeshGeneratorName > & _input_names
The mesh generators to read.
MeshGenerators are objects that can modify or add to an existing mesh.