libMesh::VariableGroup Class Reference

#include <variable.h>

Inheritance diagram for libMesh::VariableGroup:

Public Member Functions

 VariableGroup (System *sys, const std::vector< std::string > &var_names, const unsigned int var_number, const unsigned int first_scalar_num, const FEType &var_type)
 
 VariableGroup (System *sys, const std::vector< std::string > &var_names, const unsigned int var_number, const unsigned int first_scalar_num, const FEType &var_type, const std::set< subdomain_id_type > &var_active_subdomains)
 
unsigned int n_variables () const
 
Variable variable (unsigned int v) const
 
Variable operator() (unsigned int v) const
 
const std::string & name (unsigned int v) const
 
unsigned int number (unsigned int v) const
 
unsigned int first_scalar_number (unsigned int v) const
 
void append (const std::string &var_name)
 
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

std::vector< std::string > _names
 
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 a logically grouped set of variables in the system. VariableGroup is appropriate for representing several unknowns in the problem that are all approximated with the same finite element approximation family and (optionally) a list of subdomains to which the variables are restricted.

Definition at line 170 of file variable.h.

Constructor & Destructor Documentation

libMesh::VariableGroup::VariableGroup ( System sys,
const std::vector< std::string > &  var_names,
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 178 of file variable.h.

182  :
183  Variable (sys,
184  "var_group",
185  var_number,
186  first_scalar_num,
187  var_type),
188  _names(var_names)
189  {}
Variable(System *sys, const std::string &var_name, const unsigned int var_number, const unsigned int first_scalar_num, const FEType &var_type)
Definition: variable.h:58
ImplicitSystem & sys
std::vector< std::string > _names
Definition: variable.h:276
libMesh::VariableGroup::VariableGroup ( System sys,
const std::vector< std::string > &  var_names,
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 196 of file variable.h.

201  :
202 
203  Variable (sys,
204  "var_group",
205  var_number,
206  first_scalar_num,
207  var_type,
208  var_active_subdomains),
209  _names(var_names)
210  {}
Variable(System *sys, const std::string &var_name, const unsigned int var_number, const unsigned int first_scalar_num, const FEType &var_type)
Definition: variable.h:58
ImplicitSystem & sys
std::vector< std::string > _names
Definition: variable.h:276

Member Function Documentation

bool libMesh::Variable::active_on_subdomain ( subdomain_id_type  sid) const
inlineinherited
const std::set<subdomain_id_type>& libMesh::Variable::active_subdomains ( ) const
inlineinherited

Returns set of subdomain ids this variable lives on

Definition at line 148 of file variable.h.

References libMesh::Variable::_active_subdomains.

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

149  { return _active_subdomains; }
std::set< subdomain_id_type > _active_subdomains
Definition: variable.h:154
void libMesh::VariableGroup::append ( const std::string &  var_name)
inline

Appends a variable to the group. Really only can be used by System in a very limited window of opportunity - after the user specifies variables but before the system is initialized.

Definition at line 272 of file variable.h.

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

273  { _names.push_back (var_name); }
std::vector< std::string > _names
Definition: variable.h:276
unsigned int libMesh::Variable::first_scalar_number ( ) const
inlineinherited

The index of the first scalar component of this variable in the system.

Definition at line 113 of file variable.h.

References libMesh::Variable::_first_scalar_number.

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

114  { return _first_scalar_number; }
unsigned int _first_scalar_number
Definition: variable.h:156
unsigned int libMesh::VariableGroup::first_scalar_number ( unsigned int  v) const
inline

The index of the first scalar component of this variable in the system.

Definition at line 261 of file variable.h.

References libMesh::Variable::_first_scalar_number.

262  {
263  libmesh_assert_less (v, this->n_variables());
264  return _first_scalar_number+v;
265  }
unsigned int _first_scalar_number
Definition: variable.h:156
unsigned int n_variables() const
Definition: variable.h:215
bool libMesh::Variable::implicitly_active ( ) const
inlineinherited

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

References libMesh::Variable::_active_subdomains.

143  { return _active_subdomains.empty(); }
std::set< subdomain_id_type > _active_subdomains
Definition: variable.h:154
unsigned int libMesh::Variable::n_components ( ) const
inlineinherited
unsigned int libMesh::VariableGroup::n_variables ( ) const
inline

The number of variables in this VariableGroup

Definition at line 215 of file variable.h.

Referenced by libMesh::DofMap::add_variable_group(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::System::get_info(), and libMesh::DofMap::reinit().

216  { return cast_int<unsigned int>(_names.size()); }
std::vector< std::string > _names
Definition: variable.h:276
const std::string& libMesh::Variable::name ( ) const
inlineinherited

Arbitrary, user-specified name of the variable.

Definition at line 100 of file variable.h.

References libMesh::Variable::_name.

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

101  { return _name; }
std::string _name
Definition: variable.h:153
const std::string& libMesh::VariableGroup::name ( unsigned int  v) const
inline

Arbitrary, user-specified name of the variable.

Definition at line 242 of file variable.h.

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

243  {
244  libmesh_assert_less (v, this->n_variables());
245  return _names[v];
246  }
unsigned int n_variables() const
Definition: variable.h:215
std::vector< std::string > _names
Definition: variable.h:276
unsigned int libMesh::Variable::number ( ) const
inlineinherited

The rank of this variable in the system.

Definition at line 106 of file variable.h.

References libMesh::Variable::_number.

Referenced by variable().

107  { return _number; }
unsigned int _number
Definition: variable.h:155
unsigned int libMesh::VariableGroup::number ( unsigned int  v) const
inline

The rank of this variable in the system.

Definition at line 251 of file variable.h.

References libMesh::Variable::_number.

252  {
253  libmesh_assert_less (v, this->n_variables());
254  return _number + v;
255  }
unsigned int n_variables() const
Definition: variable.h:215
unsigned int _number
Definition: variable.h:155
Variable libMesh::VariableGroup::operator() ( unsigned int  v) const
inline

Support vg(v) - returns a Variable for v.

Definition at line 236 of file variable.h.

237  { return this->variable(v); }
Variable variable(unsigned int v) const
Definition: variable.h:222
System* libMesh::Variable::system ( ) const
inlineinherited

The System this Variable is part of.

Definition at line 92 of file variable.h.

References libMesh::Variable::_sys.

Referenced by variable().

93  {
94  return _sys;
95  }
System * _sys
Definition: variable.h:152
Variable libMesh::VariableGroup::variable ( unsigned int  v) const
inline

Construct a Variable object for an individual member of our group.

Definition at line 222 of file variable.h.

References libMesh::Variable::active_subdomains(), libMesh::Variable::first_scalar_number(), libMesh::Variable::name(), libMesh::Variable::number(), libMesh::Variable::system(), libMesh::Variable::type(), and libMesh::Variable::Variable().

223  {
224  libmesh_assert_less (v, this->n_variables());
225  return Variable (this->system(),
226  this->name(v),
227  this->number(v),
228  this->first_scalar_number(v),
229  this->type(),
230  this->active_subdomains());
231  }
const FEType & type() const
Definition: variable.h:119
const std::string & name() const
Definition: variable.h:100
Variable(System *sys, const std::string &var_name, const unsigned int var_number, const unsigned int first_scalar_num, const FEType &var_type)
Definition: variable.h:58
unsigned int first_scalar_number() const
Definition: variable.h:113
unsigned int number() const
Definition: variable.h:106
unsigned int n_variables() const
Definition: variable.h:215
System * system() const
Definition: variable.h:92
const std::set< subdomain_id_type > & active_subdomains() const
Definition: variable.h:148

Member Data Documentation

std::set<subdomain_id_type> libMesh::Variable::_active_subdomains
protectedinherited
unsigned int libMesh::Variable::_first_scalar_number
protectedinherited

Definition at line 156 of file variable.h.

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

std::string libMesh::Variable::_name
protectedinherited

Definition at line 153 of file variable.h.

Referenced by libMesh::Variable::name().

std::vector<std::string> libMesh::VariableGroup::_names
protected

Definition at line 276 of file variable.h.

unsigned int libMesh::Variable::_number
protectedinherited

Definition at line 155 of file variable.h.

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

System* libMesh::Variable::_sys
protectedinherited

Definition at line 152 of file variable.h.

Referenced by libMesh::Variable::system().

FEType libMesh::Variable::_type
protectedinherited

Definition at line 157 of file variable.h.

Referenced by libMesh::Variable::n_components(), and libMesh::Variable::type().


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