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.
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto operator+ (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::Plus to GridFunctions.
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto operator- (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::Minus to GridFunctions.
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto operator* (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::Multiplies to GridFunctions.
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto operator/ (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::Divides to GridFunctions.
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto max (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::Max to GridFunctions.
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto min (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::Min to GridFunctions.
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto abs_max (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::AbsMax to GridFunctions.
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto abs_min (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::AbsMin to GridFunctions.
 
template<class V , class T , REQUIRES(Concepts::AnyGridFunction< V >) >
auto clamp (V &&v, T const &lo, T const &hi)
 Applies Operation::Clamp to GridFunction.
 
template<class T , REQUIRES(Concepts::AnyGridFunction< T >) >
auto tanh (T &&value)
 Applies Operation::Tanh to GridFunctions.
 
template<class T , REQUIRES(Concepts::AnyGridFunction< T >) >
auto signum (T &&value)
 Applies Operation::Signum to GridFunctions.
 
template<class T , REQUIRES(Concepts::AnyGridFunction< T >) >
auto sqr (T &&value)
 Applies Operation::Sqr to GridFunction.
 
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.
 
template<std::size_t I, class T , REQUIRES(Concepts::AnyGridFunction< T >) >
auto get (T &&value)
 Applies Operation::Get<I> to GridFunction.
 
template<class T , REQUIRES(Concepts::AnyGridFunction< T >) >
auto get (T &&value, std::size_t i)
 Applies Operation::Get_ to GridFunction.
 
template<class T >
auto constant (T const &value)
 Return a reference-wrapper as GridFunction.
 
template<class T >
auto reference (T &value)
 Return a reference-wrapper as GridFunction.
 
template<class Vec , REQUIRES(Concepts::AnyGridFunction< Vec >) >
auto sum (Vec &&vec)
 Applies a sum() functor to a vector-valued GridFunction.
 
template<class Vec , REQUIRES(Concepts::AnyGridFunction< Vec >) >
auto unary_dot (Vec &&vec)
 Applies Operation::UnaryDot to a vector-valued GridFunction.
 
template<class Vec , REQUIRES(Concepts::AnyGridFunction< Vec >) >
auto one_norm (Vec &&vec)
 Applies a one_norm() functor to a vector-valued GridFunction.
 
template<class Vec , REQUIRES(Concepts::AnyGridFunction< Vec >) >
auto two_norm (Vec &&vec)
 Applies Operation::TwoNorm to a vector-valued GridFunction.
 
template<int p, class Vec , REQUIRES(Concepts::AnyGridFunction< Vec >) >
auto p_norm (Vec &&vec)
 Applies a p_norm() functor to a vector-valued GridFunction.
 
template<class Vec , REQUIRES(Concepts::AnyGridFunction< Vec >) >
auto infty_norm (Vec &&vec)
 Applies a infty_norm() functor to a vector-valued GridFunction.
 
template<class Mat , REQUIRES(Concepts::AnyGridFunction< Mat >) >
auto trans (Mat &&mat)
 Applies Operation::Trans to a matrix-valued GridFunction.
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto dot (Lhs &&lhs, Rhs &&rhs)
 Applies Operation::Dot to two vector-valued GridFunctions.
 
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.
 
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.
 
template<class Lhs , class Rhs , REQUIRES(Concepts::AnyGridFunction< Lhs, Rhs >) >
auto cross (Lhs &&lhs, Rhs &&rhs)
 Applies a cross() functor to two vector-valued GridFunctions.
 

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);
    auto makeOperator(Tag const &tag, Expr &&expr, int gridFctDeg=-1)
    Definition: GridFunctionOperator.hpp:235
  2. Usage of GridFunctions in BoundaryConditions:
    prob.addDirichletBC(Predicate, Row, Col, Expression);
    constexpr bool Predicate
    A predicate is a function that returns a boolean.
    Definition: Concepts.hpp:141
  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

◆ gradientOf()

auto 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().

◆ 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) 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();
}
Definition: ProblemStat.hpp:55
decltype(auto) makeGridFunction(PreGridFct const &preGridFct, GridView const &gridView)
Generator for Gridfunctions from Expressions (PreGridfunctions)
Definition: GridFunction.hpp:168

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(), and DiscreteFunction< Coeff, GB, TreePath, R >::interpolate_noalias().

◆ pow()

auto pow ( T &&  value)
related

Applies Operation::Pow.

to GridFunction.