www.mooseframework.org
VariableWarehouse.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 VARIABLEWAREHOUSE_H
16 #define VARIABLEWAREHOUSE_H
17 
18 #include "MooseTypes.h"
19 
20 #include <vector>
21 #include <map>
22 #include <set>
23 
24 class MooseVariableBase;
25 class MooseVariable;
27 
32 {
33 public:
35  virtual ~VariableWarehouse();
36 
42  void add(const std::string & var_name, MooseVariableBase * var);
43 
49  void addBoundaryVar(BoundaryID bnd, MooseVariable * var);
50 
56  void addBoundaryVar(const std::set<BoundaryID> & boundary_ids, MooseVariable * var);
57 
63  void addBoundaryVars(const std::set<BoundaryID> & boundary_ids,
64  const std::map<std::string, std::vector<MooseVariable *>> & vars);
65 
71  MooseVariableBase * getVariable(const std::string & var_name);
72 
78  MooseVariableBase * getVariable(unsigned int var_number);
79 
84  const std::vector<VariableName> & names() const;
85 
90  const std::vector<MooseVariable *> & variables();
91 
97  const std::set<MooseVariable *> & boundaryVars(BoundaryID bnd);
98 
103  const std::vector<MooseVariableScalar *> & scalars();
104 
105 protected:
107  std::vector<VariableName> _names;
109  std::vector<MooseVariable *> _vars;
111  std::map<std::string, MooseVariableBase *> _var_name;
113  std::map<BoundaryID, std::set<MooseVariable *>> _boundary_vars;
114 
116  std::vector<MooseVariableScalar *> _scalar_vars;
117 
119  std::vector<MooseVariableBase *> _all_objects;
120 };
121 
122 #endif // VARIABLEWAREHOUSE_H
void add(const std::string &var_name, MooseVariableBase *var)
Add a variable.
virtual ~VariableWarehouse()
std::vector< MooseVariableScalar * > _scalar_vars
list of all variables
Class for stuff related to variables.
Definition: MooseVariable.h:43
void addBoundaryVar(BoundaryID bnd, MooseVariable *var)
Add a boundary variable.
const std::vector< MooseVariableScalar * > & scalars()
Get the list of scalar variables.
MooseVariableBase * getVariable(const std::string &var_name)
Get a variable from the warehouse.
const std::vector< MooseVariable * > & variables()
Get the list of variables.
std::vector< MooseVariableBase * > _all_objects
All instances of objects (raw pointers)
const std::set< MooseVariable * > & boundaryVars(BoundaryID bnd)
Get the list of variables that needs to be reinitialized on a given boundary.
std::map< std::string, MooseVariableBase * > _var_name
Name to variable mapping.
Holds variables and provides some services.
std::vector< MooseVariable * > _vars
list of "normal" variables
const std::vector< VariableName > & names() const
Get the list of all variable names.
std::vector< VariableName > _names
list of variable names
void addBoundaryVars(const std::set< BoundaryID > &boundary_ids, const std::map< std::string, std::vector< MooseVariable * >> &vars)
Add a map of variables to a set of boundaries.
Class for scalar variables (they are different).
std::map< BoundaryID, std::set< MooseVariable * > > _boundary_vars
Map to variables that need to be evaluated on a boundary.
boundary_id_type BoundaryID
Definition: MooseTypes.h:75