dune-functions 2.9.0
gridfunction_imp.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_FUNCTIONS_GRIDFUNCTIONS_GRID_FUNCTION_IMP_HH
4#define DUNE_FUNCTIONS_GRIDFUNCTIONS_GRID_FUNCTION_IMP_HH
5
9
10
11
12namespace Dune {
13namespace Functions {
14namespace Imp {
15
19struct HasFreeLocalFunction
20{
21 template<class F>
22 auto require(F&& f) -> decltype(
23 localFunction(f)
24 );
25};
26
27
28
29// Interface of type erasure wrapper
30//
31// Notice that the basic interface of polymorphic classes (destructor, clone, ...)
32// will be added by the type erasure foundation classes.
33template<class Signature, class DerivativeInterface, class LocalFunctionInterface, class EntitySet>
34class GridFunctionWrapperInterface :
35 public DifferentiableFunctionWrapperInterface<Signature, DerivativeInterface>
36{
37public:
38 virtual LocalFunctionInterface wrappedLocalFunction() const = 0;
39
40 virtual const EntitySet& wrappedEntitySet() const = 0;
41};
42
43
44// Implementation of type erasure wrapper
45template<class Signature, class DerivativeInterface, class LocalFunctionInterface, class EntitySet, class B>
46class GridFunctionWrapperImplementation :
47 public DifferentiableFunctionWrapperImplementation<Signature, DerivativeInterface, B>
48{
49 using Base = DifferentiableFunctionWrapperImplementation<Signature, DerivativeInterface, B>;
50public:
51 using Base::Base;
52
53 virtual LocalFunctionInterface wrappedLocalFunction() const
54 {
55 return localFunction(this->get());
56 }
57
58 virtual const EntitySet& wrappedEntitySet() const
59 {
60 return this->get().entitySet();
61 }
62};
63
64
65
66}}} // namespace Dune::Functions::Imp
67
68
69
70#endif // DUNE_FUNCTIONS_GRIDFUNCTIONS_GRID_FUNCTION_IMP_HH
Definition: polynomial.hh:10