22 _names.push_back(var_name);
23 auto * raw_var = var.get();
27 if (
auto * tmp_var = dynamic_cast<MooseVariableFieldBase *>(raw_var))
29 _vars.push_back(tmp_var);
30 if (
auto * tmp_var = dynamic_cast<MooseVariable *>(raw_var))
35 else if (
auto * tmp_var = dynamic_cast<MooseVariableFVReal *>(raw_var))
40 else if (
auto * tmp_var = dynamic_cast<MooseLinearVariableFVReal *>(raw_var))
45 else if (
auto * tmp_var = dynamic_cast<VectorMooseVariable *>(raw_var))
50 else if (
auto * tmp_var = dynamic_cast<ArrayMooseVariable *>(raw_var))
56 mooseError(
"Unknown variable class passed into VariableWarehouse. Attempt to hack us?");
58 else if (
auto * tmp_var = dynamic_cast<MooseVariableScalar *>(raw_var))
61 mooseError(
"Unknown variable class passed into VariableWarehouse. Attempt to hack us?");
74 for (
const auto & bid : boundary_ids)
80 const std::set<BoundaryID> & boundary_ids,
81 const std::unordered_map<std::string, std::vector<MooseVariableFEBase *>> &
vars)
83 for (
const auto & bid : boundary_ids)
84 for (
const auto & it :
vars)
85 for (
const auto & var : it.second)
104 return it->second.get();
109 const std::vector<VariableName> &
115 const std::vector<MooseVariableFEBase *> &
121 const std::vector<MooseVariableScalar *> &
127 const std::set<const MooseVariableFEBase *> &
135 template <
typename T,
typename Map,
typename Key>
137 getFieldVariableHelper(
const Map & map,
const Key & key,
const std::string & container_name)
143 auto it = map.find(key);
145 mooseError(
"Key '", key,
"' not found in VariableWarehouse container '", container_name,
"'");
151 template <
typename T>
158 template <
typename T>
167 VariableWarehouse::getFieldVariable<RealVectorValue>(
const std::string & var_name)
169 return getFieldVariableHelper<RealVectorValue>(
170 _vector_vars_by_name, var_name,
"_vector_vars_by_name");
175 VariableWarehouse::getFieldVariable<RealVectorValue>(
unsigned int var_number)
177 return getFieldVariableHelper<RealVectorValue>(
178 _vector_vars_by_number, var_number,
"_vector_vars_by_number");
183 VariableWarehouse::getFieldVariable<RealEigenVector>(
const std::string & var_name)
185 return getFieldVariableHelper<RealEigenVector>(
186 _array_vars_by_name, var_name,
"_array_vars_by_name");
191 VariableWarehouse::getFieldVariable<RealEigenVector>(
unsigned int var_number)
193 return getFieldVariableHelper<RealEigenVector>(
194 _array_vars_by_number, var_number,
"_array_vars_by_number");
198 VariableWarehouse::getFieldVariable<Real>(
const std::string & var_name);
201 template <
typename T>
210 return it_fv->second;
214 template <
typename T>
223 return it_fv->second;
229 VariableWarehouse::getActualFieldVariable<RealVectorValue>(
const std::string & var_name)
233 return getFieldVariable<RealVectorValue>(var_name);
238 VariableWarehouse::getActualFieldVariable<RealVectorValue>(
unsigned int var_number)
242 return getFieldVariable<RealVectorValue>(var_number);
247 VariableWarehouse::getActualFieldVariable<RealEigenVector>(
const std::string & var_name)
249 return getFieldVariable<RealEigenVector>(var_name);
254 VariableWarehouse::getActualFieldVariable<RealEigenVector>(
unsigned int var_number)
256 return getFieldVariable<RealEigenVector>(var_number);
263 pair.second->initialSetup();
270 pair.second->timestepSetup();
277 pair.second->customSetup(exec_type);
284 pair.second->subdomainSetup();
291 pair.second->jacobianSetup();
298 pair.second->residualSetup();
304 for (
auto * var :
_vars)
305 var->clearAllDofIndices();
311 for (
auto * var :
_vars)
312 var->setActiveTags(vtags);
319 var->setActiveTags(vtags);
323 VariableWarehouse::getActualFieldVariable<Real>(
const std::string & var_name);
325 VariableWarehouse::getActualFieldVariable<Real>(
unsigned int var_number);
const std::vector< VariableName > & names() const
Get the list of all variable names.
void addBoundaryVar(BoundaryID bnd, const MooseVariableFieldBase *var)
Add a boundary variable.
MooseVariableBase * getVariable(const std::string &var_name) const
Get a variable from the warehouse.
void residualSetup()
Call residualSetup for all variables.
void setActiveScalarVariableCoupleableVectorTags(const std::set< TagID > &vtags)
Set the active vector tags for the variables.
void addBoundaryVars(const std::set< BoundaryID > &boundary_ids, const std::unordered_map< std::string, std::vector< MooseVariableFieldBase *>> &vars)
Add a map of variables to a set of boundaries.
void add(const std::string &var_name, std::shared_ptr< MooseVariableBase > var)
Add a variable.
std::vector< MooseVariableScalar * > _scalar_vars
list of all scalar, non-finite element variables
void jacobianSetup()
Call jacobianSetup for all variables.
void setActiveVariableCoupleableVectorTags(const std::set< TagID > &vtags)
Set the active vector tags for the variables.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
void initialSetup()
Call initialSetup for all variables.
void timestepSetup()
Call timestepSetup for all variables.
HashMap< unsigned, ArrayMooseVariable * > _array_vars_by_number
map of vector finite element variables with unsigned keys
This class provides an interface for common operations on field variables of both FE and FV types wit...
const std::vector< MooseVariableScalar * > & scalars() const
Get the list of scalar variables.
std::map< std::string, MooseVariableBase * > _var_name
Name to variable mapping.
HashMap< std::string, VectorMooseVariable * > _vector_vars_by_name
map of vector finite element variables with name keys
void clearAllDofIndices()
Clear all dof indices from each variable.
HashMap< std::string, MooseLinearVariableFVReal * > _linear_fv_vars_by_name
map of non-vector linear finite volume variables with name keys
boundary_id_type BoundaryID
std::map< unsigned int, std::shared_ptr< MooseVariableBase > > _all_objects
All instances of objects.
MooseVariableField< T > * getActualFieldVariable(const std::string &var_name)
This should be called getFieldVariable, but that name is already taken by a legacy function...
HashMap< unsigned, MooseVariableFVReal * > _fv_vars_by_number
map of non-vector finite element variables with unsigned keys
std::vector< MooseVariableFieldBase * > _vars
list of finite element variables
HashMap< std::string, ArrayMooseVariable * > _array_vars_by_name
map of vector finite element variables with name keys
std::map< BoundaryID, std::set< const MooseVariableFieldBase * > > _boundary_vars
Map to variables that need to be evaluated on a boundary.
HashMap< unsigned, MooseVariable * > _regular_vars_by_number
map of non-vector finite element variables with unsigned keys
std::vector< VariableName > _names
list of variable names
Class for containing MooseEnum item information.
const std::set< const MooseVariableFieldBase * > & boundaryVars(BoundaryID bnd) const
Get the list of variables that needs to be reinitialized on a given boundary.
void subdomainSetup()
Call subdomainSetup for all variables.
HashMap< std::string, MooseVariable * > _regular_vars_by_name
map of non-vector finite element variables with name keys
MooseVariableFE< T > * getFieldVariable(const std::string &var_name)
Get a finite element variable from the warehouse of either Real or RealVectorValue type...
HashMap< unsigned, MooseLinearVariableFVReal * > _linear_fv_vars_by_number
map of non-vector finite element variables with unsigned keys
HashMap< unsigned, VectorMooseVariable * > _vector_vars_by_number
map of vector finite element variables with unsigned keys
const std::vector< MooseVariableFieldBase * > & fieldVariables() const
Get the list of variables.
HashMap< std::string, MooseVariableFVReal * > _fv_vars_by_name
map of non-vector finite element variables with name keys
void customSetup(const ExecFlagType &exec_type)
Call setup on a particular execute flag for all variables.