dune-functions 2.10
Loading...
Searching...
No Matches
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
4// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
5// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
6
7#ifndef DUNE_FUNCTIONS_GRIDFUNCTIONS_GRID_FUNCTION_IMP_HH
8#define DUNE_FUNCTIONS_GRIDFUNCTIONS_GRID_FUNCTION_IMP_HH
9
13
14
15
16namespace Dune {
17namespace Functions {
18namespace Imp {
19
23struct HasFreeLocalFunction
24{
25 template<class F>
26 auto require(F&& f) -> decltype(
27 localFunction(f)
28 );
29};
30
31
32
33// Interface of type erasure wrapper
34//
35// Notice that the basic interface of polymorphic classes (destructor, clone, ...)
36// will be added by the type erasure foundation classes.
37template<class Signature, class DerivativeInterface, class LocalFunctionInterface, class EntitySet>
38class GridFunctionWrapperInterface :
39 public DifferentiableFunctionWrapperInterface<Signature, DerivativeInterface>
40{
41public:
42 virtual LocalFunctionInterface wrappedLocalFunction() const = 0;
43
44 virtual const EntitySet& wrappedEntitySet() const = 0;
45};
46
47
48// Implementation of type erasure wrapper
49template<class Signature, class DerivativeInterface, class LocalFunctionInterface, class EntitySet, class B>
50class GridFunctionWrapperImplementation :
51 public DifferentiableFunctionWrapperImplementation<Signature, DerivativeInterface, B>
52{
53 using Base = DifferentiableFunctionWrapperImplementation<Signature, DerivativeInterface, B>;
54public:
55 using Base::Base;
56
57 virtual LocalFunctionInterface wrappedLocalFunction() const
58 {
59 return localFunction(this->get());
60 }
61
62 virtual const EntitySet& wrappedEntitySet() const
63 {
64 return this->get().entitySet();
65 }
66};
67
68
69
70}}} // namespace Dune::Functions::Imp
71
72
73
74#endif // DUNE_FUNCTIONS_GRIDFUNCTIONS_GRID_FUNCTION_IMP_HH
Definition polynomial.hh:17