KASKADE 7 development version
Loading...
Searching...
No Matches
Kaskade::VariableSetDescription< SpaceList, VariableList > Class Template Reference

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

#include <variables.hh>

Classes

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
using Variables = typename Variables_Detail::ImplicitIdVariableDescriptions<VariableList>::type
 type of boost::fusion vector of VariableDescription s
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.
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)
typedef SpaceType< Spaces, 0 >::type::Scalar Scalar
 scalar field type
typedef SpaceType< Spaces, 0 >::type::Grid Grid
 Grid type.
typedef SpaceType< Spaces, 0 >::type::GridView GridView
 Grid view type.
typedef SpaceType< Spaces, 0 >::type::IndexSet IndexSet
 IndexSet type.
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.
template<int idx>
using Space = std::remove_pointer_t<typename boost::fusion::result_of::value_at_c<Spaces,spaceIndex<idx>>::type>
 The type of finite element space of the i-th variable.

Public Member Functions

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

Public Attributes

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

Static Public Attributes

static int const noOfVariables = boost::fusion::result_of::size<Variables>::type::value
 Number of variables in this set.
static int const continuity = Variables_Detail::Continuity<Variables,Spaces>::value
 minimal continuity of any variable in the set
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

(Note that these are not member symbols.)

template<class ... Spaces>
auto makeSpaceList (Spaces *... spaces)
 Creates a list of finite element spaces in the required format. Usage example (for Stokes flow):
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.

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).
template<int first = 0, int last = noOfVariables>
auto zeroCoefficientVector () const
 Returns a zero initialized coefficient vector for variables [first,last[.
VariableSet variableSet () const
 Returns a zero-initialized variable set.
template<int first = 0, int last = noOfVariables>
static auto zeroCoefficientVector (Spaces const &spaces)
 Returns a zero initialized coefficient vector for variables [first,last[.

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
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).
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).
static std::array< size_t, noOfVariables > variableDimensions (Spaces const &spaces, int first=0, int last=noOfVariables)
 Computes for each variable the number of scalar degrees of freedom.

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 553 of file variables.hh.

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 800 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 611 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 588 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 590 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 592 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 567 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 586 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>>::type>

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

Definition at line 745 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 557 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 560 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:

Kaskade::VariableSet< VariableSetDescription< Spaces, VariableList > > VariableSet
Type that contains a set of variable values with some functionality, such as simple vector arithmetic...
Definition variables.hh:583

or by

auto x = vsd.variableSet();

Definition at line 583 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 620 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 632 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 643 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 652 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 659 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 679 of file variables.hh.

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

◆ degreesOfFreedom() [2/2]

template<class SpaceList, class VariableList>
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 689 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 848 of file variables.hh.

◆ variableDimensions()

template<class SpaceList, class VariableList>
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 699 of file variables.hh.

Referenced by Kaskade::VariableSetDescription< SpacesForAssembly, ErrorFunctionVariables >::degreesOfFreedom().

◆ variableSet()

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

Returns a zero-initialized variable set.

Definition at line 826 of file variables.hh.

◆ zeroCoefficientVector() [1/2]

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 816 of file variables.hh.

Referenced by Kaskade::VariableSetDescription< SpacesForAssembly, ErrorFunctionVariables >::zeroCoefficientVector().

◆ zeroCoefficientVector() [2/2]

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

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

Definition at line 806 of file variables.hh.

Member Data Documentation

◆ components

template<class SpaceList, class VariableList>
template<int i>
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 710 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 604 of file variables.hh.

◆ gridView

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

The grid view on which the variables live.

Definition at line 843 of file variables.hh.

◆ indexSet

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

index set

Definition at line 851 of file variables.hh.

Referenced by Kaskade::coarsening().

◆ names

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

A sequence of variable names.

Definition at line 856 of file variables.hh.

◆ noOfVariables

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

Number of variables in this set.

Definition at line 595 of file variables.hh.

Referenced by Kaskade::coarsening().

◆ roles

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

Definition at line 858 of file variables.hh.

◆ spaceIndex

template<class SpaceList, class VariableList>
template<int idx>
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:

static constexpr int spaceIndex
space index of the i'th variable
Definition variables.hh:732
Template Parameters
idxthe variable index

Definition at line 732 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 838 of file variables.hh.

Referenced by Kaskade::coarsening(), and Kaskade::Limex< Eq >::step().


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