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()),
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()),
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 201 const std::vector<SubdomainName> &
207 const std::set<SubdomainID> &
219 return (
unsigned int)
_blk_ids.size();
227 std::vector<SubdomainName> names(1);
256 std::set<SubdomainID> ids_set(ids.begin(), ids.end());
266 return std::includes(
_blk_ids.begin(),
_blk_ids.end(), ids.begin(), ids.end());
277 return std::includes(ids.begin(),
282 return std::includes(ids.begin(), ids.end(),
_blk_ids.begin(),
_blk_ids.end());
288 std::set<SubdomainID> ids_set(ids.begin(), ids.end());
292 const std::set<SubdomainID> &
309 for (
const auto &
id : ids)
312 std::set<std::string> declared_props;
318 for (
const auto & mat : mats)
320 const std::set<std::string> & mat_props = mat->getSuppliedItems();
321 declared_props.insert(mat_props.begin(), mat_props.end());
326 if (declared_props.find(prop_name) == declared_props.end())
338 mooseError(
"No mesh available in BlockRestrictable::checkCoordSystem()");
340 mooseError(
"No problem available in BlockRestrictable::checkCoordSystem()");
344 if (subdomains.empty())
345 mooseError(
"No subdomains found in the problem.");
349 for (
auto subdomain : subdomains)
351 mooseError(
"This object requires all subdomains to have the same coordinate system.");
369 mooseError(
"The 'block' parameter of the object '",
371 "' 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.
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)
Find a value in an array.
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
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 std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
const InputParameters & parameters() const
Get the parameters of the object.
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.
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 ...
const MooseObject * _moose_object
Pointer to the MOOSE object.
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()
const Moose::Kokkos::Mesh * getKokkosMesh() const
Accessor for Kokkos mesh object.
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.
const std::string & name() const
Get the name of the class.
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...
void initializeKokkosBlockRestrictable(const Moose::Kokkos::Mesh *mesh)
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.
bool isKokkosObject(IsKokkosObjectKey &&) const
Get whether this object is a Kokkos functor The parameter is set by the Kokkos base classes: ...
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.
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 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.
Moose::CoordinateSystemType getCoordSystem(SubdomainID sid) const
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
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.