libMesh::Variable Class Reference

A variable which is solved for in a System of equations. More...

#include <variable.h>

Inheritance diagram for libMesh::Variable:

Public Member Functions

 Variable (System *sys, const std::string &var_name, const unsigned int var_number, const unsigned int first_scalar_num, const FEType &var_type)
 
 Variable (System *sys, const std::string &var_name, const unsigned int var_number, const unsigned int first_scalar_num, const FEType &var_type, const std::set< subdomain_id_type > &var_active_subdomains)
 
Systemsystem () const
 
const std::string & name () const
 
unsigned int number () const
 
unsigned int first_scalar_number () const
 
const FETypetype () const
 
unsigned int n_components () const
 
bool active_on_subdomain (subdomain_id_type sid) const
 
bool implicitly_active () const
 
const std::set< subdomain_id_type > & active_subdomains () const
 

Protected Attributes

System_sys
 
std::string _name
 
std::set< subdomain_id_type_active_subdomains
 
unsigned int _number
 
unsigned int _first_scalar_number
 
FEType _type
 

Detailed Description

A variable which is solved for in a System of equations.

This class defines the notion of a variable in the system. A variable is one of potentially several unknowns in the problem at hand. A variable is described by a unique name, a finite element approximation family, and (optionally) a list of subdomains to which the variable is restricted.

Author
Roy Stogner
Date
2010

Definition at line 49 of file variable.h.

Constructor & Destructor Documentation

◆ Variable() [1/2]

libMesh::Variable::Variable ( System sys,
const std::string &  var_name,
const unsigned int  var_number,
const unsigned int  first_scalar_num,
const FEType var_type 
)
inline

Constructor. Omits the subdomain mapping, hence this constructor creates a variable which is active on all subdomains.

Definition at line 58 of file variable.h.

Referenced by libMesh::VariableGroup::variable().

62  :
63  _sys(sys),
64  _name(var_name),
66  _number(var_number),
67  _first_scalar_number(first_scalar_num),
68  _type(var_type)
69  {}
std::set< subdomain_id_type > _active_subdomains
Definition: variable.h:156
std::string _name
Definition: variable.h:155
unsigned int _first_scalar_number
Definition: variable.h:158
System * _sys
Definition: variable.h:154
unsigned int _number
Definition: variable.h:157

◆ Variable() [2/2]

libMesh::Variable::Variable ( System sys,
const std::string &  var_name,
const unsigned int  var_number,
const unsigned int  first_scalar_num,
const FEType var_type,
const std::set< subdomain_id_type > &  var_active_subdomains 
)
inline

Constructor. Takes a set which contains the subdomain indices for which this variable is active.

Definition at line 75 of file variable.h.

80  :
81  _sys(sys),
82  _name(var_name),
83  _active_subdomains(var_active_subdomains),
84  _number(var_number),
85  _first_scalar_number(first_scalar_num),
86  _type(var_type)
87  {}
std::set< subdomain_id_type > _active_subdomains
Definition: variable.h:156
std::string _name
Definition: variable.h:155
unsigned int _first_scalar_number
Definition: variable.h:158
System * _sys
Definition: variable.h:154
unsigned int _number
Definition: variable.h:157

Member Function Documentation

◆ active_on_subdomain()

◆ active_subdomains()

const std::set<subdomain_id_type>& libMesh::Variable::active_subdomains ( ) const
inline
Returns
The set of subdomain ids this variable lives on.

Definition at line 150 of file variable.h.

References _active_subdomains.

Referenced by libMesh::DifferentiableSystem::add_second_order_dot_vars(), libMesh::EquationSystems::get_vars_active_subdomains(), libMesh::VariableGroup::variable(), and libMesh::System::write_header().

151  { return _active_subdomains; }
std::set< subdomain_id_type > _active_subdomains
Definition: variable.h:156

◆ first_scalar_number()

unsigned int libMesh::Variable::first_scalar_number ( ) const
inline
Returns
The index of the first scalar component of this variable in the system.

Definition at line 113 of file variable.h.

References _first_scalar_number.

Referenced by libMesh::System::n_components(), and libMesh::VariableGroup::variable().

114  { return _first_scalar_number; }
unsigned int _first_scalar_number
Definition: variable.h:158

◆ implicitly_active()

bool libMesh::Variable::implicitly_active ( ) const
inline
Returns
true if this variable is active on all subdomains because it has no specified activity map. This can be used to perform more efficient computations in some places.

Definition at line 144 of file variable.h.

References _active_subdomains.

145  { return _active_subdomains.empty(); }
std::set< subdomain_id_type > _active_subdomains
Definition: variable.h:156

◆ n_components()

unsigned int libMesh::Variable::n_components ( ) const
inline
Returns
The number of components of this variable.

Definition at line 125 of file variable.h.

References _type, libMesh::FEType::family, libMesh::OrderWrapper::get_order(), libMesh::FEType::order, libMesh::SCALAR, and type().

Referenced by libMesh::System::n_components().

126  { return type().family == SCALAR ? _type.order.get_order() : 1; }
FEFamily family
Definition: fe_type.h:204
OrderWrapper order
Definition: fe_type.h:198
int get_order() const
Definition: fe_type.h:78
const FEType & type() const
Definition: variable.h:119

◆ name()

const std::string& libMesh::Variable::name ( ) const
inline
Returns
The user-specified name of the variable.

Definition at line 100 of file variable.h.

References _name.

Referenced by libMesh::DifferentiableSystem::add_second_order_dot_vars(), DMlibMeshSetSystem_libMesh(), and libMesh::VariableGroup::variable().

101  { return _name; }
std::string _name
Definition: variable.h:155

◆ number()

unsigned int libMesh::Variable::number ( ) const
inline
Returns
The rank of this variable in the system.

Definition at line 106 of file variable.h.

References _number.

Referenced by libMesh::VariableGroup::variable().

107  { return _number; }
unsigned int _number
Definition: variable.h:157

◆ system()

System* libMesh::Variable::system ( ) const
inline
Returns
A pointer to the System this Variable is part of.

Definition at line 92 of file variable.h.

References _sys.

Referenced by libMesh::VariableGroup::variable().

93  {
94  return _sys;
95  }
System * _sys
Definition: variable.h:154

◆ type()

Member Data Documentation

◆ _active_subdomains

std::set<subdomain_id_type> libMesh::Variable::_active_subdomains
protected

Definition at line 156 of file variable.h.

Referenced by active_on_subdomain(), active_subdomains(), and implicitly_active().

◆ _first_scalar_number

unsigned int libMesh::Variable::_first_scalar_number
protected

Definition at line 158 of file variable.h.

Referenced by first_scalar_number(), and libMesh::VariableGroup::first_scalar_number().

◆ _name

std::string libMesh::Variable::_name
protected

Definition at line 155 of file variable.h.

Referenced by name().

◆ _number

unsigned int libMesh::Variable::_number
protected

Definition at line 157 of file variable.h.

Referenced by number(), and libMesh::VariableGroup::number().

◆ _sys

System* libMesh::Variable::_sys
protected

Definition at line 154 of file variable.h.

Referenced by system().

◆ _type

FEType libMesh::Variable::_type
protected

Definition at line 159 of file variable.h.

Referenced by n_components(), and type().


The documentation for this class was generated from the following file: