dune-functions  2.6-dev
gridviewfunction.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_GRIDVIEWFUNCTION_HH
4 #define DUNE_FUNCTIONS_GRIDFUNCTIONS_GRIDVIEWFUNCTION_HH
5 
6 #include <memory>
7 
8 #include <dune/common/concept.hh>
9 
13 
14 
15 namespace Dune {
16 namespace Functions {
17 
18 
19 
20 template<class Signature, class GridView, template<class> class DerivativeTraits=DefaultDerivativeTraits, size_t bufferSize=56>
22 {};
23 
24 
25 
40 template<class Range, class Domain, class GV, template<class> class DerivativeTraits, size_t bufferSize>
41 class GridViewFunction<Range(Domain), GV, DerivativeTraits, bufferSize> :
42  public GridFunction<Range(Domain), GridViewEntitySet<GV, 0>, DerivativeTraits, bufferSize>
43 {
44  using Base = GridFunction<Range(Domain), GridViewEntitySet<GV, 0>, DerivativeTraits, bufferSize>;
45 public:
46  using GridView = GV;
47 
48  using Base::Base;
49 };
50 
51 
52 
64 template<class F, class GridView,
65  typename std::enable_if<
66  models< Imp::HasFreeLocalFunction, F>() , int>::type = 0>
67 typename std::decay<F>::type
68  makeGridViewFunction(F&& f, const GridView& gridView)
69 {
70  return std::forward<F>(f);
71 }
72 
73 
74 
92 template<class F, class GridView,
93  typename std::enable_if<
94  not(models< Imp::HasFreeLocalFunction, F>()) , int>::type = 0>
95 auto makeGridViewFunction(F&& f, const GridView& gridView)
96  -> decltype(makeAnalyticGridViewFunction(std::forward<F>(f), gridView))
97 {
98  return makeAnalyticGridViewFunction(std::forward<F>(f), gridView);
99 }
100 
101 
102 
103 } // end of namespace Dune::Functions
104 } // end of namespace Dune
105 
106 #endif // DUNE_FUNCTIONS_GRIDFUNCTIONS_GRIDVIEWFUNCTION_HH
Dune::Functions::GridFunction
Definition: gridfunction.hh:31
Dune
Definition: polynomial.hh:7
gridfunction.hh
gridviewentityset.hh
Dune::Functions::GridViewEntitySet
An entity set for all entities of given codim in a grid view.
Definition: gridviewentityset.hh:22
Dune::Functions::GridViewFunction< Range(Domain), GV, DerivativeTraits, bufferSize >::GridView
GV GridView
Definition: gridviewfunction.hh:46
analyticgridviewfunction.hh
Dune::Functions::GridViewFunction
Definition: gridviewfunction.hh:21
Dune::Functions::makeGridViewFunction
std::decay< F >::type makeGridViewFunction(F &&f, const GridView &gridView)
Construct a function modeling GridViewFunction from function and grid view.
Definition: gridviewfunction.hh:68
Dune::Functions::makeAnalyticGridViewFunction
AnalyticGridViewFunction< typename std::result_of< F(typename GridView::template Codim< 0 >::Geometry::GlobalCoordinate)>::type(typename GridView::template Codim< 0 >::Geometry::GlobalCoordinate), GridView, typename std::decay< F >::type > makeAnalyticGridViewFunction(F &&f, const GridView &gridView)
Construct AnalyticGridViewFunction from function and grid view.
Definition: analyticgridviewfunction.hh:184