Class template Dune::XT::Functions::GridFunction

Inherits from Dune::XT::Functions::internal::GridFunctionBase.

template<class E, size_t r = 1, size_t rC = 1, class R = double>
class Dune::XT::Functions::GridFunction : public internal::GridFunctionBase<GridFunction<E, r, rC, R>, E, r, rC, R>

Wraps a value, a function or a grid function (generic variant, except for scalars and square matrices).

void foo(const GridFunctionInterface& grid_func);

struc Bar { Bar(const GridFunctionInterface& grid_func) : grid_func_(grid_func) {} const GridFunctionInterface& grid_func_; };

void foo(const FunctionInterface& func { foo(FunctionAsGridFunctionWrapper(func)); } void foo(const double& value) { foo(ConstantFunction(value)); }

struct Bar { Bar(const double& grid_func) : grid_func_(new FunctionAsGridFunctionWrapper(new ConstantFunction(value))) {} Bar(const FunctionInterface& func) : grid_func_(new FunctionAsGridFunctionWrapper(func)) {} Bar(const GridFunctionInterface& grid_func) : grid_func_(grid_func) {} Dune::XT::Common::StorageProvider<GridFunctionInterface> grid_func_; };

void foo(GridFunction grid_func);

struc Bar { Bar(GridFunction grid_func) : grid_func_(grid_func) {} GridFunctionInterface grid_func_; };

foo(1); foo(some_function); foo(some_grid_function)

Bar bar(1); Bar bar(some_function); Bar bar(some_grid_function);

Suppose we have a function (this is all pseudo-code below, assuming d is the dimension of the grid element E)

or a class

that require a grid function to work, but we want the user to be able to also pass a function or a value, for convenience. In case of the function foo, we would thus need to have two additional ones

and in case of the class Bar we need additional ctors and a different member, as in

Similar to the last example, this class simplifies such use cases by providing a grid function, given a grid function, a function or a value. If the range of the grid function is a square matrix, it also accepts a number, a scalar function or scalar grid function. To benefit from this class, one needs to use it as an argument passed by value (its copy and movable), so the above examples simplify to

and

This allows the user to call

as well as

the magic happens due to the various non explicit ctors.

template<>
Dune::XT::Functions::GridFunction::GridFunction<E, r, rC, R>(const typename RangeTypeSelector<R, r, rC>::type &value, std::string nm = <recovery-expr>("GridFunction"), const std::string &logging_prefix = <recovery-expr>(""))

No documentation provided.

template<>
Dune::XT::Functions::GridFunction::GridFunction<E, r, rC, R>(const FunctionInterface<d, r, rC, R> &func, const std::string &logging_prefix = <recovery-expr>(""))

No documentation provided.

template<>
Dune::XT::Functions::GridFunction::GridFunction<E, r, rC, R>(FunctionInterface<d, r, rC, R> *&&func_ptr, const std::string &logging_prefix = <recovery-expr>(""))

No documentation provided.

template<>
Dune::XT::Functions::GridFunction::GridFunction<E, r, rC, R>(const GridFunctionInterface<E, r, rC, R> &func, const std::string &logging_prefix = <recovery-expr>(""))

No documentation provided.

template<>
Dune::XT::Functions::GridFunction::GridFunction<E, r, rC, R>(GridFunctionInterface<E, r, rC, R> *&&func_ptr, const std::string &logging_prefix = <recovery-expr>(""))

No documentation provided.

template<>
Dune::XT::Functions::GridFunction::GridFunction<E, r, rC, R>(const ThisType &other) = default

No documentation provided.

template<>
Dune::XT::Functions::GridFunction::GridFunction<E, r, rC, R>(ThisType &&source) noexcept = default

No documentation provided.

type Dune::XT::Functions::GridFunction::ThisType

No documentation provided.

type Dune::XT::Functions::GridFunction::BaseType

No documentation provided.