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()
48 ? _bnd_feproblem->getKokkosMaterialData(
Moose::BOUNDARY_MATERIAL_DATA)
51 _bnd_feproblem->getMaterialData(
Moose::BOUNDARY_MATERIAL_DATA, _bnd_tid)),
53 _moose_object(*moose_object)
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()
73 ? _bnd_feproblem->getKokkosMaterialData(
Moose::BOUNDARY_MATERIAL_DATA)
76 _bnd_feproblem->getMaterialData(
Moose::BOUNDARY_MATERIAL_DATA, _bnd_tid)),
78 _moose_object(*moose_object)
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 <<
")";
176 const auto & other_ids =
178 std::vector<BoundaryID> other_boundary_ids;
179 std::set_intersection(diff.begin(),
183 std::back_inserter(other_boundary_ids));
184 if (!other_boundary_ids.empty())
186 msg <<
"\n\nThe following boundary ";
187 if (other_boundary_ids.size() == 1)
191 if (other_boundary_ids.size() == 1)
192 msg <<
" as " << (
_bnd_nodal ?
"a side set" :
"a node set")
193 <<
" but is being requested as " << (
_bnd_nodal ?
"a node set" :
"a side set") <<
":";
195 msg <<
" as " << (
_bnd_nodal ?
"side sets" :
"node sets")
196 <<
" but are being requested as " << (
_bnd_nodal ?
"node sets" :
"side sets") <<
":";
199 for (
const auto id : other_boundary_ids)
206 msg <<
"\n\nTry setting Mesh/construct_side_list_from_node_list=true if you want side "
207 "sets constructed from node sets.";
214#ifdef MOOSE_KOKKOS_ENABLED
223const std::set<BoundaryID> &
229const std::vector<BoundaryName> &
238 return (
unsigned int)
_bnd_ids.size();
279 std::set<BoundaryID> ids_set(ids.begin(), ids.end());
291 else if (type ==
ALL)
296 return std::includes(
_bnd_ids.begin(),
_bnd_ids.end(), ids.begin(), ids.end());
302 for (
const auto &
id : ids)
323 return std::includes(ids.begin(),
328 return std::includes(ids.begin(), ids.end(),
_bnd_ids.begin(),
_bnd_ids.end());
334 std::set<BoundaryID> ids_set(ids.begin(), ids.end());
338const std::set<BoundaryID> &
351 const std::set<BoundaryID> & ids =
355 for (
const auto &
id : ids)
358 std::set<std::string> declared_props;
363 const std::vector<std::shared_ptr<MaterialBase>> & mats =
365 for (
const auto & mat : mats)
367 const std::set<std::string> & mat_props = mat->getSuppliedItems();
368 declared_props.insert(mat_props.begin(), mat_props.end());
373 if (declared_props.find(prop_name) == declared_props.end())
boundary_id_type BoundaryID
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
const bool _bnd_dual_restrictable
Flag for allowing dual restriction with BlockRestrictable.
FEProblemBase * _bnd_feproblem
Pointer to FEProblemBase.
MooseMesh * _bnd_mesh
Point to mesh.
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()
bool hasBoundary(const BoundaryName &name) const
Test if the supplied boundary name is valid for this object.
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.
virtual ~BoundaryRestrictable()
Empty class destructor.
const std::set< SubdomainID > & _block_ids
Reference to the block_ids, defaults to an empty set if not provided.
bool hasBoundaryMaterialPropertyHelper(const std::string &prop_name) const
A helper method to avoid circular #include problems.
bool isBoundarySubset(const std::set< BoundaryID > &ids) const
Test if the class boundary ids are a subset of the supplied objects.
static bool restricted(const std::set< BoundaryID > &ids)
Helper for determining if the object is boundary restricted.
bool _bnd_nodal
Whether or not this object is restricted to nodesets.
const std::vector< BoundaryName > & boundaryNames() const
Return the boundary names for this object.
TEST_TYPE
A flag changing the behavior of hasBoundary.
virtual bool boundaryRestricted() const
Returns true if this object has been restricted to a boundary.
const std::set< BoundaryID > & meshBoundaryIDs() const
Returns the set of all boundary ids for the entire mesh.
const MooseObject & _moose_object
The moose object that this is an interface for.
static InputParameters validParams()
std::vector< BoundaryID > _vec_ids
Vector of the boundary ids.
std::vector< BoundaryName > _boundary_names
Vector the the boundary names.
virtual const std::set< BoundaryID > & boundaryIDs() const
Return the boundary IDs for this object.
void initializeBoundaryRestrictable()
An initialization routine needed for dual constructors.
unsigned int numBoundaryIDs() const
Return the number of boundaries for this object.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
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 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...
const std::set< BoundaryID > & meshNodesetIds() const
Returns a read-only reference to the set of nodesets currently present in the Mesh.
const std::set< BoundaryID > & meshBoundaryIds() const
Returns a read-only reference to the set of boundary IDs currently present in the Mesh.
const std::set< BoundaryID > & meshSidesetIds() const
Returns a read-only reference to the set of sidesets currently present in the Mesh.
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.
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
bool hasActiveBoundaryObjects(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...
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
const SubdomainID ANY_BLOCK_ID
const BoundaryID ANY_BOUNDARY_ID