DUNE-ACFEM (unstable)

timeview.hh
1#ifndef TIMEVIEW_HH
2#define TIMEVIEW_HH
3
4#include <dune/fem/solver/timeprovider.hh>
5
6namespace Dune {
7
8 namespace ACFem {
9
21 template<class TimeProvider>
23 {
24 public:
25 typedef TimeProvider TimeProviderType;
26
28 TimeView(const TimeProviderType& origin, double theta = 0.0)
29 : origin_(origin), theta_(theta)
30 {}
31
33 TimeView(const TimeView& other)
34 : origin_(other.origin_), theta_(other.theta_)
35 {}
36
38 double theta() const { return theta_; }
39
41 double time() const { return origin_.time() + theta() * deltaT(); }
42
44 double deltaT() const { return origin_.deltaT(); }
45
47 double startTime() const { return origin_.time(); }
48
50 double endTime() const { return startTime() + deltaT(); }
51
53 void setTheta(const double theta) {
54 assert(theta >= 0.0 && theta <= 1.0);
55 theta_ = theta;
56 }
57
59 const TimeProviderType& timeProvider() const
60 {
61 return origin_;
62 }
63
65 const TimeProviderType& timeProvider()
66 {
67 return origin_;
68 }
69
70 private:
71 const TimeProviderType& origin_;
72 double theta_;
73 };
74
76
77 } // namespace ACFem
78
79} // namespace Dune
80
81#endif
Generate a view on the current time-step.
Definition: timeview.hh:23
double time() const
Return the absolute point in time.
Definition: timeview.hh:41
double startTime() const
Return the absolute start point of the current time interval.
Definition: timeview.hh:47
double theta() const
Return the relative point in time, withe respect to the current time step size.
Definition: timeview.hh:38
void setTheta(const double theta)
Redefine the current view to look at another point in the current time interval.
Definition: timeview.hh:53
double deltaT() const
Return the current time step size.
Definition: timeview.hh:44
const TimeProviderType & timeProvider()
Return the time-provider we are linked to.
Definition: timeview.hh:65
TimeView(const TimeView &other)
Copy constructor.
Definition: timeview.hh:33
TimeView(const TimeProviderType &origin, double theta=0.0)
Constructor, default is a view at the start of the time interval.
Definition: timeview.hh:28
double endTime() const
Return the absolute end point of the current time interval.
Definition: timeview.hh:50
const TimeProviderType & timeProvider() const
Return the time-provider we are linked to.
Definition: timeview.hh:59
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 27, 23:30, 2024)