24 params.
addParam<std::vector<BoundaryName>>(
25 "boundary",
"The list of boundaries (ids or names) from the mesh where this object applies");
37 : _bnd_feproblem(moose_object->isParamValid(
"_fe_problem_base")
40 _bnd_mesh(moose_object->isParamValid(
"_mesh") ? moose_object->getParam<
MooseMesh *>(
"_mesh")
42 _bnd_dual_restrictable(moose_object->getParam<bool>(
"_dual_restrictable")),
43 _block_ids(_empty_block_ids),
44 _bnd_tid(moose_object->isParamValid(
"_tid") ? moose_object->getParam<
THREAD_ID>(
"_tid") : 0),
46 #ifdef MOOSE_KOKKOS_ENABLED
47 moose_object->isKokkosObject({})
53 _moose_object(*moose_object)
55 initializeBoundaryRestrictable();
60 const std::set<SubdomainID> & block_ids,
62 : _bnd_feproblem(moose_object->isParamValid(
"_fe_problem_base")
65 _bnd_mesh(moose_object->isParamValid(
"_mesh") ? moose_object->getParam<
MooseMesh *>(
"_mesh")
67 _bnd_dual_restrictable(moose_object->getParam<bool>(
"_dual_restrictable")),
68 _block_ids(block_ids),
69 _bnd_tid(moose_object->isParamValid(
"_tid") ? moose_object->getParam<
THREAD_ID>(
"_tid") : 0),
71 #ifdef MOOSE_KOKKOS_ENABLED
72 moose_object->isKokkosObject({})
78 _moose_object(*moose_object)
80 initializeBoundaryRestrictable();
95 mooseError(
"The input parameters must contain a pointer to FEProblemBase via '_fe_problem' or " 96 "a pointer to the MooseMesh via '_mesh'");
119 "Attempted to restrict the object '",
121 "' to a boundary, but the object is already restricted by block(s)");
133 const std::set<BoundaryID> * valid_ids;
134 const char * message_ptr =
nullptr;
139 message_ptr =
"node sets";
144 message_ptr =
"side sets";
147 std::vector<BoundaryID> diff;
149 std::set_difference(
_bnd_ids.begin(),
153 std::back_inserter(diff));
157 std::ostringstream msg;
159 msg <<
"the following " << message_ptr <<
" (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 <<
")";
177 msg <<
"\n\nMOOSE distinguishes between \"node sets\" and \"side sets\" depending on " 178 "whether\nyou are using \"Nodal\" or \"Integrated\" BCs respectively. Node sets " 179 "corresponding\nto your side sets are constructed for you by default.\n\n" 180 "Try setting \"Mesh/construct_side_list_from_node_list=true\" if you see this " 182 "Note: If you are running with adaptivity you should prefer using side sets.";
188 #ifdef MOOSE_KOKKOS_ENABLED 196 const std::set<BoundaryID> &
202 const std::vector<BoundaryName> &
211 return (
unsigned int)
_bnd_ids.size();
252 std::set<BoundaryID> ids_set(ids.begin(), ids.end());
264 else if (type ==
ALL)
269 return std::includes(
_bnd_ids.begin(),
_bnd_ids.end(), ids.begin(), ids.end());
275 for (
const auto &
id : ids)
296 return std::includes(ids.begin(),
301 return std::includes(ids.begin(), ids.end(),
_bnd_ids.begin(),
_bnd_ids.end());
307 std::set<BoundaryID> ids_set(ids.begin(), ids.end());
311 const std::set<BoundaryID> &
324 const std::set<BoundaryID> & ids =
328 for (
const auto &
id : ids)
331 std::set<std::string> declared_props;
336 const std::vector<std::shared_ptr<MaterialBase>> & mats =
338 for (
const auto & mat : mats)
340 const std::set<std::string> & mat_props = mat->getSuppliedItems();
341 declared_props.insert(mat_props.begin(), mat_props.end());
346 if (declared_props.find(prop_name) == declared_props.end())
std::string name(const ElemQuality q)
const std::set< BoundaryID > & meshNodesetIds() const
Returns a read-only reference to the set of nodesets currently present in the Mesh.
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)
Find a value in an array.
virtual ~BoundaryRestrictable()
Empty class destructor.
bool isBoundarySubset(const std::set< BoundaryID > &ids) const
Test if the class boundary ids are a subset of the supplied objects.
void initializeBoundaryRestrictable()
An initialization routine needed for dual constructors.
virtual bool boundaryRestricted() const
Returns true if this object has been restricted to a boundary.
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.
const std::set< BoundaryID > & meshSidesetIds() const
Returns a read-only reference to the set of sidesets currently present in the Mesh.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
MooseMesh * _bnd_mesh
Point to mesh.
MaterialBase objects are special in that they have additional objects created automatically (see FEPr...
const MaterialWarehouse & getMaterialWarehouse() const
const bool _bnd_dual_restrictable
Flag for allowing dual restriction with BlockRestrictable.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const std::set< BoundaryID > & meshBoundaryIds() const
Returns a read-only reference to the set of boundary IDs currently present in the Mesh...
bool hasBoundaryMaterialPropertyHelper(const std::string &prop_name) const
A helper method to avoid circular #include problems.
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const std::string & name() const
Get the name of the class.
static bool restricted(const std::set< BoundaryID > &ids)
Helper for determining if the object is boundary restricted.
Every object that can be built by the factory should be derived from this class.
boundary_id_type BoundaryID
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
const std::set< BoundaryID > & meshBoundaryIDs() const
Returns the set of all boundary ids for the entire mesh.
unsigned int numBoundaryIDs() const
Return the number of boundaries for this object.
TEST_TYPE
A flag changing the behavior of hasBoundary.
bool _bnd_nodal
Whether or not this object is restricted to nodesets.
bool isKokkosObject(IsKokkosObjectKey &&) const
Get whether this object is a Kokkos functor The parameter is set by the Kokkos base classes: ...
static InputParameters validParams()
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
std::vector< BoundaryID > _vec_ids
Vector of the boundary ids.
bool hasBoundary(const BoundaryName &name) const
Test if the supplied boundary name is valid for this object.
const MooseObject & _moose_object
The moose object that this is an interface for.
const SubdomainID ANY_BLOCK_ID
std::vector< BoundaryName > _boundary_names
Vector the the boundary names.
virtual MooseMesh & mesh() override
const std::set< SubdomainID > & _block_ids
Reference to the block_ids, defaults to an empty set if not provided.
FEProblemBase * _bnd_feproblem
Pointer to FEProblemBase.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
Returns a vector of boundary IDs for the requested element on the requested side. ...
BoundaryRestrictable(const MooseObject *moose_object, bool nodal)
Class constructor Populates the _bnd_ids for the given boundary names supplied with the 'boundary' in...
void initializeKokkosBoundaryRestrictable(MooseMesh *mesh)
const std::vector< BoundaryName > & boundaryNames() const
Return the boundary names for this object.
virtual const std::set< BoundaryID > & boundaryIDs() const
Return the boundary IDs for this object.
const BoundaryID ANY_BOUNDARY_ID