www.mooseframework.org
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
BoundaryRestrictable Class Reference

/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary ids The is class the inheriting class with methods useful for limiting an object to certain boundaries. More...

#include <BoundaryRestrictable.h>

Inheritance diagram for BoundaryRestrictable:
[legend]

Public Types

enum  TEST_TYPE { ALL, ANY }
 A flag changing the behavior of hasBoundary. More...
 

Public Member Functions

 BoundaryRestrictable (const MooseObject *moose_object, bool nodal)
 Class constructor Populates the _bnd_ids for the given boundary names supplied with the 'boundary' input parameter. More...
 
 BoundaryRestrictable (const MooseObject *moose_object, const std::set< SubdomainID > &block_ids, bool nodal)
 Class constructor Populates the 'block' input parameters when an object is also block restricted, see the general class documentation for details. More...
 
virtual ~BoundaryRestrictable ()
 Empty class destructor. More...
 
virtual const std::set< BoundaryID > & boundaryIDs () const
 Return the boundary IDs for this object. More...
 
const std::vector< BoundaryName > & boundaryNames () const
 Return the boundary names for this object. More...
 
unsigned int numBoundaryIDs () const
 Return the number of boundaries for this object. More...
 
bool hasBoundary (const BoundaryName &name) const
 Test if the supplied boundary name is valid for this object. More...
 
bool hasBoundary (const std::vector< BoundaryName > &names) const
 Test if the supplied vector of boundary names are valid for this object. More...
 
bool hasBoundary (const BoundaryID &id) const
 Test if the supplied boundary ids are valid for this object. More...
 
bool hasBoundary (const std::vector< BoundaryID > &ids, TEST_TYPE type=ALL) const
 Test if the supplied vector boundary ids are valid for this object. More...
 
bool hasBoundary (const std::set< BoundaryID > &ids, TEST_TYPE type=ALL) const
 Test if the supplied set of boundary ids are valid for this object. More...
 
bool isBoundarySubset (const std::set< BoundaryID > &ids) const
 Test if the class boundary ids are a subset of the supplied objects. More...
 
bool isBoundarySubset (const std::vector< BoundaryID > &ids) const
 
template<typename T >
bool hasBoundaryMaterialProperty (const std::string &prop_name) const
 Check if a material property is valid for all boundaries of this object. More...
 
virtual bool boundaryRestricted () const
 Returns true if this object has been restricted to a boundary. More...
 
const std::set< BoundaryID > & meshBoundaryIDs () const
 Returns the set of all boundary ids for the entire mesh. More...
 

Static Public Member Functions

static bool restricted (const std::set< BoundaryID > &ids)
 Helper for determining if the object is boundary restricted. More...
 

Protected Member Functions

bool hasBoundaryMaterialPropertyHelper (const std::string &prop_name) const
 A helper method to avoid circular #include problems. More...
 

Private Member Functions

void initializeBoundaryRestrictable (const MooseObject *moose_object)
 An initialization routine needed for dual constructors. More...
 

Private Attributes

FEProblemBase_bnd_feproblem
 Pointer to FEProblemBase. More...
 
MooseMesh_bnd_mesh
 Point to mesh. More...
 
std::set< BoundaryID_bnd_ids
 Set of the boundary ids. More...
 
std::vector< BoundaryName > _boundary_names
 Vector the the boundary names. More...
 
const bool _bnd_dual_restrictable
 Flag for allowing dual restriction with BlockRestrictable. More...
 
const std::set< SubdomainID_empty_block_ids
 An empty set for referencing when block_ids is not included. More...
 
const std::set< SubdomainID > & _block_ids
 Reference to the block_ids, defaults to an empty set if not provided. More...
 
THREAD_ID _bnd_tid
 Thread id for this object. More...
 
std::shared_ptr< MaterialData_bnd_material_data
 Pointer to MaterialData for boundary (. More...
 
bool _bnd_nodal
 Whether or not this object is restricted to nodesets. More...
 

Detailed Description

/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary ids The is class the inheriting class with methods useful for limiting an object to certain boundaries.

The parameters "_boundary_id" and "boundary", which are created with validParams<BoundaryRestrictable> are used the framework.

Definition at line 31 of file BoundaryRestrictable.h.

Member Enumeration Documentation

◆ TEST_TYPE

A flag changing the behavior of hasBoundary.

Enumerator
ALL 
ANY 

Definition at line 35 of file BoundaryRestrictable.h.

Constructor & Destructor Documentation

◆ BoundaryRestrictable() [1/2]

BoundaryRestrictable::BoundaryRestrictable ( const MooseObject moose_object,
bool  nodal 
)

Class constructor Populates the _bnd_ids for the given boundary names supplied with the 'boundary' input parameter.

Parameters
parametersThe input parameters
nodalTrue indicates that the object is operating on nodesets, false for sidesets

Definition at line 36 of file BoundaryRestrictable.C.

37  : _bnd_feproblem(moose_object->isParamValid("_fe_problem_base")
38  ? moose_object->getParam<FEProblemBase *>("_fe_problem_base")
39  : NULL),
40  _bnd_mesh(moose_object->isParamValid("_mesh") ? moose_object->getParam<MooseMesh *>("_mesh")
41  : NULL),
42  _bnd_dual_restrictable(moose_object->getParam<bool>("_dual_restrictable")),
44  _bnd_tid(moose_object->isParamValid("_tid") ? moose_object->getParam<THREAD_ID>("_tid") : 0),
46  _bnd_nodal(nodal)
47 {
48  initializeBoundaryRestrictable(moose_object);
49 }
void initializeBoundaryRestrictable(const MooseObject *moose_object)
An initialization routine needed for dual constructors.
MooseMesh * _bnd_mesh
Point to mesh.
const bool _bnd_dual_restrictable
Flag for allowing dual restriction with BlockRestrictable.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition: MooseObject.h:185
THREAD_ID _bnd_tid
Thread id for this object.
const std::set< SubdomainID > _empty_block_ids
An empty set for referencing when block_ids is not included.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:72
bool _bnd_nodal
Whether or not this object is restricted to nodesets.
std::shared_ptr< MaterialData > _bnd_material_data
Pointer to MaterialData for boundary (.
std::shared_ptr< MaterialData > getMaterialData(Moose::MaterialDataType type, THREAD_ID tid=0)
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.
Definition: MooseObject.h:81
unsigned int THREAD_ID
Definition: MooseTypes.h:97

◆ BoundaryRestrictable() [2/2]

BoundaryRestrictable::BoundaryRestrictable ( const MooseObject moose_object,
const std::set< SubdomainID > &  block_ids,
bool  nodal 
)

Class constructor Populates the 'block' input parameters when an object is also block restricted, see the general class documentation for details.

Parameters
parametersThe input parameters (see the detailed help for additional information)
block_idsThe block ids that the object is restricted to
nodalTrue indicates that the object is operating on nodesets, false for sidesets

Definition at line 52 of file BoundaryRestrictable.C.

55  : _bnd_feproblem(moose_object->isParamValid("_fe_problem_base")
56  ? moose_object->getParam<FEProblemBase *>("_fe_problem_base")
57  : NULL),
58  _bnd_mesh(moose_object->isParamValid("_mesh") ? moose_object->getParam<MooseMesh *>("_mesh")
59  : NULL),
60  _bnd_dual_restrictable(moose_object->getParam<bool>("_dual_restrictable")),
61  _block_ids(block_ids),
62  _bnd_tid(moose_object->isParamValid("_tid") ? moose_object->getParam<THREAD_ID>("_tid") : 0),
64  _bnd_nodal(nodal)
65 {
66  initializeBoundaryRestrictable(moose_object);
67 }
void initializeBoundaryRestrictable(const MooseObject *moose_object)
An initialization routine needed for dual constructors.
MooseMesh * _bnd_mesh
Point to mesh.
const bool _bnd_dual_restrictable
Flag for allowing dual restriction with BlockRestrictable.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition: MooseObject.h:185
THREAD_ID _bnd_tid
Thread id for this object.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:72
bool _bnd_nodal
Whether or not this object is restricted to nodesets.
std::shared_ptr< MaterialData > _bnd_material_data
Pointer to MaterialData for boundary (.
std::shared_ptr< MaterialData > getMaterialData(Moose::MaterialDataType type, THREAD_ID tid=0)
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.
Definition: MooseObject.h:81
unsigned int THREAD_ID
Definition: MooseTypes.h:97

◆ ~BoundaryRestrictable()

BoundaryRestrictable::~BoundaryRestrictable ( )
virtual

Empty class destructor.

Definition at line 145 of file BoundaryRestrictable.C.

145 {}

Member Function Documentation

◆ boundaryIDs()

const std::set< BoundaryID > & BoundaryRestrictable::boundaryIDs ( ) const
virtual

Return the boundary IDs for this object.

Returns
A set of all boundary ids for which the object is restricted

Definition at line 148 of file BoundaryRestrictable.C.

Referenced by NonlinearSystemBase::addBoundaryCondition(), NonlinearSystemBase::addInterfaceKernel(), AutoPositionsMultiApp::fillPositions(), Material::getZeroMaterialProperty(), hasBoundaryMaterialPropertyHelper(), and Material::registerPropName().

149 {
150  return _bnd_ids;
151 }
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.

◆ boundaryNames()

const std::vector< BoundaryName > & BoundaryRestrictable::boundaryNames ( ) const

Return the boundary names for this object.

Returns
A set of all boundary names for which the object is restricted

Definition at line 154 of file BoundaryRestrictable.C.

Referenced by MaterialOutputAction::getParams(), NearestNodeDistanceAux::NearestNodeDistanceAux(), and NearestNodeValueAux::NearestNodeValueAux().

155 {
156  return _boundary_names;
157 }
std::vector< BoundaryName > _boundary_names
Vector the the boundary names.

◆ boundaryRestricted()

bool BoundaryRestrictable::boundaryRestricted ( ) const
virtual

Returns true if this object has been restricted to a boundary.

See also
MooseObject

Definition at line 166 of file BoundaryRestrictable.C.

Referenced by MaterialOutputAction::getParams(), and DerivativeMaterialInterface< Material >::haveMaterialProperty().

167 {
169 }
static bool restricted(const std::set< BoundaryID > &ids)
Helper for determining if the object is boundary restricted.
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.

◆ hasBoundary() [1/5]

bool BoundaryRestrictable::hasBoundary ( const BoundaryName &  name) const

Test if the supplied boundary name is valid for this object.

Parameters
nameA BoundaryName to check
Returns
True if the given id is valid for this object

Definition at line 178 of file BoundaryRestrictable.C.

Referenced by hasBoundary(), and hasBoundaryMaterialPropertyHelper().

179 {
180  // Create a vector and utilize the getBoundaryIDs function, which
181  // handles the ANY_BOUNDARY_ID (getBoundaryID does not)
182  return hasBoundary(_bnd_mesh->getBoundaryIDs({name}));
183 }
MooseMesh * _bnd_mesh
Point to mesh.
bool hasBoundary(const BoundaryName &name) const
Test if the supplied boundary name is valid for this object.
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. ...
Definition: MooseMesh.C:2105

◆ hasBoundary() [2/5]

bool BoundaryRestrictable::hasBoundary ( const std::vector< BoundaryName > &  names) const

Test if the supplied vector of boundary names are valid for this object.

Parameters
namesA vector of BoundaryNames to check
Returns
True if the given ids are valid for this object

Definition at line 186 of file BoundaryRestrictable.C.

187 {
188  return hasBoundary(_bnd_mesh->getBoundaryIDs(names));
189 }
MooseMesh * _bnd_mesh
Point to mesh.
bool hasBoundary(const BoundaryName &name) const
Test if the supplied boundary name is valid for this object.
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. ...
Definition: MooseMesh.C:2105

◆ hasBoundary() [3/5]

bool BoundaryRestrictable::hasBoundary ( const BoundaryID id) const

Test if the supplied boundary ids are valid for this object.

Parameters
idA BoundaryID to check
Returns
True if the given id is valid for this object

Definition at line 192 of file BoundaryRestrictable.C.

193 {
194  if (_bnd_ids.empty() || _bnd_ids.find(Moose::ANY_BOUNDARY_ID) != _bnd_ids.end())
195  return true;
196  else
197  return _bnd_ids.find(id) != _bnd_ids.end();
198 }
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.
const BoundaryID ANY_BOUNDARY_ID
Definition: MooseTypes.h:321

◆ hasBoundary() [4/5]

bool BoundaryRestrictable::hasBoundary ( const std::vector< BoundaryID > &  ids,
TEST_TYPE  type = ALL 
) const

Test if the supplied vector boundary ids are valid for this object.

Parameters
idsA vector of BoundaryIDs ids to check
typeA flag for the type of matching to perform: ALL requires that all supplied ids must match those of the object; ANY requires that any one of the supplied ids must match those of the object
Returns
True if the all of the given ids are found within the ids for this object

Definition at line 201 of file BoundaryRestrictable.C.

202 {
203  std::set<BoundaryID> ids_set(ids.begin(), ids.end());
204  return hasBoundary(ids_set, type);
205 }
bool hasBoundary(const BoundaryName &name) const
Test if the supplied boundary name is valid for this object.
MatType type

◆ hasBoundary() [5/5]

bool BoundaryRestrictable::hasBoundary ( const std::set< BoundaryID > &  ids,
TEST_TYPE  type = ALL 
) const

Test if the supplied set of boundary ids are valid for this object.

Parameters
idsA std::set of BoundaryIDs to check
typeA flag for the type of matching to perform: ALL requires that all supplied ids must match those of the object; ANY requires that any one of the supplied ids must match those of the object
Returns
True if the all of the given ids are found within the ids for this object
See also
isSubset

Definition at line 208 of file BoundaryRestrictable.C.

209 {
210  // An empty input is assumed to be ANY_BOUNDARY_ID
211  if (ids.empty() || ids.find(Moose::ANY_BOUNDARY_ID) != ids.end())
212  return true;
213 
214  // All supplied IDs must match those of the object
215  else if (type == ALL)
216  {
217  if (_bnd_ids.find(Moose::ANY_BOUNDARY_ID) != _bnd_ids.end())
218  return true;
219  else
220  return std::includes(_bnd_ids.begin(), _bnd_ids.end(), ids.begin(), ids.end());
221  }
222  // Any of the supplied IDs must match those of the object
223  else
224  {
225  // Loop through the supplied ids
226  for (const auto & id : ids)
227  {
228  // Test the current supplied id
229  bool test = hasBoundary(id);
230 
231  // If the id exists in the stored ids, then return true, otherwise
232  if (test)
233  return true;
234  }
235  return false;
236  }
237 }
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.
bool hasBoundary(const BoundaryName &name) const
Test if the supplied boundary name is valid for this object.
MatType type
const BoundaryID ANY_BOUNDARY_ID
Definition: MooseTypes.h:321

◆ hasBoundaryMaterialProperty()

template<typename T >
bool BoundaryRestrictable::hasBoundaryMaterialProperty ( const std::string &  prop_name) const

Check if a material property is valid for all boundaries of this object.

This method returns true if the supplied property name has been declared in a Material object on the boundary ids for this object.

Template Parameters
TThe type of material property
Parameters
prop_namethe name of the property to query
Returns
true if the property exists for all boundary ids of the object, otherwise false

Definition at line 223 of file BoundaryRestrictable.h.

224 {
225  // If you get here the supplied property is defined on all boundaries, but is still subject
226  // existence in the MateialData class
227  return hasBoundaryMaterialPropertyHelper(prop_name) &&
228  _bnd_material_data->haveProperty<T>(prop_name);
229 }
bool hasBoundaryMaterialPropertyHelper(const std::string &prop_name) const
A helper method to avoid circular #include problems.
std::shared_ptr< MaterialData > _bnd_material_data
Pointer to MaterialData for boundary (.

◆ hasBoundaryMaterialPropertyHelper()

bool BoundaryRestrictable::hasBoundaryMaterialPropertyHelper ( const std::string &  prop_name) const
protected

A helper method to avoid circular #include problems.

See also
hasBoundaryMaterialProperty

Definition at line 269 of file BoundaryRestrictable.C.

Referenced by hasBoundaryMaterialProperty().

270 {
271  // Reference to MaterialWarehouse for testing and retrieving boundary ids
273 
274  // Complete set of BoundaryIDs that this object is defined
275  const std::set<BoundaryID> & ids =
277 
278  // Loop over each BoundaryID for this object
279  for (const auto & id : ids)
280  {
281  // Storage of material properties that have been DECLARED on this BoundaryID
282  std::set<std::string> declared_props;
283 
284  // If boundary materials exist, populated the set of properties that were declared
285  if (warehouse.hasActiveBoundaryObjects(id))
286  {
287  const std::vector<std::shared_ptr<Material>> & mats = warehouse.getActiveBoundaryObjects(id);
288  for (const auto & mat : mats)
289  {
290  const std::set<std::string> & mat_props = mat->getSuppliedItems();
291  declared_props.insert(mat_props.begin(), mat_props.end());
292  }
293  }
294 
295  // If the supplied property is not in the list of properties on the current id, return false
296  if (declared_props.find(prop_name) == declared_props.end())
297  return false;
298  }
299 
300  // If you get here the supplied property is defined on all boundaries
301  return true;
302 }
Material objects are special in that they have additional objects created automatically (see FEProble...
const MaterialWarehouse & getMaterialWarehouse() const
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const std::set< BoundaryID > & meshBoundaryIDs() const
Returns the set of all boundary ids for the entire mesh.
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
bool hasBoundary(const BoundaryName &name) const
Test if the supplied boundary name is valid for this object.
FEProblemBase * _bnd_feproblem
Pointer to FEProblemBase.
virtual const std::set< BoundaryID > & boundaryIDs() const
Return the boundary IDs for this object.
const BoundaryID ANY_BOUNDARY_ID
Definition: MooseTypes.h:321

◆ initializeBoundaryRestrictable()

void BoundaryRestrictable::initializeBoundaryRestrictable ( const MooseObject moose_object)
private

An initialization routine needed for dual constructors.

Definition at line 70 of file BoundaryRestrictable.C.

Referenced by BoundaryRestrictable().

71 {
72  // The name and id of the object
73  const std::string & name = moose_object->getParam<std::string>("_object_name");
74 
75  // If the mesh pointer is not defined, but FEProblemBase is, get it from there
76  if (_bnd_feproblem != NULL && _bnd_mesh == NULL)
78 
79  // Check that the mesh pointer was defined, it is required for this class to operate
80  if (_bnd_mesh == NULL)
81  mooseError("The input parameters must contain a pointer to FEProblemBase via '_fe_problem' or "
82  "a pointer to the MooseMesh via '_mesh'");
83 
84  // If the user supplies boundary IDs
85  if (moose_object->isParamValid("boundary"))
86  {
87  // Extract the blocks from the input
88  _boundary_names = moose_object->getParam<std::vector<BoundaryName>>("boundary");
89 
90  // Get the IDs from the supplied names
91  std::vector<BoundaryID> vec_ids = _bnd_mesh->getBoundaryIDs(_boundary_names, true);
92 
93  // Store the IDs, handling ANY_BOUNDARY_ID if supplied
94  if (std::find(_boundary_names.begin(), _boundary_names.end(), "ANY_BOUNDARY_ID") !=
95  _boundary_names.end())
97  else
98  _bnd_ids.insert(vec_ids.begin(), vec_ids.end());
99  }
100 
101  // Produce error if the object is not allowed to be both block and boundary restricted
102  if (!_bnd_dual_restrictable && !_bnd_ids.empty() && !_block_ids.empty())
103  if (!_block_ids.empty() && _block_ids.find(Moose::ANY_BLOCK_ID) == _block_ids.end())
104  mooseError("Attempted to restrict the object '",
105  name,
106  "' to a boundary, but the object is already restricted by block(s)");
107 
108  // Store ANY_BOUNDARY_ID if empty
109  if (_bnd_ids.empty())
110  {
112  _boundary_names = {"ANY_BOUNDARY_ID"};
113  }
114 
115  // If this object is block restricted, check that defined blocks exist on the mesh
116  if (_bnd_ids.find(Moose::ANY_BOUNDARY_ID) == _bnd_ids.end())
117  {
118  const std::set<BoundaryID> * valid_ids;
119 
120  if (_bnd_nodal)
121  valid_ids = &_bnd_mesh->meshNodesetIds();
122  else
123  valid_ids = &_bnd_mesh->meshSidesetIds();
124 
125  std::vector<BoundaryID> diff;
126 
127  std::set_difference(_bnd_ids.begin(),
128  _bnd_ids.end(),
129  valid_ids->begin(),
130  valid_ids->end(),
131  std::back_inserter(diff));
132 
133  if (!diff.empty())
134  {
135  std::ostringstream msg;
136  msg << "The object '" << name
137  << "' contains the following boundary ids that do not exist on the mesh:";
138  for (const auto & id : diff)
139  msg << " " << id;
140  mooseError(msg.str());
141  }
142  }
143 }
const std::set< BoundaryID > & meshNodesetIds() const
Returns a read-only reference to the set of nodesets currently present in the Mesh.
Definition: MooseMesh.C:2279
const std::set< BoundaryID > & meshSidesetIds() const
Returns a read-only reference to the set of sidesets currently present in the Mesh.
Definition: MooseMesh.C:2273
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
MooseMesh * _bnd_mesh
Point to mesh.
const bool _bnd_dual_restrictable
Flag for allowing dual restriction with BlockRestrictable.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition: MooseObject.h:185
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.
bool _bnd_nodal
Whether or not this object is restricted to nodesets.
const SubdomainID ANY_BLOCK_ID
Definition: MooseTypes.h:319
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. ...
Definition: MooseMesh.C:2105
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.
Definition: MooseObject.h:81
const BoundaryID ANY_BOUNDARY_ID
Definition: MooseTypes.h:321

◆ isBoundarySubset() [1/2]

bool BoundaryRestrictable::isBoundarySubset ( const std::set< BoundaryID > &  ids) const

Test if the class boundary ids are a subset of the supplied objects.

Parameters
idsA std::set of boundaries to check
Returns
True if all of the boundary ids for this class are found within the given ids (opposite of hasBoundary)
See also
hasBoundary

Definition at line 240 of file BoundaryRestrictable.C.

Referenced by isBoundarySubset().

241 {
242  // An empty input is assumed to be ANY_BOUNDARY_ID
243  if (ids.empty() || ids.find(Moose::ANY_BOUNDARY_ID) != ids.end())
244  return true;
245 
246  if (_bnd_ids.find(Moose::ANY_BOUNDARY_ID) != _bnd_ids.end())
247  return std::includes(ids.begin(),
248  ids.end(),
249  _bnd_mesh->meshBoundaryIds().begin(),
250  _bnd_mesh->meshBoundaryIds().end());
251  else
252  return std::includes(ids.begin(), ids.end(), _bnd_ids.begin(), _bnd_ids.end());
253 }
MooseMesh * _bnd_mesh
Point to mesh.
const std::set< BoundaryID > & meshBoundaryIds() const
Returns a read-only reference to the set of boundary IDs currently present in the Mesh...
Definition: MooseMesh.C:2267
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.
const BoundaryID ANY_BOUNDARY_ID
Definition: MooseTypes.h:321

◆ isBoundarySubset() [2/2]

bool BoundaryRestrictable::isBoundarySubset ( const std::vector< BoundaryID > &  ids) const

Definition at line 256 of file BoundaryRestrictable.C.

257 {
258  std::set<BoundaryID> ids_set(ids.begin(), ids.end());
259  return isBoundarySubset(ids_set);
260 }
bool isBoundarySubset(const std::set< BoundaryID > &ids) const
Test if the class boundary ids are a subset of the supplied objects.

◆ meshBoundaryIDs()

const std::set< BoundaryID > & BoundaryRestrictable::meshBoundaryIDs ( ) const

Returns the set of all boundary ids for the entire mesh.

Returns
A const reference the the boundary ids for the entire mesh

Definition at line 263 of file BoundaryRestrictable.C.

Referenced by hasBoundaryMaterialPropertyHelper().

264 {
265  return _bnd_mesh->getBoundaryIDs();
266 }
MooseMesh * _bnd_mesh
Point to 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. ...
Definition: MooseMesh.C:2105

◆ numBoundaryIDs()

unsigned int BoundaryRestrictable::numBoundaryIDs ( ) const

Return the number of boundaries for this object.

Returns
The number of boundary ids

Definition at line 160 of file BoundaryRestrictable.C.

161 {
162  return (unsigned int)_bnd_ids.size();
163 }
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.

◆ restricted()

bool BoundaryRestrictable::restricted ( const std::set< BoundaryID > &  ids)
static

Helper for determining if the object is boundary restricted.

This is needed for the MaterialPropertyInterface.

Definition at line 172 of file BoundaryRestrictable.C.

Referenced by boundaryRestricted().

173 {
174  return ids.find(Moose::ANY_BOUNDARY_ID) == ids.end();
175 }
const BoundaryID ANY_BOUNDARY_ID
Definition: MooseTypes.h:321

Member Data Documentation

◆ _block_ids

const std::set<SubdomainID>& BoundaryRestrictable::_block_ids
private

Reference to the block_ids, defaults to an empty set if not provided.

Definition at line 197 of file BoundaryRestrictable.h.

Referenced by initializeBoundaryRestrictable().

◆ _bnd_dual_restrictable

const bool BoundaryRestrictable::_bnd_dual_restrictable
private

Flag for allowing dual restriction with BlockRestrictable.

Definition at line 191 of file BoundaryRestrictable.h.

Referenced by initializeBoundaryRestrictable().

◆ _bnd_feproblem

FEProblemBase* BoundaryRestrictable::_bnd_feproblem
private

◆ _bnd_ids

std::set<BoundaryID> BoundaryRestrictable::_bnd_ids
private

◆ _bnd_material_data

std::shared_ptr<MaterialData> BoundaryRestrictable::_bnd_material_data
private

Pointer to MaterialData for boundary (.

See also
hasBoundaryMaterialProperty)

Definition at line 203 of file BoundaryRestrictable.h.

Referenced by hasBoundaryMaterialProperty().

◆ _bnd_mesh

MooseMesh* BoundaryRestrictable::_bnd_mesh
private

Point to mesh.

Definition at line 182 of file BoundaryRestrictable.h.

Referenced by hasBoundary(), initializeBoundaryRestrictable(), isBoundarySubset(), and meshBoundaryIDs().

◆ _bnd_nodal

bool BoundaryRestrictable::_bnd_nodal
private

Whether or not this object is restricted to nodesets.

Definition at line 206 of file BoundaryRestrictable.h.

Referenced by initializeBoundaryRestrictable().

◆ _bnd_tid

THREAD_ID BoundaryRestrictable::_bnd_tid
private

Thread id for this object.

Definition at line 200 of file BoundaryRestrictable.h.

◆ _boundary_names

std::vector<BoundaryName> BoundaryRestrictable::_boundary_names
private

Vector the the boundary names.

Definition at line 188 of file BoundaryRestrictable.h.

Referenced by boundaryNames(), and initializeBoundaryRestrictable().

◆ _empty_block_ids

const std::set<SubdomainID> BoundaryRestrictable::_empty_block_ids
private

An empty set for referencing when block_ids is not included.

Definition at line 194 of file BoundaryRestrictable.h.


The documentation for this class was generated from the following files: