dune-functions  2.5-dev
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 
12 namespace Dune {
13 namespace Functions {
14 namespace Imp {
15 
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.
33 template<class Signature, class DerivativeInterface, class LocalFunctionInterface, class EntitySet>
35  public DifferentiableFunctionWrapperInterface<Signature, DerivativeInterface>
36 {
37 public:
38  virtual LocalFunctionInterface wrappedLocalFunction() const = 0;
39 
40  virtual const EntitySet& wrappedEntitySet() const = 0;
41 };
42 
43 
44 // Implementation of type erasure wrapper
45 template<class Signature, class DerivativeInterface, class LocalFunctionInterface, class EntitySet, class B>
47  public DifferentiableFunctionWrapperImplementation<Signature, DerivativeInterface, B>
48 {
50 public:
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: gridfunction_imp.hh:19
virtual LocalFunctionInterface wrappedLocalFunction() const
Definition: gridfunction_imp.hh:53
Definition: polynomial.hh:7
auto require(F &&f) -> decltype(localFunction(f))
Definition: differentiablefunction_imp.hh:69
virtual const EntitySet & wrappedEntitySet() const
Definition: gridfunction_imp.hh:58
Definition: differentiablefunction_imp.hh:50
Definition: gridfunction_imp.hh:34