www.mooseframework.org
MooseVariableBase.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 #include "MooseTypes.h"
13 #include "MooseArray.h"
14 
15 #include "libmesh/fe_type.h"
16 
17 // libMesh forward declarations
18 namespace libMesh
19 {
20 class DofMap;
21 class Variable;
22 }
23 
24 class SubProblem;
25 class SystemBase;
26 class MooseMesh;
27 
29 {
30 public:
31  MooseVariableBase(unsigned int var_num,
32  const FEType & fe_type,
33  SystemBase & sys,
34  Moose::VarKindType var_kind,
35  THREAD_ID tid);
36  virtual ~MooseVariableBase();
37 
42  unsigned int number() const { return _var_num; }
43 
47  const FEType & feType() const { return _fe_type; }
48 
52  SystemBase & sys() { return _sys; }
53 
57  const std::string & name() const;
58 
62  const std::vector<dof_id_type> & allDofIndices() const;
63  unsigned int totalVarDofs() { return allDofIndices().size(); }
64 
68  Moose::VarKindType kind() const { return _var_kind; }
69 
73  void scalingFactor(Real factor) { _scaling_factor = factor; }
74 
78  Real scalingFactor() const { return _scaling_factor; }
79 
84  Order order() const;
85 
89  const DofMap & dofMap() const { return _dof_map; }
90 
92  virtual const std::vector<dof_id_type> & dofIndices() const { return _dof_indices; }
93 
95  virtual unsigned int numberOfDofs() const { return _dof_indices.size(); }
96 
97 protected:
99  unsigned int _var_num;
101  FEType _fe_type;
103  unsigned int _index;
109 
111  const Variable & _variable;
112 
114  const DofMap & _dof_map;
116  std::vector<dof_id_type> _dof_indices;
117 
120 
123 
126 };
127 
FEType _fe_type
The FEType associated with this variable.
virtual unsigned int numberOfDofs() const
Get the number of local DoFs.
const DofMap & _dof_map
DOF map.
unsigned int number() const
Get variable number coming from libMesh.
const Variable & _variable
libMesh variable object for this variable
unsigned int _index
variable number within MOOSE
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Base class for a system (of equations)
Definition: SystemBase.h:92
const FEType & feType() const
Get the type of finite element object.
THREAD_ID _tid
Thread ID.
std::vector< dof_id_type > _dof_indices
DOF indices.
virtual ~MooseVariableBase()
SubProblem & _subproblem
Problem this variable is part of.
SystemBase & _sys
System this variable is part of.
VarKindType
Framework-wide stuff.
Definition: MooseTypes.h:481
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
virtual const std::vector< dof_id_type > & dofIndices() const
Get local DoF indices.
Moose::VarKindType _var_kind
Real scalingFactor() const
Get the scaling factor for this variable.
Real _scaling_factor
scaling factor for this variable
const DofMap & dofMap() const
The DofMap associated with the system this variable is in.
MooseMesh & _mesh
mesh the variable is active in
Order order() const
Get the order of this variable Note: Order enum can be implicitly converted to unsigned int...
MooseVariableBase(unsigned int var_num, const FEType &fe_type, SystemBase &sys, Moose::VarKindType var_kind, THREAD_ID tid)
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:59
const std::string & name() const
Get the variable name.
const std::vector< dof_id_type > & allDofIndices() const
Get all global dofindices for the variable.
unsigned int _var_num
variable number (from libMesh)
Moose::VarKindType kind() const
Kind of the variable (Nonlinear, Auxiliary, ...)
unsigned int totalVarDofs()
SystemBase & sys()
Get the system this variable is part of.
unsigned int THREAD_ID
Definition: MooseTypes.h:161
void scalingFactor(Real factor)
Set the scaling factor for this variable.