Based on the original Rocket Workbench on SourceForge in CVS at: https://sourceforge.net/projects/rocketworkbench
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
1.7 KiB

  1. #if !defined (lsode_h)
  2. #define lsode_h 1
  3. #include "c++rocket.h"
  4. extern int model_1(const int& neq, const double& time,
  5. double* z, double* dy,
  6. int& ierr);
  7. extern int model_2(const int& neq, const double& time,
  8. double* z, double* dy,
  9. int& ierr);
  10. extern "C" int lsode_ (int (*)(const int&, const double&,
  11. double*, double*, int&),
  12. int&, double*, double&, double&, int&,
  13. double&, double&, int&, int&, int&,
  14. double*, int&, int*, int&,
  15. int (*)(const int&, const double&,
  16. double*, const int&, const int&,
  17. double*, const int&),
  18. int&);
  19. typedef int (*ModelFunc_t) (const int&, const double&,
  20. double*, double*, int&);
  21. class lsode
  22. {
  23. int memory; // est vrai si la memoire a ete alloue
  24. // ce sont des variables utilises par lsode_
  25. int neq;
  26. int length;
  27. double **dy;
  28. double time;
  29. double tout;
  30. int itol;
  31. double rtol;
  32. double atol;
  33. int itask;
  34. int istate;
  35. int iopt;
  36. double *rwork;
  37. int lrw;
  38. int *iwork;
  39. int liw;
  40. int mf;
  41. double *state;
  42. void *md;
  43. //int (*func)(const int&, const double&, double*, double*, int&)
  44. void reset();
  45. public:
  46. lsode(Model_t model);
  47. ~lsode();
  48. void print();
  49. void set_atol(double tol) { atol = tol; }
  50. void set_rtol(double tol) { rtol = tol; }
  51. int solve(double *st, double duration, double step);
  52. int get_length(void) { return length; };
  53. void get_data(double**);
  54. int get_neq(void) { return neq; };
  55. };
  56. typedef enum
  57. {
  58. SUCCES = 2,
  59. TOO_MUCH_WORK = -1,
  60. TOO_MUCH_ACC = -2,
  61. ILLEGAL_INPUT = -3,
  62. ERR_FAILURE = -4,
  63. CONV_FAILURE = -5,
  64. ERROR_WEIGHT = -6,
  65. EXIT_IN_FUNCTION = -13
  66. } State;
  67. #endif