12#include "libmesh/elem.h"
23 "Converts one or more blocks (subdomains) from a mesh into a stand-alone mesh with a "
24 "single block in it.");
26 params.
addRequiredParam<MeshGeneratorName>(
"input",
"The mesh we want to modify");
29 "The (list of) blocks (or 'subdomains') we wish to have moved to a new mesh (by name, not "
37 _input(getMesh(
"input")),
38 _target_blocks(getParam<
std::vector<SubdomainName>>(
"target_blocks"))
42std::unique_ptr<MeshBase>
45 std::unique_ptr<MeshBase>
mesh = std::move(
_input);
58 return dynamic_pointer_cast<MeshBase>(new_mesh);
registerMooseObject("MooseApp", BlockToMeshConverterGenerator)
Creates a new mesh out of one or more subdomains/blocks from another mesh.
BlockToMeshConverterGenerator(const InputParameters ¶meters)
const std::vector< SubdomainName > _target_blocks
Blocks to extract to form a mesh.
static InputParameters validParams()
std::unique_ptr< MeshBase > & _input
Mesh that comes from another generator.
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
MeshGenerators are objects that can modify or add to an existing mesh.
static InputParameters validParams()
std::unique_ptr< MeshBase > buildMeshBaseObject(unsigned int dim=libMesh::invalid_uint)
Build a MeshBase object whose underlying type will be determined by the Mesh input file block.
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 ...
Provides a way for users to bail out of the current solve.
virtual const char * what() const
Get out the error message.
void convertBlockToMesh(MeshBase &source_mesh, MeshBase &target_mesh, const std::vector< SubdomainName > &target_blocks)
Convert a list of blocks in a given mesh to a standalone new mesh.