www.mooseframework.org
BoundaryRestrictable.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 // MOOSE includes
13 #include "InputParameters.h"
14 #include "MaterialData.h"
15 
16 // Forward declarations
18 class MooseMesh;
19 
20 template <>
22 
31 {
32 public:
34  enum TEST_TYPE
35  {
36  ALL,
38  };
39 
47  BoundaryRestrictable(const MooseObject * moose_object, bool nodal);
48 
57  BoundaryRestrictable(const MooseObject * moose_object,
58  const std::set<SubdomainID> & block_ids,
59  bool nodal);
60 
65  static bool restricted(const std::set<BoundaryID> & ids);
66 
70  virtual ~BoundaryRestrictable();
71 
76  const virtual std::set<BoundaryID> & boundaryIDs() const;
77 
82  const std::vector<BoundaryName> & boundaryNames() const;
83 
88  unsigned int numBoundaryIDs() const;
89 
95  bool hasBoundary(const BoundaryName & name) const;
96 
102  bool hasBoundary(const std::vector<BoundaryName> & names) const;
103 
109  bool hasBoundary(const BoundaryID & id) const;
110 
119  bool hasBoundary(const std::vector<BoundaryID> & ids, TEST_TYPE type = ALL) const;
120 
131  bool hasBoundary(const std::set<BoundaryID> & ids, TEST_TYPE type = ALL) const;
132 
140  bool isBoundarySubset(const std::set<BoundaryID> & ids) const;
141 
142  /*
143  * Test if the class boundary ids are a subset of the supplied objects
144  * @param ids A std::set of Boundary IDs to check
145  * @return True if all of the boundary ids for this class are found within the given ids (opposite
146  * of hasBoundary)
147  * \see hasBoundary
148  */
149  bool isBoundarySubset(const std::vector<BoundaryID> & ids) const;
150 
161  template <typename T>
162  bool hasBoundaryMaterialProperty(const std::string & prop_name) const;
163 
168  virtual bool boundaryRestricted() const;
169 
174  const std::set<BoundaryID> & meshBoundaryIDs() const;
175 
176 private:
179 
182 
184  std::set<BoundaryID> _bnd_ids;
185 
187  std::vector<BoundaryName> _boundary_names;
188 
191 
193  const std::set<SubdomainID> _empty_block_ids;
194 
196  const std::set<SubdomainID> & _block_ids;
197 
200 
202  std::shared_ptr<MaterialData> _bnd_material_data;
203 
206 
210  void initializeBoundaryRestrictable(const MooseObject * moose_object);
211 
212 protected:
217  bool hasBoundaryMaterialPropertyHelper(const std::string & prop_name) const;
218 };
219 
220 template <typename T>
221 bool
222 BoundaryRestrictable::hasBoundaryMaterialProperty(const std::string & prop_name) const
223 {
224  // If you get here the supplied property is defined on all boundaries, but is still subject
225  // existence in the MateialData class
226  return hasBoundaryMaterialPropertyHelper(prop_name) &&
227  _bnd_material_data->haveProperty<T>(prop_name);
228 }
229 
bool hasBoundaryMaterialProperty(const std::string &prop_name) const
Check if a material property is valid for all boundaries of this object.
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.
virtual bool boundaryRestricted() const
Returns true if this object has been restricted to a boundary.
void initializeBoundaryRestrictable(const MooseObject *moose_object)
An initialization routine needed for dual constructors.
MooseMesh * _bnd_mesh
Point to mesh.
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.
bool hasBoundaryMaterialPropertyHelper(const std::string &prop_name) const
A helper method to avoid circular #include problems.
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.
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:42
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...
Definition: MooseMesh.h:74
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.
std::shared_ptr< MaterialData > _bnd_material_data
Pointer to MaterialData for boundary (.
bool hasBoundary(const BoundaryName &name) const
Test if the supplied boundary name is valid for this object.
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...
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.
unsigned int THREAD_ID
Definition: MooseTypes.h:161