00001 // rdRKF.h 00002 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00003 // Copyright 2000, 2003 Realistic Dynamics, Inc. 00004 // All rights reserved. 00005 // 00006 // Please do not read, copy, distribute, or use without permission. 00007 // Contact: Frank C. Anderson, fca@RealisticDynamics.com 00008 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00009 #ifndef __rdRKF_h__ 00010 #define __rdRKF_h__ 00011 00012 // INCLUDES 00013 #include "rdIntegrator.h" 00014 #include <rdModel.h> 00015 #include <rdControlSet.h> 00016 00017 00018 // EXPORTED CONSTANTS 00019 extern RDSIMULATION_API const int rdRKF_NORMAL; 00020 extern RDSIMULATION_API const int rdRKF_FINE; 00021 extern RDSIMULATION_API const int rdRKF_POOR; 00022 extern RDSIMULATION_API const int rdRKF_NAN; 00023 extern RDSIMULATION_API const int rdRKF_ERROR; 00024 extern RDSIMULATION_API const int rdRKF_TOO_MANY_STEPS; 00025 00026 00027 //============================================================================= 00028 //============================================================================= 00039 class RDSIMULATION_API rdRKF 00040 { 00041 //============================================================================= 00042 // DATA 00043 //============================================================================= 00044 protected: 00046 double _tol; 00048 double _tolFine; 00050 rdModel *_model; 00052 int _nx; 00054 double *_x; 00056 int _ny; 00058 double *_yv,*_ye,*_dy; 00059 double *_k1,*_k2,*_k3,*_k4,*_k5,*_k6; 00060 00061 //============================================================================= 00062 // METHODS 00063 //============================================================================= 00064 //-------------------------------------------------------------------------- 00065 // CONSTRUCTION 00066 //-------------------------------------------------------------------------- 00067 public: 00068 rdRKF(rdModel *aModel,double aTol=1.0e-4,double aTolFine=-1.0); 00069 virtual ~rdRKF(); 00070 00071 //-------------------------------------------------------------------------- 00072 // MEMORY 00073 //-------------------------------------------------------------------------- 00074 private: 00075 int allocateMemory(); 00076 int freeMemory(); 00077 00078 //-------------------------------------------------------------------------- 00079 // GET AND SET 00080 //-------------------------------------------------------------------------- 00081 public: 00082 // MODEL 00083 rdModel* getModel(); 00084 // NUMBER OF STATES 00085 int getNY(); 00086 // TOLERANCE 00087 void setTolerance(double aTol,double aTolFine=-1.0); 00088 double getTolerance(); 00089 void setFineTolerance(double aFineTol); 00090 double getFineTolerance(); 00091 00092 //-------------------------------------------------------------------------- 00093 // INTEGRATION 00094 //-------------------------------------------------------------------------- 00095 int step(double dt,double t,rdControlSet &x,double *y); 00096 int step(double dt,double t,double *x,double *y); 00097 int stepFixed(double dt,double t,rdControlSet &x,double *y); 00098 int stepFixed(double dt,double t,double *x,double *y); 00099 00100 //============================================================================= 00101 }; // END class rdRKF 00102 //============================================================================= 00103 //============================================================================= 00104 00105 #endif // __rdRKF_h__
1.3