14#include "libmesh/elem.h"
23 MooseEnum operation(
"remove keep",
"remove");
26 "Whether to remove or keep the listed blocks. If keep, all blocks not "
27 "in the list will be removed.");
29 params.
addClassDescription(
"Mesh generator which removes elements from the specified subdomains");
30 params.
addParam<std::vector<SubdomainName>>(
31 "block",
"The list of blocks to be processed (deleted or kept)");
33 "block_id",
"The block to be deleted.",
"Use block instead");
43 _block_ids.push_back(getParam<SubdomainID>(
"block_id"));
45 mooseError(
"Must provide the blocks to be processed in the 'block' parameter");
47 paramError(
"block_id",
"Cannot use with the parameter 'block'. Please use just 'block'.");
50std::unique_ptr<MeshBase>
54 if (!
_input->preparation().has_cached_elem_data)
63 for (std::size_t i = 0; i <
_block_ids.size(); ++i)
69 getParam<std::vector<SubdomainName>>(
"block")[i],
70 "' was not found within the mesh");
74 getParam<SubdomainID>(
"block_id"),
75 "' was not found within the mesh");
registerMooseObject("MooseApp", BlockDeletionGenerator)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
MeshGenerator for removing blocks from the mesh.
BlockDeletionGenerator(const InputParameters ¶meters)
std::vector< SubdomainID > _block_ids
Ids of the blocks to be removed.
virtual std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
MooseEnum _operation
Whether to remove or keep the specified blocks.
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::unique_ptr< MeshBase > & _input
std::unique_ptr< MeshBase > generate() override
Generate / modify the 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 ...
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
bool hasSubdomainID(const MeshBase &input_mesh, const SubdomainID &id)
Whether a particular subdomain ID exists in the mesh.
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.