Dune Core Modules (2.8.0)

localfunction_imp.hh
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
6#include <dune/functions/common/type_traits.hh>
7#include <dune/functions/common/differentiablefunction_imp.hh>
8
9
10
11namespace Dune {
12namespace Functions {
13namespace 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.
19template<class Signature, class DerivativeInterface, class LocalContext>
20class LocalFunctionWrapperInterface :
21 public DifferentiableFunctionWrapperInterface<Signature, DerivativeInterface>
22{
23public:
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
33template<class Signature, class DerivativeInterface, class LocalContext, class B>
34class LocalFunctionWrapperImplementation :
35 public DifferentiableFunctionWrapperImplementation<Signature, DerivativeInterface, B>
36{
37 using Base = DifferentiableFunctionWrapperImplementation<Signature, DerivativeInterface, B>;
38public:
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 namespace.
Definition: alignedallocator.hh:11
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)