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
 
unsigned int _number
 
unsigned int _first_scalar_number
 
FEType _type
 
std::set< subdomain_id_type_active_subdomains
 

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

177  :
178  Variable (sys,
179  "var_group",
180  var_number,
181  first_scalar_num,
182  var_type),
183  _names(var_names)
184  {}
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 191 of file variable.h.

196  :
197 
198  Variable (sys,
199  "var_group",
200  var_number,
201  first_scalar_num,
202  var_type,
203  var_active_subdomains),
204  _names(var_names)
205  {}

Member Function Documentation

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

returns true if this variable is active on subdomain sid, false otherwise. Note that we interperet the special case of an empty _active_subdomains container as active everywhere, i.e. for all subdomains.

Definition at line 129 of file variable.h.

References libMesh::Variable::_active_subdomains.

Referenced by libMesh::EquationSystems::build_solution_vector(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::EquationSystems::get_solution(), libMesh::ProjectSolution::operator()(), libMesh::ProjectFEMSolution::operator()(), libMesh::BoundaryProjectSolution::operator()(), and libMesh::DofMap::reinit().

130  { return (_active_subdomains.empty() || _active_subdomains.count(sid)); }
const std::set<subdomain_id_type>& libMesh::Variable::active_subdomains ( ) const
inlineinherited

Returns set of subdomain ids this variable lives on

Definition at line 143 of file variable.h.

References libMesh::Variable::_active_subdomains.

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

144  { return _active_subdomains; }
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 267 of file variable.h.

References _names.

268  { _names.push_back (var_name); }
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 108 of file variable.h.

References libMesh::Variable::_first_scalar_number.

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

109  { return _first_scalar_number; }
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 256 of file variable.h.

References libMesh::Variable::_first_scalar_number, and n_variables().

257  {
258  libmesh_assert_less (v, this->n_variables());
259  return _first_scalar_number+v;
260  }
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 137 of file variable.h.

References libMesh::Variable::_active_subdomains.

138  { return _active_subdomains.empty(); }
unsigned int libMesh::Variable::n_components ( ) const
inlineinherited

The number of components of this variable.

Definition at line 120 of file variable.h.

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

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

121  { return type().family == SCALAR ? _type.order : 1; }
unsigned int libMesh::VariableGroup::n_variables ( ) const
inline
const std::string& libMesh::Variable::name ( ) const
inlineinherited

Arbitrary, user-specified name of the variable.

Definition at line 95 of file variable.h.

References libMesh::Variable::_name.

Referenced by DMLibMeshSetSystem(), and variable().

96  { return _name; }
const std::string& libMesh::VariableGroup::name ( unsigned int  v) const
inline

Arbitrary, user-specified name of the variable.

Definition at line 237 of file variable.h.

References _names, and n_variables().

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

238  {
239  libmesh_assert_less (v, this->n_variables());
240  return _names[v];
241  }
unsigned int libMesh::Variable::number ( ) const
inlineinherited

The rank of this variable in the system.

Definition at line 101 of file variable.h.

References libMesh::Variable::_number.

Referenced by variable().

102  { return _number; }
unsigned int libMesh::VariableGroup::number ( unsigned int  v) const
inline

The rank of this variable in the system.

Definition at line 246 of file variable.h.

References libMesh::Variable::_number, and n_variables().

247  {
248  libmesh_assert_less (v, this->n_variables());
249  return _number + v;
250  }
Variable libMesh::VariableGroup::operator() ( unsigned int  v) const
inline

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

Definition at line 231 of file variable.h.

References variable().

232  { return this->variable(v); }
System* libMesh::Variable::system ( ) const
inlineinherited

The System this Variable is part of.

Definition at line 87 of file variable.h.

References libMesh::Variable::_sys.

Referenced by variable().

88  {
89  return _sys;
90  }
Variable libMesh::VariableGroup::variable ( unsigned int  v) const
inline

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

Definition at line 217 of file variable.h.

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

Referenced by operator()().

218  {
219  libmesh_assert_less (v, this->n_variables());
220  return Variable (this->system(),
221  this->name(v),
222  this->number(v),
223  this->first_scalar_number(v),
224  this->type(),
225  this->active_subdomains());
226  }

Member Data Documentation

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

Definition at line 150 of file variable.h.

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

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

Definition at line 148 of file variable.h.

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

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

Definition at line 271 of file variable.h.

Referenced by append(), n_variables(), and name().

unsigned int libMesh::Variable::_number
protectedinherited

Definition at line 149 of file variable.h.

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

System* libMesh::Variable::_sys
protectedinherited

Definition at line 147 of file variable.h.

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

FEType libMesh::Variable::_type
protectedinherited

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

Site Created By: libMesh Developers
Last modified: February 07 2014 16:58:02 UTC

Hosted By:
SourceForge.net Logo