dune-pdelab 2.7-git
Loading...
Searching...
No Matches
bindtime.hh
Go to the documentation of this file.
1//-*- tab-width: 4; c-basic-offset: 2; indent-tabs-mode: nil -*-
2#ifndef DUNE_PDELAB_FUNCTION_BINDTIME_HH
3#define DUNE_PDELAB_FUNCTION_BINDTIME_HH
4
5#include <dune/common/indices.hh>
6#include <dune/functions/common/signature.hh>
7
8namespace Dune {
9namespace PDELab {
10
11template<typename F, typename Placeholder>
13{
14public:
15 SetTimeWrapper(F&& f, Placeholder p)
16 : _f(f), _p(p)
17 {}
18 template<typename Domain>
19 auto operator()(const Domain & d) const
20 {
21 return swap_arguments(d,_t,_p);
22 }
23 void setTime(double t)
24 {
25 _t = t;
26 }
27private:
28 double _t;
29 F _f;
30 Placeholder _p;
31 template<typename Domain>
32 auto swap_arguments(const Domain& d, double t, const index_constant<1>&) const
33 {
34 return _f(t,d);
35 }
36 template<typename Domain>
37 auto swap_arguments(const Domain& d, double t, const index_constant<2>&) const
38 {
39 return _f(d,t);
40 }
41};
42
43template<typename F, typename Placeholder>
44SetTimeWrapper<F,Placeholder>
45bindTime(F&& f, Placeholder p)
46{
48}
49
50} // end namespace PDELab
51} // end namespace Dune
52
53#endif // DUNE_PDELAB_FUNCTION_BINDTIME_HH
const P & p
Definition constraints.hh:148
For backward compatibility – Do not use this!
Definition adaptivity.hh:28
SetTimeWrapper< F, Placeholder > bindTime(F &&f, Placeholder p)
Definition bindtime.hh:45
Definition bindtime.hh:13
auto operator()(const Domain &d) const
Definition bindtime.hh:19
SetTimeWrapper(F &&f, Placeholder p)
Definition bindtime.hh:15
void setTime(double t)
Definition bindtime.hh:23