Program listing for file kernel/src/simulationTools/TimeDiscretisation.hpp#
Return to documentation for this file
1#ifndef TIMEDISCRETISATION_H
2#define TIMEDISCRETISATION_H
3
4#include <vector>
5#include <gmp.h>
6#include "SiconosFwd.hpp"
7#include "SiconosSerialization.hpp"
8
9typedef std::vector<double> TkVector;
10
11
12class TimeDiscretisation
13{
14private:
15 ACCEPT_SERIALIZATION(TimeDiscretisation);
16
17
18 double _h;
19
20
21 TkVector _tkV;
22
23
24 double _t0;
25
26
27 mpf_t _hgmp;
28
29
30 mpf_t _tkp1;
31
32
33 mpf_t _tk;
34
35
36 mpf_t _t0gmp;
37
38
39 TimeDiscretisation();
40
41
42 TimeDiscretisation& operator =(const TimeDiscretisation& td);
43
44
45 inline double getT0() const
46 {
47 return _t0;
48 }
49
50public:
51
52
53
54
55 TimeDiscretisation(const TkVector& newTk);
56
57
58 TimeDiscretisation(double t0, double h);
59
60
61 TimeDiscretisation(unsigned int nSteps, double t0, double T);
62
63
64 TimeDiscretisation(double t0, const std::string& str);
65
66
67 TimeDiscretisation(const TimeDiscretisation& td);
68
69
70 ~TimeDiscretisation();
71
72
73
74
75 double currentTimeStep(const unsigned int k);
76
77
78 inline const mpf_t* currentTimeStep() const
79 {
80 return &_hgmp;
81 };
82
83
84 inline bool hConst() const
85 {
86 return _tkV.empty() ? true : false;
87 };
88
89
90 inline bool hGmp() const
91 {
92 return ((_h == 0.0) && (_tkV.empty())) ? true : false;
93 }
94
95
96 double getTk(const unsigned int indx);
97
98
99 inline const TkVector& getTkVector() const { return _tkV; };
100
101
102 void setTkVector(const TkVector& newTk);
103
104
105 void setT0(double val);
106
107
108
109 void display() const;
110
111};
112
113#endif