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),
47 _moose_object(*moose_object)
54 const std::set<SubdomainID> & block_ids,
56 : _bnd_feproblem(moose_object->isParamValid(
"_fe_problem_base")
59 _bnd_mesh(moose_object->isParamValid(
"_mesh") ? moose_object->getParam<
MooseMesh *>(
"_mesh")
61 _bnd_dual_restrictable(moose_object->getParam<bool>(
"_dual_restrictable")),
62 _block_ids(block_ids),
63 _bnd_tid(moose_object->isParamValid(
"_tid") ? moose_object->getParam<
THREAD_ID>(
"_tid") : 0),
66 _moose_object(*moose_object)
83 mooseError(
"The input parameters must contain a pointer to FEProblemBase via '_fe_problem' or " 84 "a pointer to the MooseMesh via '_mesh'");
107 "Attempted to restrict the object '",
109 "' to a boundary, but the object is already restricted by block(s)");
121 const std::set<BoundaryID> * valid_ids;
122 const char * message_ptr =
nullptr;
127 message_ptr =
"node sets";
132 message_ptr =
"side sets";
135 std::vector<BoundaryID> diff;
137 std::set_difference(
_bnd_ids.begin(),
141 std::back_inserter(diff));
145 std::ostringstream msg;
147 msg <<
"the following " << message_ptr <<
" (ids) do not exist on the mesh:";
148 for (
const auto &
id : diff)
154 if (std::to_string(
id) !=
name)
155 msg << sep <<
name <<
" (" <<
id <<
")";
165 msg <<
"\n\nMOOSE distinguishes between \"node sets\" and \"side sets\" depending on " 166 "whether \nyou are using \"Nodal\" or \"Integrated\" BCs respectively. Node sets " 167 "corresponding \nto your side sets are constructed for you by default.\n\n" 168 "Try setting \"Mesh/construct_side_list_from_node_list=true\" if you see this " 170 "Note: If you are running with adaptivity you should prefer using side sets.";
179 const std::set<BoundaryID> &
185 const std::vector<BoundaryName> &
194 return (
unsigned int)
_bnd_ids.size();
235 std::set<BoundaryID> ids_set(ids.begin(), ids.end());
247 else if (type ==
ALL)
252 return std::includes(
_bnd_ids.begin(),
_bnd_ids.end(), ids.begin(), ids.end());
258 for (
const auto &
id : ids)
279 return std::includes(ids.begin(),
284 return std::includes(ids.begin(), ids.end(),
_bnd_ids.begin(),
_bnd_ids.end());
290 std::set<BoundaryID> ids_set(ids.begin(), ids.end());
294 const std::set<BoundaryID> &
307 const std::set<BoundaryID> & ids =
311 for (
const auto &
id : ids)
314 std::set<std::string> declared_props;
319 const std::vector<std::shared_ptr<MaterialBase>> & mats =
321 for (
const auto & mat : mats)
323 const std::set<std::string> & mat_props = mat->getSuppliedItems();
324 declared_props.insert(mat_props.begin(), mat_props.end());
329 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.
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.
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 isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
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.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
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.
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 ...
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
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::set< SubdomainID > & _block_ids
Reference to the block_ids, defaults to an empty set if not provided.
FEProblemBase * _bnd_feproblem
Pointer to FEProblemBase.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
BoundaryRestrictable(const MooseObject *moose_object, bool nodal)
Class constructor Populates the _bnd_ids for the given boundary names supplied with the 'boundary' in...
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