00001
00002
00003
00004
00005
00006
00012 #ifndef c_H
00013 #define RUNGEKUTTAADAPTIVE_H
00014
00015 #include <iterator>
00016 #include <list>
00017
00018 #include "Integrator.h"
00019 #include "Object.h"
00020
00021
00022 #define SAFETY 0.9
00023 #define PGROW -0.2
00024 #define PSHRNK -0.25
00025 #define ERRCON 1.89e-4
00026 #define NR_END 1
00027 #define FREE_ARG char*
00028
00034 class RungeKuttaAdaptive : public Integrator {
00035 private:
00036
00040 double* m;
00041
00045 double* radius;
00046
00050 double t;
00051
00055 int n;
00056
00060 double eps;
00061
00065 double nextsteplength;
00066
00070 double actualsteplength;
00071
00075 int objnumber;
00076
00081 list<Collisionspair> collisions;
00082
00083 double distance(const int i, const int j, const double x[]);
00084 double acceleration(const int i, const int komponente,
00085 const double x[] );
00086 void derivs(double x, double y[], double dydx[]);
00087 void rkck(double y[], double dydx[], int n, double x, double h,
00088 double yout[], double yerr[]);
00089 bool rkqs(double y[], double dydx[], int n, double *x,
00090 double htry, double eps,double yscal[], double *hdid,
00091 double *hnext);
00092 double *vec(long nl, long nh);
00093 void free_vec(double *v, long nl, long nh);
00094
00095 protected:
00096
00097 virtual void saveAttributes();
00098 virtual void loadAttributes();
00099 virtual void deleteAdditionalInformation(void * additionalInformation);
00100
00101 public:
00102
00103 virtual double integrate(double time);
00104
00108 virtual string getName() {
00109 return "RungeKuttaAdaptive";
00110 }
00111
00115 virtual double getTime() {
00116 return t;
00117 }
00118
00119 virtual void save(ostream & FILE);
00120 virtual void load(istream & FILE);
00121 virtual void createAttributeWindow();
00122
00123 virtual list<Collisionspair>* getCollisionslist();
00124
00125 RungeKuttaAdaptive();
00126 virtual ~RungeKuttaAdaptive() {}
00127 ;
00128 };
00129
00130
00131 #endif