AMDiS  2.10
The Adaptive Multi-Dimensional Simulation Toolbox
GridFunction module

Defines GridFunctions to be used in operators, boundary-conditions, interpolation and integration. More...

Classes

class  AnalyticGridFunction< Function, GridView >
 A Gridfunction that evaluates a function with global coordinates. More...
 
class  ComposerGridFunction< Sig, EntitySet, Functor, GridFunctions >
 A Gridfunction that applies a functor to the evaluated Gridfunctions. More...
 
class  ConstantGridFunction< T, GridView >
 Gridfunction returning a constant value. More...
 
class  DerivativeGridFunction< GridFunction, Type >
 A Gridfunction that returns the derivative when calling localFunction. More...
 
class  DiscreteFunction< Coeff, GB, TreePath, R >
 A mutable view on the subspace of a DOFVector,. More...
 
class  ElementGridFunction< GridView, Container >
 Gridfunction returning a constant value per element. More...
 

Functions

template<class Expr >
auto gradientOf (Expr const &expr)
 
template<class PreGridFct , class GridView >
decltype(auto) makeGridFunction (PreGridFct const &preGridFct, GridView const &gridView)
 Generator for Gridfunctions from Expressions (PreGridfunctions) More...
 
template<class T , REQUIRES(Concepts::AnyGridFunction< T >) >
auto abs (T &&value)
 
template<class Functor , class... PreGridFcts>
auto invokeAtQP (Functor const &f, PreGridFcts &&... gridFcts)
 Generator function for ComposerGridFunction. More...
 
template<class Lhs , REQUIRES(Concepts::AnyGridFunction< Lhs >) >
auto operator- (Lhs &&lhs)
 Applies Operation::Negate to GridFunctions. More...
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto operator+ (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::Plus to GridFunctions. More...
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto operator- (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::Minus to GridFunctions. More...
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto operator* (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::Multiplies to GridFunctions. More...
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto operator/ (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::Divides to GridFunctions. More...
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto max (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::Max to GridFunctions. More...
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto min (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::Min to GridFunctions. More...
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto abs_max (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::AbsMax to GridFunctions. More...
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto abs_min (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::AbsMin to GridFunctions. More...
 
template<class V , class T , REQUIRES(Concepts::AnyGridFunction< V >) >
auto clamp (V &&v, T const &lo, T const &hi)
 Applies Operation::Clamp to GridFunction. More...
 
template<class T , REQUIRES(Concepts::AnyGridFunction< T >) >
auto tanh (T &&value)
 Applies Operation::Tanh to GridFunctions. More...
 
template<class T , REQUIRES(Concepts::AnyGridFunction< T >) >
auto signum (T &&value)
 Applies Operation::Signum to GridFunctions. More...
 
template<class T , REQUIRES(Concepts::AnyGridFunction< T >) >
auto sqr (T &&value)
 Applies Operation::Sqr to GridFunction. More...
 
template<int p, class T , REQUIRES(Concepts::AnyGridFunction< T >) >
auto pow (T &&value)
 Applies Operation::Pow. More...
 
template<class T , REQUIRES(Concepts::AnyGridFunction< T >) >
auto pow (T &&value, double p)
 Applies Operation::Power to GridFunction. More...
 
template<std::size_t I, class T , REQUIRES(Concepts::AnyGridFunction< T >) >
auto get (T &&value)
 Applies Operation::Get<I> to GridFunction. More...
 
template<class T , REQUIRES(Concepts::AnyGridFunction< T >) >
auto get (T &&value, std::size_t i)
 Applies Operation::Get_ to GridFunction. More...
 
template<class T >
auto constant (T const &value)
 Return a reference-wrapper as GridFunction. More...
 
template<class T >
auto reference (T &value)
 Return a reference-wrapper as GridFunction. More...
 
template<class Vec , REQUIRES(Concepts::AnyGridFunction< Vec >) >
auto sum (Vec &&vec)
 Applies a sum() functor to a vector-valued GridFunction. More...
 
template<class Vec , REQUIRES(Concepts::AnyGridFunction< Vec >) >
auto unary_dot (Vec &&vec)
 Applies Operation::UnaryDot to a vector-valued GridFunction. More...
 
template<class Vec , REQUIRES(Concepts::AnyGridFunction< Vec >) >
auto one_norm (Vec &&vec)
 Applies a one_norm() functor to a vector-valued GridFunction. More...
 
template<class Vec , REQUIRES(Concepts::AnyGridFunction< Vec >) >
auto two_norm (Vec &&vec)
 Applies Operation::TwoNorm to a vector-valued GridFunction. More...
 
template<int p, class Vec , REQUIRES(Concepts::AnyGridFunction< Vec >) >
auto p_norm (Vec &&vec)
 Applies a p_norm() functor to a vector-valued GridFunction. More...
 
template<class Vec , REQUIRES(Concepts::AnyGridFunction< Vec >) >
auto infty_norm (Vec &&vec)
 Applies a infty_norm() functor to a vector-valued GridFunction. More...
 
template<class Mat , REQUIRES(Concepts::AnyGridFunction< Mat >) >
auto trans (Mat &&mat)
 Applies Operation::Trans to a matrix-valued GridFunction. More...
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto dot (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::Dot to two vector-valued GridFunctions. More...
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto distance (Lhs &&lhs, Rhs &&rhs)
 Applies a distance-functor to two vector-valued GridFunctions. More...
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto outer (Lhs &&lhs, Rhs &&rhs)
 Applies an outer() functor to two vector-valued GridFunctions. More...
 

Detailed Description

Defines GridFunctions to be used in operators, boundary-conditions, interpolation and integration.

GridFunctions are expressions build up of some elementary terms and can be used to construct a GridFunctionOperator, can be interpolated to a DOFVector, and can be integrated over a GridView.

Thus, GridFunctions are an important incredient to formulate the bilinear and linear forms und to postprocess the solutions.

Examples:

  1. Usage of GridFunctions to build Operators:
    ProblemStat<Traits> prob("name");
    prob.initialize(INIT_ALL);
    auto opB = makeOperator(BiLinearForm, Expression);
    prob.addMatrixOperator(opB, Row, Col);
    auto opL = makeOperator(LinearForm, Expression);
    prob.addVectorOperator(opL, Row);
  2. Usage of GridFunctions in BoundaryConditions:
    prob.addDirichletBC(Predicate, Row, Col, Expression);
  3. Interpolate a GridFunction to a DOFVector:
    prob.solution(_0).interpol(Expression);
  4. Integrate a GridFunction on a GridView:
    auto value = integrate(Expression, prob.gridView());

Remarks:

Function Documentation

◆ abs_max()

auto abs_max ( Lhs &&  lhs,
Rhs &&  rhs 
)
related

Applies Operation::AbsMax to GridFunctions.

◆ abs_min()

auto abs_min ( Lhs &&  lhs,
Rhs &&  rhs 
)
related

Applies Operation::AbsMin to GridFunctions.

◆ clamp()

auto clamp ( V &&  v,
T const &  lo,
T const &  hi 
)
related

Applies Operation::Clamp to GridFunction.

◆ constant()

auto constant ( T const &  value)
related

Return a reference-wrapper as GridFunction.

◆ distance()

auto distance ( Lhs &&  lhs,
Rhs &&  rhs 
)
related

Applies a distance-functor to two vector-valued GridFunctions.

◆ dot()

auto dot ( Lhs &&  lhs,
Rhs &&  rhs 
)
related

Applies Operation::Dot to two vector-valued GridFunctions.

◆ get() [1/2]

auto get ( T &&  value)
related

Applies Operation::Get<I> to GridFunction.

◆ get() [2/2]

auto get ( T &&  value,
std::size_t  i 
)
related

Applies Operation::Get_ to GridFunction.

◆ gradientOf()

auto AMDiS::gradientOf ( Expr const &  expr)

Generates a Gridfunction representing the gradient of a GridFunction. See DerivativeGridFunction.

Examples:

  • gradientOf(prob.solution(_0))
  • gradientOf(X(0) + X(1) + prob.solution(_0))

Referenced by NewtonIteration< ProblemType >::oneIteration().

◆ infty_norm()

auto infty_norm ( Vec &&  vec)
related

Applies a infty_norm() functor to a vector-valued GridFunction.

◆ invokeAtQP()

auto invokeAtQP ( Functor const &  f,
PreGridFcts &&...  gridFcts 
)
related

Generator function for ComposerGridFunction.

Applies the functor f to the grid-functions gridFcts.... See ComposerGridFunction.

Examples:

  • invokeAtQP([](Dune::FieldVector<double, 2> const& x) { return two_norm(x); }, X());
  • invokeAtQP([](double u, auto const& x) { return u + x[0]; }, 1.0, X());
  • invokeAtQP(Operation::Plus{}, X(0), X(1));

References AMDiS::Concepts::Functor.

◆ makeGridFunction()

decltype(auto) AMDiS::makeGridFunction ( PreGridFct const &  preGridFct,
GridView const &  gridView 
)

Generator for Gridfunctions from Expressions (PreGridfunctions)

Create an evaluable GridFunction from an expression that itself can not be evaluated. Therefore, it binds the GridFunction to a GridView.

Example:

ProblemStat<Traits> prob("name");
prob.initialize(INIT_ALL);
auto gridFct = makeGridFunction(Expression, prob.leafGridView());
// eval GridFunction at GlobalCoordinates
auto value = gridFct(Dune::FieldVector<double,2>{1.0, 2.0});
auto localFct = localFunction(gridFct);
for (auto const& element : elements(prob.leafGridView())) {
localFct.bind(element);
// eval LocalFunction at local coordinates
auto x = localFct(element.geometry().center());
localFct.unbind();
}

In contrast to Expressions, GridFunctions can be evaluated and

  • have the free-function localFunction() to obtain a LocalFunction
  • its LocalFunctions have the free-function order() to obtain the polynomial order of the Expression (if available)
  • its LocalFunctions have the free-function derivativeOf() to differentiate the Expression with respect to global Coordinates. A derivative Expression can be created, using gradientOf() that can be converted to a GridFunction afterwards.

Referenced by ProblemStat< Traits >::addDirichletBC(), GridFunctionMarker< Grid, GridFct >::GridFunctionMarker(), DiscreteFunction< Coeff, GB, TreePath, R >::interpolate_noalias(), and GridFunctionMarker< Grid, GridFct >::markElement().

◆ max()

auto max ( Lhs &&  lhs,
Rhs &&  rhs 
)
related

Applies Operation::Max to GridFunctions.

◆ min()

auto min ( Lhs &&  lhs,
Rhs &&  rhs 
)
related

Applies Operation::Min to GridFunctions.

◆ one_norm()

auto one_norm ( Vec &&  vec)
related

Applies a one_norm() functor to a vector-valued GridFunction.

◆ operator*()

auto operator* ( Lhs &&  lhs,
Rhs &&  rhs 
)
related

Applies Operation::Multiplies to GridFunctions.

◆ operator+()

auto operator+ ( Lhs &&  lhs,
Rhs &&  rhs 
)
related

Applies Operation::Plus to GridFunctions.

◆ operator-() [1/2]

auto operator- ( Lhs &&  lhs)
related

Applies Operation::Negate to GridFunctions.

◆ operator-() [2/2]

auto operator- ( Lhs &&  lhs,
Rhs &&  rhs 
)
related

Applies Operation::Minus to GridFunctions.

◆ operator/()

auto operator/ ( Lhs &&  lhs,
Rhs &&  rhs 
)
related

Applies Operation::Divides to GridFunctions.

◆ outer()

auto outer ( Lhs &&  lhs,
Rhs &&  rhs 
)
related

Applies an outer() functor to two vector-valued GridFunctions.

◆ p_norm()

auto p_norm ( Vec &&  vec)
related

Applies a p_norm() functor to a vector-valued GridFunction.

◆ pow() [1/2]

auto pow ( T &&  value)
related

Applies Operation::Pow.

to GridFunction.

◆ pow() [2/2]

auto pow ( T &&  value,
double  p 
)
related

Applies Operation::Power to GridFunction.

◆ reference()

auto reference ( T &  value)
related

Return a reference-wrapper as GridFunction.

◆ signum()

auto signum ( T &&  value)
related

Applies Operation::Signum to GridFunctions.

◆ sqr()

auto sqr ( T &&  value)
related

Applies Operation::Sqr to GridFunction.

◆ sum()

auto sum ( Vec &&  vec)
related

Applies a sum() functor to a vector-valued GridFunction.

◆ tanh()

auto tanh ( T &&  value)
related

Applies Operation::Tanh to GridFunctions.

◆ trans()

auto trans ( Mat &&  mat)
related

Applies Operation::Trans to a matrix-valued GridFunction.

◆ two_norm()

auto two_norm ( Vec &&  vec)
related

Applies Operation::TwoNorm to a vector-valued GridFunction.

◆ unary_dot()

auto unary_dot ( Vec &&  vec)
related

Applies Operation::UnaryDot to a vector-valued GridFunction.