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

This class defines a logically grouped set of variables in the system. More...

#include <variable.h>

Inheritance diagram for libMesh::VariableGroup:
[legend]

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)
 Constructor. More...
 
 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)
 Constructor. More...
 
unsigned int n_variables () const
 
Variable variable (unsigned int v) const
 
Variable operator() (unsigned int v) const
 Support vg(v). More...
 
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)
 Appends a variable to the group. More...
 
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 172 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 
)

Constructor.

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

Definition at line 180 of file variable.h.

184  :
185  Variable (sys,
186  "var_group",
187  var_number,
188  first_scalar_num,
189  var_type),
190  _names(var_names)
191  {}
Variable(System *sys, const std::string &var_name, const unsigned int var_number, const unsigned int first_scalar_num, const FEType &var_type)
Constructor.
Definition: variable.h:58
ImplicitSystem & sys
std::vector< std::string > _names
Definition: variable.h:280
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 
)

Constructor.

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

Definition at line 198 of file variable.h.

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

Member Function Documentation

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

Definition at line 150 of file variable.h.

References libMesh::Variable::_active_subdomains.

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

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

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

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

277  { _names.push_back (var_name); }
std::vector< std::string > _names
Definition: variable.h:280
unsigned int libMesh::Variable::first_scalar_number ( ) const
inherited
Returns
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:158
unsigned int libMesh::VariableGroup::first_scalar_number ( unsigned int  v) const
Returns
The index of the first scalar component of this variable in the system.

Definition at line 265 of file variable.h.

References libMesh::Variable::_first_scalar_number.

266  {
267  libmesh_assert_less (v, this->n_variables());
268  return _first_scalar_number+v;
269  }
unsigned int _first_scalar_number
Definition: variable.h:158
unsigned int n_variables() const
Definition: variable.h:217
bool libMesh::Variable::implicitly_active ( ) const
inherited
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 libMesh::Variable::_active_subdomains.

145  { return _active_subdomains.empty(); }
std::set< subdomain_id_type > _active_subdomains
Definition: variable.h:156
unsigned int libMesh::Variable::n_components ( ) const
inherited
Returns
The number of components of this variable.

Definition at line 125 of file variable.h.

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

Referenced by libMesh::WrappedFunction< Output >::component(), libMesh::System::n_components(), libMesh::WrappedFunction< Output >::operator()(), libMesh::BoundaryVolumeSolutionTransfer::transfer_boundary_volume(), and libMesh::BoundaryVolumeSolutionTransfer::transfer_volume_boundary().

126  { return type().family == SCALAR ? _type.order.get_order() : 1; }
FEFamily family
The type of finite element.
Definition: fe_type.h:203
int get_order() const
Explicitly request the order as an int.
Definition: fe_type.h:77
const FEType & type() const
Definition: variable.h:119
OrderWrapper order
The approximation order of the element.
Definition: fe_type.h:197
unsigned int libMesh::VariableGroup::n_variables ( ) const
Returns
The number of variables in this VariableGroup

Definition at line 217 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().

218  { return cast_int<unsigned int>(_names.size()); }
std::vector< std::string > _names
Definition: variable.h:280
const std::string& libMesh::Variable::name ( ) const
inherited
const std::string& libMesh::VariableGroup::name ( unsigned int  v) const
Returns
The user-specified name of the variable.

Definition at line 246 of file variable.h.

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

247  {
248  libmesh_assert_less (v, this->n_variables());
249  return _names[v];
250  }
unsigned int n_variables() const
Definition: variable.h:217
std::vector< std::string > _names
Definition: variable.h:280
unsigned int libMesh::Variable::number ( ) const
inherited
unsigned int libMesh::VariableGroup::number ( unsigned int  v) const
Returns
The rank of this variable in the system.

Definition at line 255 of file variable.h.

References libMesh::Variable::_number.

256  {
257  libmesh_assert_less (v, this->n_variables());
258  return _number + v;
259  }
unsigned int n_variables() const
Definition: variable.h:217
unsigned int _number
Definition: variable.h:157
Variable libMesh::VariableGroup::operator() ( unsigned int  v) const

Support vg(v).

Returns
A Variable for v.

Definition at line 240 of file variable.h.

241  { return this->variable(v); }
Variable variable(unsigned int v) const
Definition: variable.h:224
System* libMesh::Variable::system ( ) const
inherited
const FEType& libMesh::Variable::type ( ) const
inherited
Variable libMesh::VariableGroup::variable ( unsigned int  v) const
Returns
A Variable object constructed for an individual member of our group.

Definition at line 224 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().

225  {
226  libmesh_assert_less (v, this->n_variables());
227  return Variable (this->system(),
228  this->name(v),
229  this->number(v),
230  this->first_scalar_number(v),
231  this->type(),
232  this->active_subdomains());
233  }
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)
Constructor.
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:217
System * system() const
Definition: variable.h:92
const std::set< subdomain_id_type > & active_subdomains() const
Definition: variable.h:150

Member Data Documentation

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

Definition at line 158 of file variable.h.

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

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

Definition at line 155 of file variable.h.

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

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

Definition at line 280 of file variable.h.

unsigned int libMesh::Variable::_number
protectedinherited

Definition at line 157 of file variable.h.

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

System* libMesh::Variable::_sys
protectedinherited

Definition at line 154 of file variable.h.

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

FEType libMesh::Variable::_type
protectedinherited

Definition at line 159 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: