27 params.
addParam<std::vector<SubdomainName>>(
28 "block",
"The list of blocks (ids or names) that this object will be applied");
41 : _blk_dual_restrictable(moose_object->getParam<bool>(
"_dual_restrictable")),
42 _blk_feproblem(moose_object->isParamValid(
"_fe_problem_base")
45 _blk_mesh(moose_object->isParamValid(
"_mesh") ? moose_object->getParam<
MooseMesh *>(
"_mesh")
47 _boundary_ids(_empty_boundary_ids),
48 _blk_tid(moose_object->isParamValid(
"_tid") ? moose_object->getParam<
THREAD_ID>(
"_tid") : 0),
49 _blk_name(moose_object->getParam<
std::string>(
"_object_name")),
58 const std::set<BoundaryID> & boundary_ids)
59 : _blk_dual_restrictable(moose_object->getParam<bool>(
"_dual_restrictable")),
60 _blk_feproblem(moose_object->isParamValid(
"_fe_problem_base")
63 _blk_mesh(moose_object->isParamValid(
"_mesh") ? moose_object->getParam<
MooseMesh *>(
"_mesh")
65 _boundary_ids(boundary_ids),
66 _blk_tid(moose_object->isParamValid(
"_tid") ? moose_object->getParam<
THREAD_ID>(
"_tid") : 0),
67 _blk_name(moose_object->getParam<
std::string>(
"_object_name")),
82 mooseError(
"The input parameters must contain a pointer to FEProblem via '_fe_problem' or a " 83 "pointer to the MooseMesh via '_mesh'");
110 if (!variable_name.empty())
123 "Attempted to restrict the object '",
125 "' to a block, but the object is already restricted by boundary");
138 std::vector<SubdomainID> diff;
140 std::set_difference(
_blk_ids.begin(),
144 std::back_inserter(diff));
148 std::ostringstream msg;
150 msg <<
"the following blocks (ids) do not exist on the mesh:";
151 for (
const auto &
id : diff)
157 if (std::to_string(
id) !=
name)
158 msg << sep <<
name <<
" (" <<
id <<
")";
183 const std::vector<SubdomainName> &
189 const std::set<SubdomainID> &
201 return (
unsigned int)
_blk_ids.size();
209 std::vector<SubdomainName> names(1);
232 std::set<SubdomainID> ids_set(ids.begin(), ids.end());
242 return std::includes(
_blk_ids.begin(),
_blk_ids.end(), ids.begin(), ids.end());
253 return std::includes(ids.begin(),
258 return std::includes(ids.begin(), ids.end(),
_blk_ids.begin(),
_blk_ids.end());
264 std::set<SubdomainID> ids_set(ids.begin(), ids.end());
268 const std::set<SubdomainID> &
285 for (
const auto &
id : ids)
288 std::set<std::string> declared_props;
294 for (
const auto & mat : mats)
296 const std::set<std::string> & mat_props = mat->getSuppliedItems();
297 declared_props.insert(mat_props.begin(), mat_props.end());
302 if (declared_props.find(prop_name) == declared_props.end())
314 mooseError(
"No mesh available in BlockRestrictable::checkCoordSystem()");
316 mooseError(
"No problem available in BlockRestrictable::checkCoordSystem()");
320 if (subdomains.empty())
321 mooseError(
"No subdomains found in the problem.");
325 for (
auto subdomain : subdomains)
327 mooseError(
"This object requires all subdomains to have the same coordinate system.");
344 mooseError(
"The 'block' parameter of the object '",
346 "' must be a subset of the 'block' parameter of the variable '",
std::string name(const ElemQuality q)
unsigned int blocksMaxDimension() const
Return the largest mesh dimension of the elements in the blocks for this object.
unsigned int _blk_dim
Largest mesh dimension of the elements in the blocks for this object.
unsigned int numBlocks() const
Return the number of blocks for this object.
const bool _blk_dual_restrictable
Flag for allowing dual restriction.
bool hasActiveBlockObjects(THREAD_ID tid=0) const
const unsigned int invalid_uint
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
MaterialData & getMaterialData(Moose::MaterialDataType type, const THREAD_ID tid=0)
Moose::CoordinateSystemType getBlockCoordSystem()
Check if the blocks this object operates on all have the same coordinate system, and if so return it...
FEProblemBase * _blk_feproblem
Pointer to FEProblemBase.
const std::string & name() const override
Get the variable name.
virtual void checkVariable(const MooseVariableFieldBase &variable) const
Helper for checking that the ids for this object are in agreement with the variables on the supplied ...
This class provides an interface for common operations on field variables of both FE and FV types wit...
virtual const std::set< SubdomainID > & blockIDs() const
Return the block subdomain ids for this object Note, if this is not block restricted, this function returns all mesh subdomain ids.
virtual bool blockRestricted() const
Returns true if this object has been restricted to a block.
MaterialBase objects are special in that they have additional objects created automatically (see FEPr...
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const MaterialWarehouse & getMaterialWarehouse() const
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
void initialize(EquationSystems &es, const std::string &system_name)
static InputParameters validParams()
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
bool isBlockSubset(const std::set< SubdomainID > &ids) const
Test if the class block ids are a subset of the supplied objects.
void initializeBlockRestrictable(const MooseObject *moose_object)
An initialization routine needed for dual constructors.
std::vector< SubdomainID > _vec_ids
Vector of block ids supplied by the user via the input file (for error reporting) ...
Every object that can be built by the factory should be derived from this class.
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh me...
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
THREAD_ID _blk_tid
Thread id for this object.
std::vector< SubdomainName > _blocks
Vector the block names supplied by the user via the input file.
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 ...
std::string stringify(const T &t)
conversion to string
const std::set< SubdomainID > & activeSubdomains() const
The subdomains the variable is active on.
const SubdomainID ANY_BLOCK_ID
const std::vector< SubdomainName > & blocks() const
Return the block names for this object.
unsigned int getBlocksMaxDimension(const std::vector< SubdomainName > &blocks) const
Returns the maximum element dimension on the given blocks.
const MaterialData * _blk_material_data
Pointer to the MaterialData class for this object.
const SubdomainID INTERNAL_SIDE_LOWERD_ID
const std::set< SubdomainID > & meshBlockIDs() const
Return all of the SubdomainIDs for the mesh.
virtual MooseMesh & mesh() override
virtual bool hasBlockMaterialPropertyHelper(const std::string &prop_name)
A helper method to allow the Material object to specialize the behavior of hasBlockMaterialProperty.
const std::set< BoundaryID > & _boundary_ids
Reference to the boundary_ids, defaults to an empty set if not provided.
const InputParameters & parameters() const
Get the parameters of the object.
Moose::CoordinateSystemType getCoordSystem(SubdomainID sid) const
std::vector< SubdomainID > getSubdomainIDs(const std::vector< SubdomainName > &subdomain_name) const
Get the associated subdomainIDs for the subdomain names that are passed in.
BlockRestrictable(const MooseObject *moose_object, bool initialize=true)
Class constructor Populates the 'block' input parameters, see the general class documentation for det...
bool hasBlocks(const SubdomainName &name) const
Test if the supplied block name is valid for this object.
std::set< SubdomainID > _blk_ids
Set of block ids supplied by the user via the input file (for error checking)
const std::string & _blk_name
Name of the object.
MooseMesh * _blk_mesh
Pointer to Mesh.
const BoundaryID ANY_BOUNDARY_ID
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.