dune-functions  2.6-dev
localfunction_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_COMMON_LOCALFUNCTION_FUNCTION_IMP_HH
4 #define DUNE_FUNCTIONS_COMMON_LOCALFUNCTION_FUNCTION_IMP_HH
5 
8 
9 
10 
11 namespace Dune {
12 namespace Functions {
13 namespace Imp {
14 
15 // Interface of type erasure wrapper
16 //
17 // Notice that the basic interface of polymorphic classes (destructor, clone, ...)
18 // will be added by the type erasure foundation classes.
19 template<class Signature, class DerivativeInterface, class LocalContext>
20 class LocalFunctionWrapperInterface :
21  public DifferentiableFunctionWrapperInterface<Signature, DerivativeInterface>
22 {
23 public:
24  virtual void bind(const LocalContext&) = 0;
25 
26  virtual void unbind() = 0;
27 
28  virtual const LocalContext& localContext() const = 0;
29 };
30 
31 
32 // Implementation of type erasure wrapper
33 template<class Signature, class DerivativeInterface, class LocalContext, class B>
34 class LocalFunctionWrapperImplementation :
35  public DifferentiableFunctionWrapperImplementation<Signature, DerivativeInterface, B>
36 {
37  using Base = DifferentiableFunctionWrapperImplementation<Signature, DerivativeInterface, B>;
38 public:
39  using Base::Base;
40 
41  virtual void bind(const LocalContext& context)
42  {
43  this->get().bind(context);
44  }
45 
46  virtual void unbind()
47  {
48  this->get().unbind();
49  }
50 
51  virtual const LocalContext& localContext() const
52  {
53  return this->get().localContext();
54  }
55 };
56 
57 }}} // namespace Dune::Functions::Imp
58 
59 
60 
61 #endif // DUNE_FUNCTIONS_COMMON_DIFFERENTIABLE_FUNCTION_IMP_HH
Dune
Definition: polynomial.hh:7
differentiablefunction_imp.hh
type_traits.hh