DUNE-FUNCTIONS (unstable)

gridviewfunction.hh
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_GRIDVIEWFUNCTION_HH
8#define DUNE_FUNCTIONS_GRIDFUNCTIONS_GRIDVIEWFUNCTION_HH
9
10#include <memory>
11
12#include <dune/common/concept.hh>
13
14#include <dune/functions/gridfunctions/gridfunction.hh>
15#include <dune/functions/gridfunctions/gridviewentityset.hh>
16#include <dune/functions/gridfunctions/analyticgridviewfunction.hh>
17
18
19namespace Dune {
20namespace Functions {
21
22
23
24template<class Signature, class GridView, template<class> class DerivativeTraits=DefaultDerivativeTraits, size_t bufferSize=56>
25class GridViewFunction
26{};
27
28
29
44template<class Range, class Domain, class GV, template<class> class DerivativeTraits, size_t bufferSize>
45class GridViewFunction<Range(Domain), GV, DerivativeTraits, bufferSize> :
46 public GridFunction<Range(Domain), GridViewEntitySet<GV, 0>, DerivativeTraits, bufferSize>
47{
48 using Base = GridFunction<Range(Domain), GridViewEntitySet<GV, 0>, DerivativeTraits, bufferSize>;
49public:
50 using GridView = GV;
51
52 using Base::Base;
53};
54
55
56
68template<class F, class GridView,
69 std::enable_if_t<
70 models< Imp::HasFreeLocalFunction, F>() , int> = 0>
71std::decay_t<F>
72 makeGridViewFunction(F&& f, const GridView& gridView)
73{
74 return std::forward<F>(f);
75}
76
77
78
94template<class F, class GridView,
95 std::enable_if_t<
96 not(models< Imp::HasFreeLocalFunction, F>()) , int> = 0>
97auto makeGridViewFunction(F&& f, const GridView& gridView)
98 -> decltype(makeAnalyticGridViewFunction(std::forward<F>(f), gridView))
99{
100 return makeAnalyticGridViewFunction(std::forward<F>(f), gridView);
101}
102
103
104
105} // end of namespace Dune::Functions
106} // end of namespace Dune
107
108#endif // DUNE_FUNCTIONS_GRIDFUNCTIONS_GRIDVIEWFUNCTION_HH
An entity set for all entities of given codim in a grid view.
Definition: gridviewentityset.hh:27
auto makeAnalyticGridViewFunction(F &&f, const GridView &gridView)
Create an AnalyticGridViewFunction from a function and a grid view.
Definition: analyticgridviewfunction.hh:238
Definition: polynomial.hh:17
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Aug 13, 22:30, 2024)