KASKADE 7 development version
Public Types | Public Member Functions | Public Attributes | Related Functions | List of all members
Kaskade::VariableSet< VSDescriptions > Class Template Reference

A class for storing a heterogeneous collection of FunctionSpaceElement s. More...

#include <variables.hh>

Detailed Description

template<class VSDescriptions>
class Kaskade::VariableSet< VSDescriptions >

A class for storing a heterogeneous collection of FunctionSpaceElement s.

Template Parameters
Descriptionsa VariableSetDescription class

Basic vector operations and I/O are supported.

The type of a VariableSet is defined via a VariableSetDescription, which contains information about the variables in form of a boost::fusion::vector of FEFunctionSpace s and VariableDescription s. The type of a VariableSet can be determined by VariableSetDescription::VariableSet.

VariableSet s contains a collection of FunctionSpaceElement s (vars) and a reference to its VariableSetDescription (descriptions). Simultaneous evaluation of all functions is supported by evaluateVariables.

Usually, solutions are stored in VariableSets. Access to data is via the public member variable data, which is a boost::fusion::vector of FunctionSpaceElement s

Definition at line 339 of file variables.hh.

Inheritance diagram for Kaskade::VariableSet< VSDescriptions >:
Kaskade::LinearProductSpace< VSDescriptions::Scalar, VSDescriptions::RepresentationData >

Public Types

typedef VSDescriptions Descriptions
 Type of the VariableSetDescription. More...
 
typedef VSDescriptions::RepresentationData Functions
 boost::fusion::vector of data elements (of type FunctionSpaceElement) More...
 
typedef LinearProductSpace< Scalar, FunctionsLinearSpace
 
typedef Scalar field_type
 
typedef VSDescriptions::RepresentationData Sequence
 boost::fusion::vector of element vectors. More...
 
using Component = std::remove_reference_t< typename boost::fusion::result_of::at_c< Sequence const, m >::type >
 The type of the m-th component. More...
 

Public Member Functions

 VariableSet (Self const &vs)
 Copy constructor. More...
 
 VariableSet (Descriptions const &d)
 Constructor. More...
 
Selfoperator= (Self const &v)
 Assignment. More...
 
template<class S >
Selfoperator= (S const &s)
 Assignment from other (compatible) types. More...
 
size_t dim () const
 Number of scalar degrees of freedom. This computes the total number of degrees of freedom, i.e. the sum of the dimensions of the components. More...
 
Selfoperator+= (LinearProductSpace< Scalar, SequenceY > const &y)
 In place addition. More...
 
Selfoperator-= (Self const &y)
 In place subtraction. More...
 
Selfaxpy (Scalar a, Self const &y)
 this <- this + a*y More...
 
void read (InIterator i)
 DEPRECATED use vectorFromSequence instead. More...
 
void read (int rbegin, int rend, InIterator i)
 Reads the coefficients of the subrange [rbegin,rend[ sequentially from an input iterator. The InIterator's value type must be convertible to field_type. More...
 
void write (OutIterator i) const
 DEPRECATED use vectorToSequence instead. More...
 
void write (int rbegin, int rend, DataOutIter i) const
 Writes the coefficients of the subrange [rbegin,rend[ sequentially to an output iterator. The InIterator's value type must be convertible to field_type. More...
 
Evaluation of variables
template<int i, class Evaluators >
auto value (Evaluators const &evals) const
 Value of an individual variable in the set. More...
 
template<int i>
auto value (Cell< GridView > const &cell, LocalPosition< GridView > const &xi) const
 Value of an individual variable in the set. More...
 
template<int i>
auto value (GlobalPosition< GridView > const &x) const
 Value of an individual variable in the set. More...
 
template<int i, class Evaluators >
auto derivative (Evaluators const &evals) const
 Derivative of an individual variable in the set. More...
 
template<int i>
auto derivative (Cell< GridView > const &cell, LocalPosition< GridView > const &xi) const
 Derivative of an individual variable in the set. More...
 
template<int i>
auto derivative (GlobalPosition< GridView > const &x) const
 derivative of an individual variable in the set. \WARNING This method is comparatively DEAD SLOW.
More...
 
template<int i, class Evaluators >
auto hessian (Evaluators const &evals) const
 Hessian of an individual variable in the set. More...
 
template<int i>
auto hessian (Cell< GridView > const &cell, LocalPosition< GridView > const &xi) const
 Hessian of an individual variable in the set. More...
 
template<int i>
auto hessian (GlobalPosition< GridView > const &x) const
 Hessian of an individual variable in the set. \WARNING This method is comparatively DEAD SLOW.
More...
 
Assignment
Selfoperator*= (Scalar a)
 Scaling. More...
 
Scalar products and norms
field_type operator* (Self const &y) const
 Scalar product. More...
 
field_type dot (Self const &y) const
 Scalar product. More...
 
double two_norm2 () const
 squared euclidean norm More...
 
double two_norm () const
 euclidean norm More...
 

Public Attributes

Descriptions const & descriptions
 Descriptions of variable set, of type VariableSetDescription (lots of useful infos) More...
 
Sequence data
 Data. More...
 

Related Functions

(Note that these are not member functions.)

auto const & component (LinearProductSpace< Scalar, Sequence > const &x)
 Provides access to the m-th component of a product space. More...
 
auto cartesianProduct (X0 const &x0, Xs const &... xs)
 Creates a cartesian product of the given vectors, i.e. a LinearProductSpace object. More...
 
OutIter vectorToSequence (LinearProductSpace< Scalar, VSDescriptions::RepresentationData > const &v, OutIter i)
 writes the coefficients of a vector to a flat scalar sequence <Scalar,Seq> More...
 
InIter vectorFromSequence (LinearProductSpace< Scalar, VSDescriptions::RepresentationData > &v, InIter i)
 reads the coefficients of a vector from a flat scalar sequence <Scalar,Seq> More...
 

Member Typedef Documentation

◆ Component

using Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::Component = std::remove_reference_t<typename boost::fusion::result_of::at_c<Sequence const,m>::type>
inherited

The type of the m-th component.

Definition at line 104 of file linearspace.hh.

◆ Descriptions

template<class VSDescriptions >
typedef VSDescriptions Kaskade::VariableSet< VSDescriptions >::Descriptions

Type of the VariableSetDescription.

Definition at line 344 of file variables.hh.

◆ field_type

typedef Scalar Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::field_type
inherited

Definition at line 94 of file linearspace.hh.

◆ Functions

template<class VSDescriptions >
typedef VSDescriptions::RepresentationData Kaskade::VariableSet< VSDescriptions >::Functions

boost::fusion::vector of data elements (of type FunctionSpaceElement)

Definition at line 347 of file variables.hh.

◆ LinearSpace

template<class VSDescriptions >
typedef LinearProductSpace<Scalar,Functions> Kaskade::VariableSet< VSDescriptions >::LinearSpace

Definition at line 359 of file variables.hh.

◆ Sequence

typedef VSDescriptions::RepresentationData Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::Sequence
inherited

boost::fusion::vector of element vectors.

Definition at line 97 of file linearspace.hh.

Constructor & Destructor Documentation

◆ VariableSet() [1/2]

template<class VSDescriptions >
Kaskade::VariableSet< VSDescriptions >::VariableSet ( Self const &  vs)
inline

◆ VariableSet() [2/2]

template<class VSDescriptions >
Kaskade::VariableSet< VSDescriptions >::VariableSet ( Descriptions const &  d)
inlineexplicit

Constructor.

This creates a zero-initialized set of variables.

Parameters
dthe VariableSetDescription object (has to exist during the lifetime of this VariableSet).

Definition at line 372 of file variables.hh.

Member Function Documentation

◆ axpy()

Self & Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::axpy ( Scalar  a,
Self const &  y 
)
inlineinherited

this <- this + a*y

Definition at line 233 of file linearspace.hh.

◆ derivative() [1/3]

template<class VSDescriptions >
template<int i>
auto Kaskade::VariableSet< VSDescriptions >::derivative ( Cell< GridView > const &  cell,
LocalPosition< GridView > const &  xi 
) const
inline

Derivative of an individual variable in the set.

Definition at line 463 of file variables.hh.

◆ derivative() [2/3]

template<class VSDescriptions >
template<int i, class Evaluators >
auto Kaskade::VariableSet< VSDescriptions >::derivative ( Evaluators const &  evals) const
inline

Derivative of an individual variable in the set.

Definition at line 453 of file variables.hh.

◆ derivative() [3/3]

template<class VSDescriptions >
template<int i>
auto Kaskade::VariableSet< VSDescriptions >::derivative ( GlobalPosition< GridView > const &  x) const
inline

derivative of an individual variable in the set. \WARNING This method is comparatively DEAD SLOW.

Definition at line 473 of file variables.hh.

◆ dim()

size_t Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::dim ( ) const
inlineinherited

Number of scalar degrees of freedom. This computes the total number of degrees of freedom, i.e. the sum of the dimensions of the components.

Definition at line 154 of file linearspace.hh.

◆ dot()

field_type Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::dot ( Self const &  y) const
inlineinherited

Scalar product.

Definition at line 302 of file linearspace.hh.

◆ hessian() [1/3]

template<class VSDescriptions >
template<int i>
auto Kaskade::VariableSet< VSDescriptions >::hessian ( Cell< GridView > const &  cell,
LocalPosition< GridView > const &  xi 
) const
inline

Hessian of an individual variable in the set.

Definition at line 492 of file variables.hh.

◆ hessian() [2/3]

template<class VSDescriptions >
template<int i, class Evaluators >
auto Kaskade::VariableSet< VSDescriptions >::hessian ( Evaluators const &  evals) const
inline

Hessian of an individual variable in the set.

Definition at line 482 of file variables.hh.

◆ hessian() [3/3]

template<class VSDescriptions >
template<int i>
auto Kaskade::VariableSet< VSDescriptions >::hessian ( GlobalPosition< GridView > const &  x) const
inline

Hessian of an individual variable in the set. \WARNING This method is comparatively DEAD SLOW.

Definition at line 502 of file variables.hh.

◆ operator*()

field_type Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::operator* ( Self const &  y) const
inlineinherited

Scalar product.

For two vectors \( (x_i)_{i=0,\dots,n-1} \) and \( (y_i)_{i=0,\dots,n-1}\) this computes and returns the euclidean scalar product

\[ \sum_{i=0}^{n-1} \langle x_i , y_i \rangle. \]

For the entries' scalar products, the operator*() is called.

Definition at line 292 of file linearspace.hh.

◆ operator*=()

Self & Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::operator*= ( Scalar  a)
inlineinherited

Scaling.

Definition at line 213 of file linearspace.hh.

◆ operator+=()

Self & Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::operator+= ( LinearProductSpace< Scalar, SequenceY > const &  y)
inlineinherited

In place addition.

Definition at line 221 of file linearspace.hh.

◆ operator-=()

Self & Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::operator-= ( Self const &  y)
inlineinherited

In place subtraction.

Definition at line 227 of file linearspace.hh.

◆ operator=() [1/2]

template<class VSDescriptions >
template<class S >
Self & Kaskade::VariableSet< VSDescriptions >::operator= ( S const &  s)
inline

Assignment from other (compatible) types.

Compatible types are those for which the base class LinearProductSpace<...> has a matching assignment operator. This includes, in particular, the coefficient vector representation Descriptions::CoefficientVectorRepresentation::type, i.e. a LinearProductSpace<Scalar,DuneBlockVector<...>> with matching entries and lengths.

Definition at line 399 of file variables.hh.

◆ operator=() [2/2]

template<class VSDescriptions >
Self & Kaskade::VariableSet< VSDescriptions >::operator= ( Self const &  v)
inline

Assignment.

Definition at line 383 of file variables.hh.

◆ read() [1/2]

void Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::read ( InIterator  i)
inlineinherited

DEPRECATED use vectorFromSequence instead.

Reads the coefficients sequentially from an input iterator. The InIterator's value type must be convertible to field_type.

Definition at line 245 of file linearspace.hh.

◆ read() [2/2]

void Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::read ( int  rbegin,
int  rend,
InIterator  i 
)
inlineinherited

Reads the coefficients of the subrange [rbegin,rend[ sequentially from an input iterator. The InIterator's value type must be convertible to field_type.

Definition at line 255 of file linearspace.hh.

◆ two_norm()

double Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::two_norm ( ) const
inlineinherited

euclidean norm

Definition at line 318 of file linearspace.hh.

◆ two_norm2()

double Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::two_norm2 ( ) const
inlineinherited

squared euclidean norm

Definition at line 310 of file linearspace.hh.

◆ value() [1/3]

template<class VSDescriptions >
template<int i>
auto Kaskade::VariableSet< VSDescriptions >::value ( Cell< GridView > const &  cell,
LocalPosition< GridView > const &  xi 
) const
inline

Value of an individual variable in the set.

Template Parameters
ithe index of the variable to evaluate
Parameters
cellthe cell in which to evaluate the variable
xithe local coordinate within the cell at which to evaluate

Definition at line 432 of file variables.hh.

◆ value() [2/3]

template<class VSDescriptions >
template<int i, class Evaluators >
auto Kaskade::VariableSet< VSDescriptions >::value ( Evaluators const &  evals) const
inline

Value of an individual variable in the set.

Template Parameters
ithe index of the variable to evaluate
Evaluatorsa boost::fusion sequence of evaluators, corresponding to the list of spaces of this variable set

Definition at line 417 of file variables.hh.

◆ value() [3/3]

template<class VSDescriptions >
template<int i>
auto Kaskade::VariableSet< VSDescriptions >::value ( GlobalPosition< GridView > const &  x) const
inline

Value of an individual variable in the set.

Template Parameters
ithe index of the variable to evaluate
Parameters
xthe global coordinate within the geometry at which to evaluate \WARNING This method is comparatively DEAD SLOW.

Definition at line 444 of file variables.hh.

◆ write() [1/2]

void Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::write ( int  rbegin,
int  rend,
DataOutIter  i 
) const
inlineinherited

Writes the coefficients of the subrange [rbegin,rend[ sequentially to an output iterator. The InIterator's value type must be convertible to field_type.

Definition at line 274 of file linearspace.hh.

◆ write() [2/2]

void Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::write ( OutIterator  i) const
inlineinherited

DEPRECATED use vectorToSequence instead.

Writes the coefficients sequentially to an output iterator (flattening). The field_type must be convertible to the OutIterator's value type.

Definition at line 264 of file linearspace.hh.

Friends And Related Function Documentation

◆ cartesianProduct()

auto cartesianProduct ( X0 const &  x0,
Xs const &...  xs 
)
related

Creates a cartesian product of the given vectors, i.e. a LinearProductSpace object.

Definition at line 478 of file linearspace.hh.

◆ component()

auto const & component ( LinearProductSpace< Scalar, Sequence > const &  x)
related

Provides access to the m-th component of a product space.

This simplifies the access to individual components of a product space, e.g., a variable set of finite element functions. Instead of

boost::fusion::at_c<m>(x.data)

one can write

component<m>(x)
Template Parameters
mthe index of the component (nonnegative)
Scalara scalar type
Sequencea boost::fusion sequence type
Returns
a reference to the m-th component

Definition at line 457 of file linearspace.hh.

◆ vectorFromSequence()

InIter vectorFromSequence ( LinearProductSpace< Scalar, VSDescriptions::RepresentationData > &  v,
InIter  i 
)
related

reads the coefficients of a vector from a flat scalar sequence <Scalar,Seq>

Definition at line 505 of file linearspace.hh.

◆ vectorToSequence()

OutIter vectorToSequence ( LinearProductSpace< Scalar, VSDescriptions::RepresentationData > const &  v,
OutIter  i 
)
related

writes the coefficients of a vector to a flat scalar sequence <Scalar,Seq>

Definition at line 493 of file linearspace.hh.

Member Data Documentation

◆ data

Sequence Kaskade::LinearProductSpace< VSDescriptions::Scalar , VSDescriptions::RepresentationData >::data
inherited

Data.

Definition at line 328 of file linearspace.hh.

◆ descriptions

template<class VSDescriptions >
Descriptions const& Kaskade::VariableSet< VSDescriptions >::descriptions

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