KASKADE 7 development version
Classes | Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Related Functions | List of all members
Kaskade::VariableSetDescription< SpaceList, VariableList > Class Template Reference

A class that stores information about a set of variables. More...

#include <variables.hh>

Detailed Description

template<class SpaceList, class VariableList>
class Kaskade::VariableSetDescription< SpaceList, VariableList >

A class that stores information about a set of variables.

PDE systems usually involve a set of variables \( u_1, \dots, u_n \), e.g., velocity and pressure in the Stokes equation. This class describes the properties of such variable sets and provides meta information such as types of variable sets, their function spaces, or their dimension, as well as convenience methods for constructing variable sets or coefficient vector sets.

Template Parameters
SpaceLista boost::fusion container of FEFunctionSpace s
VariableLista boost::fusion container of VariableDescription s. Note that the variable ids will be ignored and ids according to the position of the variable in the vector will be used instead.

Definition at line 536 of file variables.hh.

Classes

class  CoefficientVectorRepresentation
 Typedefs for coefficient vector representations of contiguous subranges of the variables. More...
 
struct  Components
 DEPRECATED, use components instead. More...
 
struct  SpaceIndex
 DEPRECATED, use spaceIndex instead. More...
 

Public Types

typedef SpaceList Spaces
 type of boost::fusion::vector of FEFunctionSpace s needed More...
 
using Variables = typename Variables_Detail::ImplicitIdVariableDescriptions< VariableList >::type
 type of boost::fusion vector of VariableDescription s More...
 
typedef Variables_Detail::VariableRangeCreator< Variables, ConstructElement< Spaces > >::type RepresentationData
 Type that contains a set of variables inside a boost vector, together with all the data. More...
 
typedef Kaskade::VariableSet< VariableSetDescription< Spaces, VariableList > > VariableSet
 Type that contains a set of variable values with some functionality, such as simple vector arithmetic and so on (cf. class VariableSet) More...
 
typedef SpaceType< Spaces, 0 >::type::Scalar Scalar
 scalar field type More...
 
typedef SpaceType< Spaces, 0 >::type::Grid Grid
 Grid type. More...
 
typedef SpaceType< Spaces, 0 >::type::GridView GridView
 Grid view type. More...
 
typedef SpaceType< Spaces, 0 >::type::IndexSet IndexSet
 IndexSet type. More...
 
typedef boost::fusion::result_of::as_vector< typenameboost::fusion::result_of::transform< Spaces, GetEvaluators< ShapeFunctionCache< Grid, Scalar > > >::type >::type Evaluators
 The boost::fusion sequence of evaluators belonging to this variable set. More...
 
template<int idx>
using Space = std::remove_pointer_t< typename boost::fusion::result_of::value_at_c< Spaces, SpaceIndex< idx >::spaceIndex >::type >
 The type of finite element space of the i-th variable. More...
 

Public Member Functions

GridManagerBase< Grid > const & gridManager () const
 The gridManager keeping the grid on which we operate. More...
 
Constructors
template<class RAIter >
 VariableSetDescription (Spaces const &spaces_, RAIter nameIt)
 Constructor, giving each variable a name (e.g. for output purposes) More...
 
 VariableSetDescription (Spaces const &spaces_, std::vector< std::string > names_)
 Constructor. More...
 
template<class RAIter >
 VariableSetDescription (Spaces const &spaces_, RAIter nameIt, RAIter roleIt)
 Constructor specifying for each variable both a name and a role. More...
 
 VariableSetDescription (Spaces const &spaces_, std::vector< std::string > names_, std::vector< std::string > roles_)
 Constructor specifying for each variable both a name and a role. More...
 
 VariableSetDescription (Spaces const &spaces_)
 Constructor without naming the variables. More...
 

Public Attributes

Spaces spaces
 A heterogeneous sequence of pointers to (const) spaces involved. More...
 
GridView const & gridView
 The grid view on which the variables live. More...
 
IndexSet const & indexSet
 index set More...
 
std::array< std::string, noOfVariablesnames
 A sequence of variable names. More...
 
std::array< std::string, noOfVariablesroles
 

Static Public Attributes

static int const noOfVariables = boost::fusion::result_of::size<Variables>::type::value
 Number of variables in this set. More...
 
static int const continuity = Variables_Detail::Continuity<Variables,Spaces>::value
 minimal continuity of any variable in the set More...
 
template<int idx>
static constexpr int spaceIndex = boost::fusion::result_of::value_at_c<Variables,idx>::type::spaceIndex
 space index of the i'th variable More...
 

Related Functions

(Note that these are not member functions.)

template<class ... Spaces>
auto makeSpaceList (Spaces *... spaces)
 Creates a list of finite element spaces in the required format. Usage example (for Stokes flow): More...
 
template<class SpaceList , class VariableList >
VariableSetDescription< SpaceList, VariableList > makeVariableSetDescription (SpaceList const &spaces, VariableList const &vars)
 Creates a variable set description from given spaces and variables. More...
 

Creation of variable sets and coefficient vectors

template<int first = 0, int last = noOfVariables>
using CoefficientVector = typename CoefficientVectorRepresentation< first, last >::type
 The type of coefficient vectors of variable sets (and subsets). More...
 
template<int first = 0, int last = noOfVariables>
auto zeroCoefficientVector () const
 Returns a zero initialized coefficient vector for variables [first,last[. More...
 
VariableSet variableSet () const
 Returns a zero-initialized variable set. More...
 

Size and Dimension queries

template<int i>
static constexpr int components = boost::fusion::result_of::value_at_c<Variables,i>::type::m
 number of components of i'th variable More...
 
size_t degreesOfFreedom (int first=0, int last=noOfVariables) const
 Computes the total number of scalar degrees of freedom collected in the variables [first,last). More...
 
static size_t degreesOfFreedom (Spaces const &spaces, int first, int last)
 Computes the total number of scalar degrees of freedom collected in the variables [first,last). More...
 
static std::array< size_t, noOfVariablesvariableDimensions (Spaces const &spaces, int first=0, int last=noOfVariables)
 Computes for each variable the number of scalar degrees of freedom. More...
 

Member Typedef Documentation

◆ CoefficientVector

template<class SpaceList , class VariableList >
template<int first = 0, int last = noOfVariables>
using Kaskade::VariableSetDescription< SpaceList, VariableList >::CoefficientVector = typename CoefficientVectorRepresentation<first,last>::type

The type of coefficient vectors of variable sets (and subsets).

This is a LinearProductSpace of Dune::BlockVector, with appropriate entry dimension.

Template Parameters
firstindex of first variable in the set (default: 0)
lastone behind index of last variable in the set (default: number of variables)

Definition at line 780 of file variables.hh.

◆ Evaluators

template<class SpaceList , class VariableList >
typedef boost::fusion::result_of::as_vector<typenameboost::fusion::result_of::transform<Spaces,GetEvaluators<ShapeFunctionCache<Grid,Scalar>>>::type>::type Kaskade::VariableSetDescription< SpaceList, VariableList >::Evaluators

The boost::fusion sequence of evaluators belonging to this variable set.

Definition at line 593 of file variables.hh.

◆ Grid

template<class SpaceList , class VariableList >
typedef SpaceType<Spaces,0>::type::Grid Kaskade::VariableSetDescription< SpaceList, VariableList >::Grid

Grid type.

Definition at line 571 of file variables.hh.

◆ GridView

template<class SpaceList , class VariableList >
typedef SpaceType<Spaces,0>::type::GridView Kaskade::VariableSetDescription< SpaceList, VariableList >::GridView

Grid view type.

Definition at line 573 of file variables.hh.

◆ IndexSet

template<class SpaceList , class VariableList >
typedef SpaceType<Spaces,0>::type::IndexSet Kaskade::VariableSetDescription< SpaceList, VariableList >::IndexSet

IndexSet type.

Definition at line 575 of file variables.hh.

◆ RepresentationData

template<class SpaceList , class VariableList >
typedef Variables_Detail::VariableRangeCreator<Variables,ConstructElement<Spaces>>::type Kaskade::VariableSetDescription< SpaceList, VariableList >::RepresentationData

Type that contains a set of variables inside a boost vector, together with all the data.

This is a boost::fusion::vector with Dune::BlockVector entries.

Definition at line 550 of file variables.hh.

◆ Scalar

template<class SpaceList , class VariableList >
typedef SpaceType<Spaces,0>::type::Scalar Kaskade::VariableSetDescription< SpaceList, VariableList >::Scalar

scalar field type

Definition at line 569 of file variables.hh.

◆ Space

template<class SpaceList , class VariableList >
template<int idx>
using Kaskade::VariableSetDescription< SpaceList, VariableList >::Space = std::remove_pointer_t<typename boost::fusion::result_of::value_at_c<Spaces,SpaceIndex<idx>::spaceIndex>::type>

The type of finite element space of the i-th variable.

Definition at line 727 of file variables.hh.

◆ Spaces

template<class SpaceList , class VariableList >
typedef SpaceList Kaskade::VariableSetDescription< SpaceList, VariableList >::Spaces

type of boost::fusion::vector of FEFunctionSpace s needed

Definition at line 540 of file variables.hh.

◆ Variables

template<class SpaceList , class VariableList >
using Kaskade::VariableSetDescription< SpaceList, VariableList >::Variables = typename Variables_Detail::ImplicitIdVariableDescriptions<VariableList>::type

type of boost::fusion vector of VariableDescription s

Definition at line 543 of file variables.hh.

◆ VariableSet

template<class SpaceList , class VariableList >
typedef Kaskade::VariableSet<VariableSetDescription<Spaces,VariableList> > Kaskade::VariableSetDescription< SpaceList, VariableList >::VariableSet

Type that contains a set of variable values with some functionality, such as simple vector arithmetic and so on (cf. class VariableSet)

Construct an object r of this type from a given VariableSetDescription vsd by:

A class for storing a heterogeneous collection of FunctionSpaceElement s.
Definition: variables.hh:341

or by

auto x = vsd.variableSet();

Definition at line 566 of file variables.hh.

Constructor & Destructor Documentation

◆ VariableSetDescription() [1/5]

template<class SpaceList , class VariableList >
template<class RAIter >
Kaskade::VariableSetDescription< SpaceList, VariableList >::VariableSetDescription ( Spaces const &  spaces_,
RAIter  nameIt 
)
inline

Constructor, giving each variable a name (e.g. for output purposes)

Definition at line 602 of file variables.hh.

◆ VariableSetDescription() [2/5]

template<class SpaceList , class VariableList >
Kaskade::VariableSetDescription< SpaceList, VariableList >::VariableSetDescription ( Spaces const &  spaces_,
std::vector< std::string >  names_ 
)
inline

Constructor.

Parameters
spacesa heterogeneous sequence of pointers to the (const) involved spaces. This is copied internally and need not persist.
namescontains a name for each variable.

Definition at line 614 of file variables.hh.

◆ VariableSetDescription() [3/5]

template<class SpaceList , class VariableList >
template<class RAIter >
Kaskade::VariableSetDescription< SpaceList, VariableList >::VariableSetDescription ( Spaces const &  spaces_,
RAIter  nameIt,
RAIter  roleIt 
)
inline

Constructor specifying for each variable both a name and a role.

Definition at line 625 of file variables.hh.

◆ VariableSetDescription() [4/5]

template<class SpaceList , class VariableList >
Kaskade::VariableSetDescription< SpaceList, VariableList >::VariableSetDescription ( Spaces const &  spaces_,
std::vector< std::string >  names_,
std::vector< std::string >  roles_ 
)
inline

Constructor specifying for each variable both a name and a role.

Definition at line 634 of file variables.hh.

◆ VariableSetDescription() [5/5]

template<class SpaceList , class VariableList >
Kaskade::VariableSetDescription< SpaceList, VariableList >::VariableSetDescription ( Spaces const &  spaces_)
inline

Constructor without naming the variables.

Definition at line 641 of file variables.hh.

Member Function Documentation

◆ degreesOfFreedom() [1/2]

template<class SpaceList , class VariableList >
size_t Kaskade::VariableSetDescription< SpaceList, VariableList >::degreesOfFreedom ( int  first = 0,
int  last = noOfVariables 
) const
inline

Computes the total number of scalar degrees of freedom collected in the variables [first,last).

For each affected variable, the number of components is multiplied with the degrees of freedom of its FE space.

Definition at line 661 of file variables.hh.

Referenced by Kaskade::VariableSetDescription< SpaceList, VariableList >::degreesOfFreedom(), Kaskade::HigherOrderRecovery< Grid, Space >::getErrorFunction(), and Kaskade::Limex< Eq >::step().

◆ degreesOfFreedom() [2/2]

template<class SpaceList , class VariableList >
static size_t Kaskade::VariableSetDescription< SpaceList, VariableList >::degreesOfFreedom ( Spaces const &  spaces,
int  first,
int  last 
)
inlinestatic

Computes the total number of scalar degrees of freedom collected in the variables [first,last).

For each affected variable, the number of components is multiplied with the degrees of freedom of its FE space.

Definition at line 671 of file variables.hh.

◆ gridManager()

template<class SpaceList , class VariableList >
GridManagerBase< Grid > const & Kaskade::VariableSetDescription< SpaceList, VariableList >::gridManager ( ) const
inline

The gridManager keeping the grid on which we operate.

Definition at line 817 of file variables.hh.

◆ variableDimensions()

template<class SpaceList , class VariableList >
static std::array< size_t, noOfVariables > Kaskade::VariableSetDescription< SpaceList, VariableList >::variableDimensions ( Spaces const &  spaces,
int  first = 0,
int  last = noOfVariables 
)
inlinestatic

Computes for each variable the number of scalar degrees of freedom.

Definition at line 681 of file variables.hh.

Referenced by Kaskade::VariableSetDescription< SpaceList, VariableList >::degreesOfFreedom().

◆ variableSet()

template<class SpaceList , class VariableList >
VariableSet Kaskade::VariableSetDescription< SpaceList, VariableList >::variableSet ( ) const
inline

Returns a zero-initialized variable set.

Definition at line 795 of file variables.hh.

◆ zeroCoefficientVector()

template<class SpaceList , class VariableList >
template<int first = 0, int last = noOfVariables>
auto Kaskade::VariableSetDescription< SpaceList, VariableList >::zeroCoefficientVector ( ) const
inline

Returns a zero initialized coefficient vector for variables [first,last[.

Definition at line 786 of file variables.hh.

Member Data Documentation

◆ components

template<class SpaceList , class VariableList >
template<int i>
constexpr int Kaskade::VariableSetDescription< SpaceList, VariableList >::components = boost::fusion::result_of::value_at_c<Variables,i>::type::m
staticconstexpr

number of components of i'th variable

Definition at line 692 of file variables.hh.

◆ continuity

template<class SpaceList , class VariableList >
int const Kaskade::VariableSetDescription< SpaceList, VariableList >::continuity = Variables_Detail::Continuity<Variables,Spaces>::value
static

minimal continuity of any variable in the set

This is the number of how often all the functions are continuously differentiable. 0 means globally continuous with discontinuous derivatives. -1 denotes bounded but discontinuous functions.

Definition at line 586 of file variables.hh.

◆ gridView

template<class SpaceList , class VariableList >
GridView const& Kaskade::VariableSetDescription< SpaceList, VariableList >::gridView

◆ indexSet

template<class SpaceList , class VariableList >
IndexSet const& Kaskade::VariableSetDescription< SpaceList, VariableList >::indexSet

◆ names

template<class SpaceList , class VariableList >
std::array<std::string,noOfVariables> Kaskade::VariableSetDescription< SpaceList, VariableList >::names

A sequence of variable names.

Definition at line 825 of file variables.hh.

Referenced by Kaskade::VariableSetDescription< SpaceList, VariableList >::VariableSetDescription().

◆ noOfVariables

template<class SpaceList , class VariableList >
int const Kaskade::VariableSetDescription< SpaceList, VariableList >::noOfVariables = boost::fusion::result_of::size<Variables>::type::value
static

◆ roles

template<class SpaceList , class VariableList >
std::array<std::string,noOfVariables> Kaskade::VariableSetDescription< SpaceList, VariableList >::roles

◆ spaceIndex

template<class SpaceList , class VariableList >
template<int idx>
constexpr int Kaskade::VariableSetDescription< SpaceList, VariableList >::spaceIndex = boost::fusion::result_of::value_at_c<Variables,idx>::type::spaceIndex
staticconstexpr

space index of the i'th variable

For querying the space index of variables, a more convenient method is to use the global spaceIndex templated value:

int varSpaceIdx = spaceIndex<VariableSetDesc,varIdx>;
Template Parameters
idxthe variable index

Definition at line 714 of file variables.hh.

◆ spaces

template<class SpaceList , class VariableList >
Spaces Kaskade::VariableSetDescription< SpaceList, VariableList >::spaces

A heterogeneous sequence of pointers to (const) spaces involved.

Definition at line 807 of file variables.hh.

Referenced by Kaskade::AnotherHBErrorEstimator< Functional, VariableSetDescription, ExtensionVariableSetDescription, ExtensionSpace, NormFunctional, LinearSolverLA, LinearSolverHA, LinearSolverHU, LinearSolverLU, RefinementStrategy, lump >::AnotherHBErrorEstimator(), Kaskade::coarsening(), Kaskade::VariableSetDescription< SpaceList, VariableList >::degreesOfFreedom(), Kaskade::EmbeddedErrorEstimator< VariableSetDescription, Scaling >::estimate(), Kaskade::VariableSetDescription< SpaceList, VariableList >::gridManager(), Kaskade::VariableSetDescription< SpaceList, VariableList >::CoefficientVectorRepresentation< first, last >::init(), Kaskade::MartinsErrorEstimator< Functional, VariableSetDescription, ExtensionVariableSetDescription, ExtensionSpace, NormFunctional, LinearSystemSolver_H, LinearSystemSolver_L, LinearSolverA_H, LinearSolverA_L, RefinementStrategy >::MartinsErrorEstimator(), Kaskade::Limex< Eq >::step(), Kaskade::StupidHBErrorEstimator< Functional, VariableSetDescription, ExtensionVariableSetDescription, ExtensionSpace, NormFunctional, LinearSolverHA, RefinementStrategy >::StupidHBErrorEstimator(), Kaskade::VariableSetDescription< SpaceList, VariableList >::variableDimensions(), Kaskade::YetAnotherHBErrorEstimator< Functional, VariableSetDescription, ExtensionVariableSetDescription, ExtensionSpace, NormFunctional, RefinementStrategy, lump, components, ReferenceSolution, ReferenceOperator >::YetAnotherHBErrorEstimator(), Kaskade::YetAnotherHBErrorEstimator_Elasticity< Functional, VariableSetDescription, ExtensionVariableSetDescription, ExtensionSpace, NormFunctional, RefinementStrategy, lump, components >::YetAnotherHBErrorEstimator_Elasticity(), and Kaskade::VariableSetDescription< SpaceList, VariableList >::zeroCoefficientVector().


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