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 <<
")";
166 std::vector<SubdomainID> valid_ids_vec(valid_ids.begin(), valid_ids.end());
168 msg <<
"\nBlocks names (resp. ids) that do exist: " <<
Moose::stringify(valid_names) <<
" (" 187 const std::vector<SubdomainName> &
193 const std::set<SubdomainID> &
205 return (
unsigned int)
_blk_ids.size();
213 std::vector<SubdomainName> names(1);
242 std::set<SubdomainID> ids_set(ids.begin(), ids.end());
252 return std::includes(
_blk_ids.begin(),
_blk_ids.end(), ids.begin(), ids.end());
263 return std::includes(ids.begin(),
268 return std::includes(ids.begin(), ids.end(),
_blk_ids.begin(),
_blk_ids.end());
274 std::set<SubdomainID> ids_set(ids.begin(), ids.end());
278 const std::set<SubdomainID> &
295 for (
const auto &
id : ids)
298 std::set<std::string> declared_props;
304 for (
const auto & mat : mats)
306 const std::set<std::string> & mat_props = mat->getSuppliedItems();
307 declared_props.insert(mat_props.begin(), mat_props.end());
312 if (declared_props.find(prop_name) == declared_props.end())
324 mooseError(
"No mesh available in BlockRestrictable::checkCoordSystem()");
326 mooseError(
"No problem available in BlockRestrictable::checkCoordSystem()");
330 if (subdomains.empty())
331 mooseError(
"No subdomains found in the problem.");
335 for (
auto subdomain : subdomains)
337 mooseError(
"This object requires all subdomains to have the same coordinate system.");
355 mooseError(
"The 'block' parameter of the object '",
357 "' 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.
const std::set< SubdomainID > & interiorLowerDBlocks() const
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...
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 ...
MaterialData & getMaterialData(Moose::MaterialDataType type, const THREAD_ID tid=0) const
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)
std::vector< SubdomainID > getSubdomainIDs(const std::vector< SubdomainName > &subdomain_names) const
Get the associated subdomainIDs for the subdomain names that are passed in.
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.
bool activeOnSubdomains(const std::set< SubdomainID > &subdomains) const
Is the variable active on the subdomains?
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
std::vector< SubdomainName > getSubdomainNames(const std::vector< SubdomainID > &subdomain_ids) const
Get the associated subdomainNames for the subdomain ids that are passed in.
const MooseMesh * _blk_mesh
Pointer to Mesh.
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 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
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.
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.