www.mooseframework.org
MooseVariableBase.C
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 #include "MooseVariableBase.h"
16 #include "SubProblem.h"
17 #include "SystemBase.h"
18 #include "Assembly.h"
19 #include "MooseMesh.h"
20 
21 #include "libmesh/variable.h"
22 #include "libmesh/dof_map.h"
23 
25  const FEType & fe_type,
26  SystemBase & sys,
27  Assembly & assembly,
28  Moose::VarKindType var_kind)
29  : _var_num(var_num),
30  _fe_type(fe_type),
31  _var_kind(var_kind),
32  _subproblem(sys.subproblem()),
33  _sys(sys),
34  _variable(sys.system().variable(_var_num)),
35  _assembly(assembly),
36  _dof_map(sys.dofMap()),
37  _mesh(_subproblem.mesh()),
38  _scaling_factor(1.0)
39 {
40 }
41 
43 
44 const std::string &
46 {
47  return _sys.system().variable(_var_num).name();
48 }
49 
50 const std::vector<dof_id_type> &
52 {
53  const auto it = _sys.subproblem()._var_dof_map.find(name());
54  if (it != _sys.subproblem()._var_dof_map.end())
55  return it->second;
56  else
57  mooseError("VariableAllDoFMap not prepared for ",
58  name(),
59  " . Check nonlocal coupling requirement for the variable.");
60 }
61 
62 Order
64 {
65  return _fe_type.order;
66 }
const std::vector< dof_id_type > & allDofIndices() const
Get all global dofindices for the variable.
FEType _fe_type
The FEType associated with this variable.
Keeps track of stuff related to assembling.
Definition: Assembly.h:63
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
Base class for a system (of equations)
Definition: SystemBase.h:91
const std::string & name() const
Get the variable name.
std::map< std::string, std::vector< dof_id_type > > _var_dof_map
Definition: SubProblem.h:413
virtual ~MooseVariableBase()
nl system()
SystemBase & _sys
System this variable is part of.
VarKindType
Framework-wide stuff.
Definition: MooseTypes.h:156
virtual SubProblem & subproblem()
Definition: SystemBase.h:103
Order order() const
Get the order of this variable Note: Order enum can be implicitly converted to unsigned int...
virtual System & system()=0
Get the reference to the libMesh system.
unsigned int _var_num
variable number (from libMesh)
MooseVariableBase(unsigned int var_num, const FEType &fe_type, SystemBase &sys, Assembly &assembly, Moose::VarKindType var_kind)