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->name()),
50 _blk_dim(
libMesh::invalid_uint),
51 _moose_object(moose_object)
59 const std::set<BoundaryID> & boundary_ids)
60 : _blk_dual_restrictable(moose_object->getParam<bool>(
"_dual_restrictable")),
61 _blk_feproblem(moose_object->isParamValid(
"_fe_problem_base")
64 _blk_mesh(moose_object->isParamValid(
"_mesh") ? moose_object->getParam<
MooseMesh *>(
"_mesh")
66 _boundary_ids(boundary_ids),
67 _blk_tid(moose_object->isParamValid(
"_tid") ? moose_object->getParam<
THREAD_ID>(
"_tid") : 0),
68 _blk_name(moose_object->name()),
69 _blk_dim(
libMesh::invalid_uint),
70 _moose_object(moose_object)
84 mooseError(
"The input parameters must contain a pointer to FEProblem via '_fe_problem' or a "
85 "pointer to the MooseMesh via '_mesh'");
90#ifdef MOOSE_KOKKOS_ENABLED
119 if (!variable_name.empty())
132 "Attempted to restrict the object '",
134 "' to a block, but the object is already restricted by boundary");
147 std::vector<SubdomainID> diff;
149 std::set_difference(
_blk_ids.begin(),
153 std::back_inserter(diff));
157 std::ostringstream msg;
159 msg <<
"the following blocks (ids) do not exist on the mesh:";
160 for (
const auto &
id : diff)
166 if (std::to_string(
id) != name)
167 msg << sep << name <<
" (" <<
id <<
")";
175 std::vector<SubdomainID> valid_ids_vec(valid_ids.begin(), valid_ids.end());
177 msg <<
"\nBlocks names (resp. ids) that do exist: " <<
Moose::stringify(valid_names) <<
" ("
189#ifdef MOOSE_KOKKOS_ENABLED
202const std::vector<SubdomainName> &
208const std::set<SubdomainID> &
220 return (
unsigned int)
_blk_ids.size();
228 std::vector<SubdomainName> names(1);
257 std::set<SubdomainID> ids_set(ids.begin(), ids.end());
267 return std::includes(
_blk_ids.begin(),
_blk_ids.end(), ids.begin(), ids.end());
278 return std::includes(ids.begin(),
283 return std::includes(ids.begin(), ids.end(),
_blk_ids.begin(),
_blk_ids.end());
289 std::set<SubdomainID> ids_set(ids.begin(), ids.end());
293const std::set<SubdomainID> &
310 for (
const auto &
id : ids)
313 std::set<std::string> declared_props;
319 for (
const auto & mat : mats)
321 const std::set<std::string> & mat_props = mat->getSuppliedItems();
322 declared_props.insert(mat_props.begin(), mat_props.end());
327 if (declared_props.find(prop_name) == declared_props.end())
339 mooseError(
"No mesh available in BlockRestrictable::checkCoordSystem()");
341 mooseError(
"No problem available in BlockRestrictable::checkCoordSystem()");
345 if (subdomains.empty())
346 mooseError(
"No subdomains found in the problem.");
350 for (
auto subdomain : subdomains)
352 mooseError(
"This object requires all subdomains to have the same coordinate system.");
370 mooseError(
"The 'block' parameter of the object '",
372 "' must be a subset of the 'block' parameter of the variable '",
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
bool isBlockSubset(const std::set< SubdomainID > &ids) const
Test if the class block ids are a subset of the supplied objects.
bool hasBlocks(const SubdomainName &name) const
Test if the supplied block name is valid for this object.
unsigned int blocksMaxDimension() const
Return the largest mesh dimension of the elements in the blocks for this object.
const std::string & _blk_name
Name of the object.
virtual const std::set< SubdomainID > & blockIDs() const
Return the block subdomain ids for this object Note, if this is not block restricted,...
const MaterialData * _blk_material_data
Pointer to the MaterialData class for this object.
Moose::CoordinateSystemType getBlockCoordSystem()
Check if the blocks this object operates on all have the same coordinate system, and if so return it.
const std::set< SubdomainID > & meshBlockIDs() const
Return all of the SubdomainIDs for the mesh.
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.
THREAD_ID _blk_tid
Thread id for this object.
BlockRestrictable(const MooseObject *moose_object, bool initialize=true)
Class constructor Populates the 'block' input parameters, see the general class documentation for det...
virtual bool blockRestricted() const
Returns true if this object has been restricted to a block.
const std::vector< SubdomainName > & blocks() const
Return the block names for this object.
std::vector< SubdomainName > _blocks
Vector the block names supplied by the user via the input file.
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 ...
void initializeBlockRestrictable(const MooseObject *moose_object)
An initialization routine needed for dual constructors.
std::set< SubdomainID > _blk_ids
Set of block ids supplied by the user via the input file (for error checking)
const bool _blk_dual_restrictable
Flag for allowing dual restriction.
const MooseMesh * _blk_mesh
Pointer to Mesh.
std::vector< SubdomainID > _vec_ids
Vector of block ids supplied by the user via the input file (for error reporting)
static InputParameters validParams()
virtual bool hasBlockMaterialPropertyHelper(const std::string &prop_name)
A helper method to allow the Material object to specialize the behavior of hasBlockMaterialProperty.
FEProblemBase * _blk_feproblem
Pointer to FEProblemBase.
const MooseObject * _moose_object
Pointer to the MOOSE object.
void initializeKokkosBlockRestrictable()
const std::set< BoundaryID > & _boundary_ids
Reference to the boundary_ids, defaults to an empty set if not provided.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
MaterialData & getMaterialData(Moose::MaterialDataType type, const THREAD_ID tid=0, const MooseObject *object=nullptr) const
MaterialData & getKokkosMaterialData(Moose::MaterialDataType type, const MooseObject *object=nullptr) const
const MaterialWarehouse & getMaterialWarehouse() const
void addKokkosMeshInitializationHook(std::function< void()> function)
Add a function hook that needs to be called after Kokkos mesh initialization.
virtual MooseMesh & mesh() override
MaterialBase objects are special in that they have additional objects created automatically (see FEPr...
const InputParameters & parameters() const
Get the parameters of the object.
const std::string & name() const
Get the name of the class.
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.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh me...
std::vector< SubdomainName > getSubdomainNames(const std::vector< SubdomainID > &subdomain_ids) const
Get the associated subdomainNames for the subdomain ids that are passed in.
unsigned int getBlocksMaxDimension(const std::vector< SubdomainName > &blocks) const
Returns the maximum element dimension on the given blocks.
const std::set< SubdomainID > & interiorLowerDBlocks() const
std::vector< SubdomainID > getSubdomainIDs(const std::vector< SubdomainName > &subdomain_names) const
Get the associated subdomainIDs for the subdomain names that are passed in.
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
bool hasActiveBlockObjects(THREAD_ID tid=0) const
Every object that can be built by the factory should be derived from this class.
bool isKokkosObject() const
Get whether this object is a Kokkos functor The parameter MooseBase::kokkos_object_param is set by th...
This class provides an interface for common operations on field variables of both FE and FV types wit...
bool activeOnSubdomains(const std::set< SubdomainID > &subdomains) const
Is the variable active on the subdomains?
const std::set< SubdomainID > & activeSubdomains() const
The subdomains the variable is active on.
Moose::CoordinateSystemType getCoordSystem(SubdomainID sid) const
void initialize(EquationSystems &es, const std::string &system_name)
const SubdomainID ANY_BLOCK_ID
std::string stringify(const T &t)
conversion to string
const BoundaryID ANY_BOUNDARY_ID
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const unsigned int invalid_uint