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...
 
unsigned int number () 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

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

◆ VariableGroup() [1/2]

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 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  {}

◆ VariableGroup() [2/2]

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 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  {}

Member Function Documentation

◆ active_on_subdomain()

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

◆ active_subdomains()

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

◆ append()

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

280  { _names.push_back (var_name); }

References _names.

◆ first_scalar_number() [1/2]

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

Definition at line 113 of file variable.h.

114  { return _first_scalar_number; }

References libMesh::Variable::_first_scalar_number.

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

◆ first_scalar_number() [2/2]

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

Definition at line 268 of file variable.h.

269  {
270  libmesh_assert_less (v, this->n_variables());
271  return _first_scalar_number+v;
272  }

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

◆ implicitly_active()

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

145  { return _active_subdomains.empty(); }

References libMesh::Variable::_active_subdomains.

◆ n_components()

unsigned int libMesh::Variable::n_components ( ) const
inlineinherited

◆ n_variables()

unsigned int libMesh::VariableGroup::n_variables ( ) const
inline

◆ name() [1/2]

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

◆ name() [2/2]

const std::string& libMesh::VariableGroup::name ( unsigned int  v) const
inline
Returns
The user-specified name of the variable.

Definition at line 246 of file variable.h.

247  {
248  libmesh_assert_less (v, this->n_variables());
249  return _names[v];
250  }

References _names, and n_variables().

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

◆ number() [1/3]

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

◆ number() [2/3]

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

Definition at line 106 of file variable.h.

107  { return _number; }

◆ number() [3/3]

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

Definition at line 255 of file variable.h.

256  {
257  libmesh_assert_less (v, this->n_variables());
258  return _number + v;
259  }

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

Referenced by libMesh::DofMap::dof_indices(), and libMesh::DofMap::old_dof_indices().

◆ operator()()

Variable libMesh::VariableGroup::operator() ( unsigned int  v) const
inline

Support vg(v).

Returns
A Variable for v.

Definition at line 240 of file variable.h.

241  { return this->variable(v); }

References variable().

◆ system()

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

◆ type()

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

Definition at line 119 of file variable.h.

120  { return _type; }

References libMesh::Variable::_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::dof_indices(), libMesh::System::get_info(), main(), libMesh::Variable::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::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(), variable(), and libMesh::System::write_parallel_data().

◆ variable()

Variable libMesh::VariableGroup::variable ( unsigned int  v) const
inline
Returns
A Variable object constructed for an individual member of our group.

Definition at line 224 of file variable.h.

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  }

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()().

Member Data Documentation

◆ _active_subdomains

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

◆ _first_scalar_number

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().

◆ _name

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

Definition at line 155 of file variable.h.

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

◆ _names

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

Definition at line 283 of file variable.h.

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

◆ _number

unsigned int libMesh::Variable::_number
protectedinherited

Definition at line 157 of file variable.h.

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

◆ _sys

System* libMesh::Variable::_sys
protectedinherited

Definition at line 154 of file variable.h.

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

◆ _type

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:
libMesh::OrderWrapper::get_order
int get_order() const
Explicitly request the order as an int.
Definition: fe_type.h:77
libMesh::Variable::system
System * system() const
Definition: variable.h:92
libMesh::Variable::_type
FEType _type
Definition: variable.h:159
libMesh::FEType::family
FEFamily family
The type of finite element.
Definition: fe_type.h:203
libMesh::Variable::number
unsigned int number() const
Definition: variable.h:106
libMesh::Variable::_sys
System * _sys
Definition: variable.h:154
libMesh::Variable::type
const FEType & type() const
Definition: variable.h:119
libMesh::VariableGroup::variable
Variable variable(unsigned int v) const
Definition: variable.h:224
libMesh::Variable::active_subdomains
const std::set< subdomain_id_type > & active_subdomains() const
Definition: variable.h:150
libMesh::Variable::name
const std::string & name() const
Definition: variable.h:100
libMesh::Variable::Variable
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
libMesh::VariableGroup::_names
std::vector< std::string > _names
Definition: variable.h:283
libMesh::Variable::_active_subdomains
std::set< subdomain_id_type > _active_subdomains
Definition: variable.h:156
libMesh::Variable::_number
unsigned int _number
Definition: variable.h:157
libMesh::Variable::_name
std::string _name
Definition: variable.h:155
libMesh::Variable::first_scalar_number
unsigned int first_scalar_number() const
Definition: variable.h:113
libMesh::FEType::order
OrderWrapper order
The approximation order of the element.
Definition: fe_type.h:197
libMesh::SCALAR
Definition: enum_fe_family.h:58
libMesh::VariableGroup::n_variables
unsigned int n_variables() const
Definition: variable.h:217
libMesh::Variable::_first_scalar_number
unsigned int _first_scalar_number
Definition: variable.h:158