GR Engine
A physics engine in curved space-time
 All Classes Files Functions Variables
numeric.h
Go to the documentation of this file.
1 #ifndef __NUMERIC_H__
2 #define __NUMERIC_H__
3 
10 #include <vector>
11 #include <exception>
12 
16 class StateLengthError : public std::exception
17 {
18 public:
20  virtual ~StateLengthError() throw();
21  const char* what() const throw();
22 };
23 
25 typedef std::vector<double> StateVector;
26 
27 StateVector operator+(const StateVector&, const StateVector&);
28 StateVector operator-(const StateVector&, const StateVector&);
29 StateVector operator*(const StateVector&, double);
30 StateVector operator*(double, const StateVector&);
31 StateVector operator/(const StateVector&, double);
32 double abs(StateVector);
33 
40 class DiffEq
41 {
42 public:
44  DiffEq();
46  virtual ~DiffEq();
47 
49 
52  virtual StateVector derivative(StateVector v) = 0;
53 };
54 
62 {
63 protected:
64  double stepSize;
65  double initStepSize;
66 public:
68 
70  Integrator(double stepSize = 0.01);
72  virtual ~Integrator();
73 
75 
80  virtual StateVector next(StateVector state, DiffEq* equation, double step = 0.0) = 0;
81 
83  void setStepSize(double);
85  void resetStepSize();
86 
88  double getStepSize();
89 };
90 
91 #endif
92