data.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #ifndef QT_INPUT_DATA_HPP
  2. #define QT_INPUT_DATA_HPP
  3. #include "kernel/input_data.hpp"
  4. #include "math/spline.hpp"
  5. class QtInputData:public InputData{
  6. private:
  7. size_t findSoilOver(double y,int x,int x_step);
  8. public:
  9. static constexpr size_t const nmax_Qt=400;
  10. static constexpr size_t const np=10;
  11. static constexpr size_t const np_ov=5;
  12. double depth;
  13. size_t nZ_max;
  14. Point point[3*np+np_ov];
  15. Spline spline_soil;
  16. Spline spline_bot;
  17. Spline spline_sat;
  18. QtInputData();
  19. ~QtInputData();
  20. void initSplines();
  21. void initPhysics();
  22. void initGeometry();
  23. void initInitialState();
  24. void updateSplineBot();
  25. void updateSplineSat();
  26. void updateSplineSoil();
  27. void updateGeometry();
  28. void updateInitialState();
  29. void updateOverland();
  30. void updateOverlandAndPressure();
  31. double evalSplineBot(double x) const;
  32. double evalSplineSat(double x) const;
  33. double evalSplineSoil(double x) const;
  34. Tank* addTank();
  35. void removeTank(Tank* tank);
  36. Pump* addPump();
  37. void removePump(Pump* pump);
  38. Cloud* addCloud();
  39. void removeCloud(Cloud* cloud);
  40. void save(fstream& file);
  41. void load(fstream& file);
  42. };
  43. inline void
  44. QtInputData::updateSplineSoil(){
  45. spline_soil.compute();
  46. }
  47. inline void
  48. QtInputData::updateSplineBot(){
  49. spline_bot.compute();
  50. }
  51. inline void
  52. QtInputData::updateSplineSat(){
  53. spline_sat.compute();
  54. }
  55. inline double
  56. QtInputData::evalSplineBot(double x) const{
  57. return spline_bot(x);
  58. }
  59. inline double
  60. QtInputData::evalSplineSat(double x) const{
  61. return spline_sat(x);
  62. }
  63. inline double
  64. QtInputData::evalSplineSoil(double x) const{
  65. return spline_soil(x);
  66. }
  67. inline Tank*
  68. QtInputData::addTank(){
  69. return initial_state->addTank();
  70. }
  71. inline void
  72. QtInputData::removeTank(Tank* tank){
  73. initial_state->removeTank(tank);
  74. }
  75. inline Pump*
  76. QtInputData::addPump(){
  77. return source.addPump();
  78. }
  79. inline void
  80. QtInputData::removePump(Pump* pump){
  81. source.removePump(pump);
  82. }
  83. inline Cloud*
  84. QtInputData::addCloud(){
  85. return source.addCloud();
  86. }
  87. inline void
  88. QtInputData::removeCloud(Cloud* cloud){
  89. source.removeCloud(cloud);
  90. }
  91. #endif