KASKADE 7 development version
Loading...
Searching...
No Matches
Kaskade::VariableSet< VSDescriptions > Class Template Reference

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

#include <variables.hh>

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

Public Types

typedef VSDescriptions Descriptions
 Type of the VariableSetDescription.
typedef VSDescriptions::RepresentationData Functions
 boost::fusion::vector of data elements (of type FunctionSpaceElement)
typedef LinearProductSpace< Scalar, Functions > LinearSpace
typedef Scalar field_type
typedef VSDescriptions::RepresentationData Sequence
 boost::fusion::vector of element vectors.
using Component
 The type of the m-th component.

Public Member Functions

 VariableSet ()=delete
 VariableSet (Self const &vs)
 Copy constructor.
 VariableSet (Self &&vs)
 Move constructor.
 VariableSet (Descriptions const &d)
 Constructor.
Self & operator= (Self const &v)
 Assignment.
Self & operator= (Self &&v)
 Move assignment.
template<class S>
Self & operator= (S const &s)
 Assignment from other (compatible) types.
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.
Self & operator+= (LinearProductSpace< Scalar, SequenceY > const &y)
 In place addition.
Self & operator-= (Self const &y)
 In place subtraction.
Self & axpy (Scalar a, Self const &y)
 this <- this + a*y
void read (InIterator i)
 DEPRECATED use vectorFromSequence instead.
void write (OutIterator i) const
 DEPRECATED use vectorToSequence instead.
Evaluation of variables
template<int i, class Evaluators>
auto value (Evaluators const &evals) const
 Value of an individual variable in the set.
template<int i>
auto value (Cell< GridView > const &cell, LocalPosition< GridView > const &xi) const
 Value of an individual variable in the set.
template<int i>
auto value (GlobalPosition< GridView > const &x) const
 Value of an individual variable in the set.
template<int i, class Evaluators>
auto derivative (Evaluators const &evals) const
 Derivative of an individual variable in the set.
template<int i>
auto derivative (Cell< GridView > const &cell, LocalPosition< GridView > const &xi) const
 Derivative of an individual variable in the set.
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.
template<int i, class Evaluators>
auto hessian (Evaluators const &evals) const
 Hessian of an individual variable in the set.
template<int i>
auto hessian (Cell< GridView > const &cell, LocalPosition< GridView > const &xi) const
 Hessian of an individual variable in the set.
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.
Assignment
Self & operator*= (Scalar a)
 Scaling.
Scalar products and norms
field_type operator* (Self const &y) const
 Scalar product.
field_type dot (Self const &y) const
 Scalar product.
double two_norm2 () const
 squared euclidean norm
double two_norm () const
 euclidean norm

Public Attributes

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

(Note that these are not member symbols.)

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

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

Member Typedef Documentation

◆ Component

using Kaskade::LinearProductSpace< VSDescriptions::Scalar, VSDescriptions::RepresentationData >::Component
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 340 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 343 of file variables.hh.

◆ LinearSpace

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

Definition at line 355 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/4]

◆ VariableSet() [2/4]

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

Copy constructor.

Definition at line 361 of file variables.hh.

◆ VariableSet() [3/4]

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

Move constructor.

Definition at line 367 of file variables.hh.

◆ VariableSet() [4/4]

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 380 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 482 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 472 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 492 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 303 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 511 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 501 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 521 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 293 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/3]

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

◆ operator=() [2/3]

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

Move assignment.

Definition at line 399 of file variables.hh.

◆ operator=() [3/3]

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

Assignment.

Definition at line 388 of file variables.hh.

◆ read()

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.

◆ two_norm()

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

euclidean norm

Definition at line 319 of file linearspace.hh.

◆ two_norm2()

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

squared euclidean norm

Definition at line 311 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 451 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 436 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 463 of file variables.hh.

◆ write()

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 265 of file linearspace.hh.

◆ 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 488 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

auto const & component(LinearProductSpace< Scalar, Sequence > const &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 458 of file linearspace.hh.

Referenced by Kaskade::VariableSet< Descriptions >::derivative(), Kaskade::VariableSet< Descriptions >::derivative(), Kaskade::VariableSet< Descriptions >::derivative(), Kaskade::VariableSet< Descriptions >::hessian(), Kaskade::VariableSet< Descriptions >::hessian(), Kaskade::VariableSet< Descriptions >::hessian(), Kaskade::VariableSet< Descriptions >::value(), Kaskade::VariableSet< Descriptions >::value(), and Kaskade::VariableSet< Descriptions >::value().

◆ 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 515 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 503 of file linearspace.hh.

Member Data Documentation

◆ data

◆ descriptions


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