www.mooseframework.org
BlockRestrictable.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 BLOCKRESTRICTABLE_H
16 #define BLOCKRESTRICTABLE_H
17 
18 // MOOSE includes
19 #include "InputParameters.h"
20 #include "ParallelUniqueId.h"
21 #include "MaterialData.h"
22 #include "MooseObject.h"
23 
24 // Forward declarations
25 class BlockRestrictable;
26 class FEProblemBase;
27 class MooseMesh;
28 class MooseVariable;
29 
30 template <>
32 
66 {
67 public:
73  BlockRestrictable(const MooseObject * moose_object);
74 
82  BlockRestrictable(const MooseObject * moose_object, const std::set<BoundaryID> & boundary_ids);
83 
88  virtual ~BlockRestrictable() {}
89 
98  const std::vector<SubdomainName> & blocks() const;
99 
104  unsigned int numBlocks() const;
105 
110  const virtual std::set<SubdomainID> & blockIDs() const;
111 
117  bool hasBlocks(const SubdomainName & name) const;
118 
124  bool hasBlocks(const std::vector<SubdomainName> & names) const;
125 
131  bool hasBlocks(const SubdomainID & id) const;
132 
138  bool hasBlocks(const std::vector<SubdomainID> & ids) const;
139 
146  bool hasBlocks(const std::set<SubdomainID> & ids) const;
147 
155  bool isBlockSubset(const std::set<SubdomainID> & ids) const;
156 
164  bool isBlockSubset(const std::vector<SubdomainID> & ids) const;
165 
178  template <typename T>
179  bool hasBlockMaterialProperty(const std::string & prop_name);
180 
185  const std::set<SubdomainID> & meshBlockIDs() const;
186 
191  virtual bool blockRestricted() const;
192 
199  void checkVariable(const MooseVariable & variable) const;
200 
201 protected:
203  std::shared_ptr<MaterialData> _blk_material_data;
204 
210  virtual bool hasBlockMaterialPropertyHelper(const std::string & prop_name);
211 
215  void initializeBlockRestrictable(const MooseObject * moose_object);
216 
222 
223 private:
225  std::set<SubdomainID> _blk_ids;
226 
228  std::vector<SubdomainName> _blocks;
229 
232 
235 
238 
240  const std::set<BoundaryID> _empty_boundary_ids;
241 
243  const std::set<BoundaryID> & _boundary_ids;
244 
247 
249  const std::string & _blk_name;
250 };
251 
252 template <typename T>
253 bool
254 BlockRestrictable::hasBlockMaterialProperty(const std::string & prop_name)
255 {
256  mooseAssert(_blk_material_data != NULL, "MaterialData pointer is not defined");
257  return hasBlockMaterialPropertyHelper(prop_name) &&
258  _blk_material_data->haveProperty<T>(prop_name);
259 }
260 
261 #endif // BLOCKRESTRICTABLE_H
virtual const std::set< SubdomainID > & blockIDs() const
Return the block subdomain ids for this object.
bool isBlockSubset(const std::set< SubdomainID > &ids) const
Test if the class block ids are a subset of the supplied objects.
const bool _blk_dual_restrictable
Flag for allowing dual restriction.
Class for stuff related to variables.
Definition: MooseVariable.h:43
InputParameters validParams< BlockRestrictable >()
subdomain_id_type SubdomainID
Definition: MooseTypes.h:77
const std::vector< SubdomainName > & blocks() const
Return the block names for this object.
const std::set< SubdomainID > & meshBlockIDs() const
Return all of the SubdomainIDs for the mesh.
Moose::CoordinateSystemType getBlockCoordSystem()
Check if the blocks this object operates on all have the same coordinate system, and if so return it...
FEProblemBase * _blk_feproblem
Pointer to FEProblemBase.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
std::shared_ptr< MaterialData > _blk_material_data
Pointer to the MaterialData class for this object.
void initializeBlockRestrictable(const MooseObject *moose_object)
An initialization routine needed for dual constructors.
virtual ~BlockRestrictable()
Destructor: does nothing but needs to be marked as virtual since this class defines virtual functions...
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:36
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
BlockRestrictable(const MooseObject *moose_object)
Class constructor Populates the &#39;block&#39; input parameters, see the general class documentation for det...
THREAD_ID _blk_tid
Thread id for this object.
bool hasBlockMaterialProperty(const std::string &prop_name)
Check if a material property is valid for all blocks of this object.
std::vector< SubdomainName > _blocks
Vector the block names supplied by the user via the input file.
unsigned int numBlocks() const
Return the number of blocks for this object.
bool hasBlocks(const SubdomainName &name) const
Test if the supplied block name is valid for this object.
CoordinateSystemType
Definition: MooseTypes.h:212
const std::set< BoundaryID > _empty_boundary_ids
An empty set for referencing when boundary_ids is not included.
void checkVariable(const MooseVariable &variable) const
Helper for checking that the ids for this object are in agreement with the variables on the supplied ...
An interface that restricts an object to subdomains via the &#39;blocks&#39; input parameter.
virtual bool hasBlockMaterialPropertyHelper(const std::string &prop_name)
A helper method to allow the Material object to specialize the behavior of hasBlockMaterialProperty.
const std::set< BoundaryID > & _boundary_ids
Reference to the boundary_ids, defaults to an empty set if not provided.
std::set< SubdomainID > _blk_ids
Set of block ids supplied by the user via the input file (for error reporting)
const std::string & _blk_name
Name of the object.
MooseMesh * _blk_mesh
Pointer to Mesh.
unsigned int THREAD_ID
Definition: MooseTypes.h:79
virtual bool blockRestricted() const
Returns true if this object has been restricted to a boundary.