13 #include "libmesh/elem.h" 22 params.
addClassDescription(
"Mesh generator which removes elements from the specified subdomains");
23 params.
addParam<std::vector<SubdomainName>>(
"block",
"The list of blocks to be deleted");
25 "block_id",
"The block to be deleted.",
"Use block instead");
35 _block_ids.push_back(getParam<SubdomainID>(
"block_id"));
37 mooseError(
"Must provide the blocks to be deleted in the 'block' parameter");
39 paramError(
"block_id",
"Cannot use with the parameter 'block'. Please use just 'block'.");
42 std::unique_ptr<MeshBase>
51 for (std::size_t i = 0; i <
_block_ids.size(); ++i)
57 getParam<std::vector<SubdomainName>>(
"block")[i],
58 "' was not found within the mesh");
62 getParam<SubdomainID>(
"block_id"),
63 "' was not found within 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 ...
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
static InputParameters validParams()
virtual bool shouldDelete(const Elem *elem) override
Method that returns a Boolean indicating whether an element should be removed from the mesh...
This class deletes elements from the mesh data structure after it has been generated or read but befo...
std::vector< subdomain_id_type > getSubdomainIDs(const libMesh::MeshBase &mesh, const std::vector< SubdomainName > &subdomain_name)
Get the associated subdomainIDs for the subdomain names that are passed in.
static InputParameters validParams()
bool hasSubdomainID(const MeshBase &input_mesh, const SubdomainID &id)
Whether a particular subdomain ID exists in the mesh.
std::unique_ptr< MeshBase > & _input
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
virtual std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
std::vector< SubdomainID > _block_ids
Ids of the blocks to be removed.
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.
registerMooseObject("MooseApp", BlockDeletionGenerator)
BlockDeletionGenerator(const InputParameters ¶meters)
MeshGenerator for removing blocks from the mesh.