KaliVeda
Toolkit for HIC analysis
KVRungeKutta.h
1 
4 #ifndef __KVRUNGEKUTTA_H
5 #define __KVRUNGEKUTTA_H
6 
7 #include "KVBase.h"
8 
9 #define SAFETY 0.9
10 #define PGROW -0.2
11 #define PSHRNK -0.25
12 #define ERRCON 1.89e-4
13 #define MAXSTP 10000
14 #define TINY 1.0e-30
15 
16 /*The value ERRCON equals (5/SAFETY) raised to the power (1/PGROW), see use below.*/
17 
50 class KVRungeKutta : public KVBase {
51  static Double_t a2, a3, a4, a5, a6, b21;
52  static Double_t b31, b32, b41, b42, b43;
53  static Double_t b51, b52, b53, b54;
54  static Double_t b61, b62, b63;
55  static Double_t b64, b65, c1 ;
56  static Double_t c3, c4, c6;
57  static Double_t dc5;
58 protected:
59  Int_t nvar;
60  Double_t eps;
61  Double_t hmin;
62  Int_t nok;
63  Int_t nbad;
64 
65  Double_t* y, *yscal, *dydx, *yerr, *ytemp, *yout;
66  Double_t x, hnext, hdid;
67  Double_t* ak2, *ak3, *ak4, *ak5, *ak6;
68  Double_t dc1, dc3, dc4, dc6;
69  Bool_t fOK;
70  Bool_t fInitialDeriv;
71  virtual void rkqs(Double_t htry);
72  virtual void rkck(Double_t h);
73 
74 public:
76  KVRungeKutta(Int_t N, Double_t PREC = 1.e-8, Double_t MINSTEP = 0.0);
77  virtual ~KVRungeKutta();
78 
79  virtual void Integrate(Double_t* ystart, Double_t x1, Double_t x2, Double_t h1);
80 
84  virtual void CalcDerivs(Double_t X, Double_t* Y, Double_t* DYDX) = 0;
85 
87  {
89  return nok;
90  }
92  {
94  return nbad;
95  }
96  Bool_t IsOK() const
97  {
99  return fOK;
100  }
101 
102  ClassDef(KVRungeKutta, 0) //Adaptive step-size 4th order Runge-Kutta ODE integrator from Numerical Recipes
103 };
104 
105 #endif
int Int_t
bool Bool_t
double Double_t
#define ClassDef(name, id)
Base class for KaliVeda framework.
Definition: KVBase.h:140
Adaptive step-size 4th order Runge-Kutta ODE integrator from Numerical Recipes.
Definition: KVRungeKutta.h:50
Int_t GetNGoodSteps() const
Definition: KVRungeKutta.h:86
Bool_t IsOK() const
Definition: KVRungeKutta.h:96
virtual void CalcDerivs(Double_t X, Double_t *Y, Double_t *DYDX)=0
virtual ~KVRungeKutta()
Destructor.
Int_t GetNBadSteps() const
Definition: KVRungeKutta.h:91
virtual void Integrate(Double_t *ystart, Double_t x1, Double_t x2, Double_t h1)
TH1 * h