libMesh
Public Member Functions | Protected Attributes | List of all members
libMesh::Variable Class Reference

This class defines the notion of a variable in the system. More...

#include <variable.h>

Inheritance diagram for libMesh::Variable:
[legend]

Public Member Functions

 Variable (System *sys, std::string var_name, const unsigned int var_number, const unsigned int first_scalar_num, const FEType &var_type)
 Constructor. More...
 
 Variable (System *sys, 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)
 Constructor. More...
 
 Variable (const Variable &)=default
 Standard constructors. More...
 
Variableoperator= (const Variable &)=default
 
 Variable (Variable &&)=default
 
Variableoperator= (Variable &&)=default
 
bool operator== (const Variable &other) const
 
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

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 A variable which is solved for in a System of equations.

Definition at line 49 of file variable.h.

Constructor & Destructor Documentation

◆ Variable() [1/4]

libMesh::Variable::Variable ( System sys,
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(std::move(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:177
std::string _name
Definition: variable.h:176
unsigned int _first_scalar_number
Definition: variable.h:179
System * _sys
Definition: variable.h:175
unsigned int _number
Definition: variable.h:178

◆ Variable() [2/4]

libMesh::Variable::Variable ( System sys,
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(std::move(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:177
std::string _name
Definition: variable.h:176
unsigned int _first_scalar_number
Definition: variable.h:179
System * _sys
Definition: variable.h:175
unsigned int _number
Definition: variable.h:178

◆ Variable() [3/4]

libMesh::Variable::Variable ( const Variable )
default

Standard constructors.

◆ Variable() [4/4]

libMesh::Variable::Variable ( Variable &&  )
default

Member Function Documentation

◆ active_on_subdomain()

bool libMesh::Variable::active_on_subdomain ( subdomain_id_type  sid) const
inline

◆ active_subdomains()

const std::set<subdomain_id_type>& libMesh::Variable::active_subdomains ( ) const
inline

◆ 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 134 of file variable.h.

References _first_scalar_number.

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

135  { return _first_scalar_number; }
unsigned int _first_scalar_number
Definition: variable.h:179

◆ 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 165 of file variable.h.

References _active_subdomains.

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

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

◆ n_components()

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

Definition at line 146 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(), libMesh::BoundaryVolumeSolutionTransfer::transfer_boundary_volume(), and libMesh::BoundaryVolumeSolutionTransfer::transfer_volume_boundary().

147  { return type().family == SCALAR ? _type.order.get_order() : 1; }
FEFamily family
The type of finite element.
Definition: fe_type.h:207
OrderWrapper order
The approximation order of the element.
Definition: fe_type.h:201
int get_order() const
Explicitly request the order as an int.
Definition: fe_type.h:80
const FEType & type() const
Definition: variable.h:140

◆ name()

const std::string& libMesh::Variable::name ( ) const
inline

◆ number()

unsigned int libMesh::Variable::number ( ) const
inline

◆ operator=() [1/2]

Variable& libMesh::Variable::operator= ( const Variable )
default

◆ operator=() [2/2]

Variable& libMesh::Variable::operator= ( Variable &&  )
default

◆ operator==()

bool libMesh::Variable::operator== ( const Variable other) const
inline
Returns
true iff the other Variable has the same characteristics and system numbering as this one.

Definition at line 101 of file variable.h.

References _active_subdomains, _first_scalar_number, _name, _sys, and _type.

102  {
103  return (_sys == other._sys) &&
104  (_name == other._name) &&
105  (_active_subdomains == other._active_subdomains) &&
106  (_first_scalar_number == other._first_scalar_number) &&
107  (_type == other._type);
108  }
std::set< subdomain_id_type > _active_subdomains
Definition: variable.h:177
std::string _name
Definition: variable.h:176
unsigned int _first_scalar_number
Definition: variable.h:179
System * _sys
Definition: variable.h:175

◆ system()

System* libMesh::Variable::system ( ) const
inline

◆ type()

const FEType& libMesh::Variable::type ( ) const
inline
Returns
The FEType for this variable.

Definition at line 140 of file variable.h.

References _type.

Referenced by libMesh::DofMap::_dof_indices(), libMesh::DofMap::_node_dof_indices(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DifferentiableSystem::add_second_order_dot_vars(), libMesh::FEMSystem::assembly(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_proj_constraints(), libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DofMap::distribute_scalar_dofs(), libMesh::DofMap::dof_indices(), libMesh::System::get_info(), main(), n_components(), libMesh::DifferentiablePhysics::nonlocal_mass_residual(), libMesh::DofMap::old_dof_indices(), libMesh::BoundaryProjectSolution::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SortAndCopy::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectVertices::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectEdges::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectInteriors::operator()(), libMesh::System::project_vector(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::DofMap::reinit(), libMesh::DofMap::SCALAR_dof_indices(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::DirectSolutionTransfer::transfer(), libMesh::VariableGroup::variable(), libMesh::System::write_parallel_data(), and libMesh::System::write_serialized_vector().

141  { return _type; }

Member Data Documentation

◆ _active_subdomains

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

Definition at line 177 of file variable.h.

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

◆ _first_scalar_number

unsigned int libMesh::Variable::_first_scalar_number
protected

◆ _name

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

Definition at line 176 of file variable.h.

Referenced by name(), and operator==().

◆ _number

unsigned int libMesh::Variable::_number
protected

Definition at line 178 of file variable.h.

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

◆ _sys

System* libMesh::Variable::_sys
protected

Definition at line 175 of file variable.h.

Referenced by operator==(), and system().

◆ _type

FEType libMesh::Variable::_type
protected

Definition at line 180 of file variable.h.

Referenced by n_components(), operator==(), and type().


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