www.mooseframework.org
BoundaryRestrictable.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef BOUNDARYRESTRICTABLE_H
16 #define BOUNDARYRESTRICTABLE_H
17 
18 // MOOSE includes
19 #include "InputParameters.h"
20 #include "MaterialData.h"
21 
22 // Forward declarations
24 class MooseMesh;
25 
26 template <>
28 
37 {
38 public:
40  enum TEST_TYPE
41  {
42  ALL,
44  };
45 
53  BoundaryRestrictable(const MooseObject * moose_object, bool nodal);
54 
63  BoundaryRestrictable(const MooseObject * moose_object,
64  const std::set<SubdomainID> & block_ids,
65  bool nodal);
66 
71  static bool restricted(const std::set<BoundaryID> & ids);
72 
76  virtual ~BoundaryRestrictable();
77 
82  const virtual std::set<BoundaryID> & boundaryIDs() const;
83 
88  const std::vector<BoundaryName> & boundaryNames() const;
89 
94  unsigned int numBoundaryIDs() const;
95 
101  bool hasBoundary(const BoundaryName & name) const;
102 
108  bool hasBoundary(const std::vector<BoundaryName> & names) const;
109 
115  bool hasBoundary(const BoundaryID & id) const;
116 
125  bool hasBoundary(const std::vector<BoundaryID> & ids, TEST_TYPE type = ALL) const;
126 
137  bool hasBoundary(const std::set<BoundaryID> & ids, TEST_TYPE type = ALL) const;
138 
146  bool isBoundarySubset(const std::set<BoundaryID> & ids) const;
147 
148  /*
149  * Test if the class boundary ids are a subset of the supplied objects
150  * @param ids A std::set of Boundary IDs to check
151  * @return True if all of the boundary ids for this class are found within the given ids (opposite
152  * of hasBoundary)
153  * \see hasBoundary
154  */
155  bool isBoundarySubset(const std::vector<BoundaryID> & ids) const;
156 
167  template <typename T>
168  bool hasBoundaryMaterialProperty(const std::string & prop_name) const;
169 
174  virtual bool boundaryRestricted() const;
175 
180  const std::set<BoundaryID> & meshBoundaryIDs() const;
181 
182 private:
185 
188 
190  std::set<BoundaryID> _bnd_ids;
191 
193  std::vector<BoundaryName> _boundary_names;
194 
197 
199  const std::set<SubdomainID> _empty_block_ids;
200 
202  const std::set<SubdomainID> & _block_ids;
203 
206 
208  std::shared_ptr<MaterialData> _bnd_material_data;
209 
212 
216  void initializeBoundaryRestrictable(const MooseObject * moose_object);
217 
218 protected:
223  bool hasBoundaryMaterialPropertyHelper(const std::string & prop_name) const;
224 };
225 
226 template <typename T>
227 bool
228 BoundaryRestrictable::hasBoundaryMaterialProperty(const std::string & prop_name) const
229 {
230  // If you get here the supplied property is defined on all boundaries, but is still subject
231  // existence in the MateialData class
232  return hasBoundaryMaterialPropertyHelper(prop_name) &&
233  _bnd_material_data->haveProperty<T>(prop_name);
234 }
235 
236 #endif // BOUNDARYRESTRICTABLE_H
virtual const std::set< BoundaryID > & boundaryIDs() const
Return the boundary IDs for this object.
virtual ~BoundaryRestrictable()
Empty class destructor.
unsigned int numBoundaryIDs() const
Return the number of boundaries for this object.
bool hasBoundaryMaterialPropertyHelper(const std::string &prop_name) const
A helper method to avoid circular #include problems.
void initializeBoundaryRestrictable(const MooseObject *moose_object)
An initialization routine needed for dual constructors.
MooseMesh * _bnd_mesh
Point to mesh.
virtual bool boundaryRestricted() const
Returns true if this object has been restricted to a boundary.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary...
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 the set of all boundary ids for the entire mesh.
const std::vector< BoundaryName > & boundaryNames() const
Return the boundary names for this object.
THREAD_ID _bnd_tid
Thread id for this object.
bool hasBoundaryMaterialProperty(const std::string &prop_name) const
Check if a material property is valid for all boundaries of this object.
const std::set< SubdomainID > _empty_block_ids
An empty set for referencing when block_ids is not included.
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.
Definition: MooseObject.h:36
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.
bool isBoundarySubset(const std::set< BoundaryID > &ids) const
Test if the class boundary ids are a subset of the supplied objects.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
bool hasBoundary(const BoundaryName &name) const
Test if the supplied boundary name is valid for this object.
TEST_TYPE
A flag changing the behavior of hasBoundary.
bool _bnd_nodal
Whether or not this object is restricted to nodesets.
std::shared_ptr< MaterialData > _bnd_material_data
Pointer to MaterialData for boundary (.
MatType type
std::vector< BoundaryName > _boundary_names
Vector the the boundary names.
InputParameters validParams< BoundaryRestrictable >()
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.
BoundaryRestrictable(const MooseObject *moose_object, bool nodal)
Class constructor Populates the _bnd_ids for the given boundary names supplied with the &#39;boundary&#39; in...
unsigned int THREAD_ID
Definition: MooseTypes.h:79
boundary_id_type BoundaryID
Definition: MooseTypes.h:75