geometry.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef GEOMETRY_HPP
  2. #define GEOMETRY_HPP
  3. #include <iostream>
  4. #include <fstream>
  5. #include <limits>
  6. #include <list>
  7. #include <vector>
  8. #include <algorithm>
  9. #include "math/spline.hpp"
  10. #include "basin.hpp"
  11. using namespace std;
  12. using Func = double (*)(double);
  13. extern double inf;
  14. //! The Geometry class contains all geometric parameters of the domain.
  15. class Geometry{
  16. public:
  17. static constexpr double max_slope_both_side_runoff=0.00;
  18. //! Horizontal length of the domain
  19. double lX;
  20. //! Number of horizontal steps
  21. size_t nX;
  22. //! Horizontal step
  23. double dX;
  24. //! Level of the soil depending on X, e.g, hsoil[k]=level of the soil at X=k*dX.
  25. //! Vector of size nX.
  26. double* hsoil;
  27. //! Derivative of the soil depending on X, vector of size nX.
  28. double* dhsoil;
  29. //! Level of the bottom depending on X, e.g, hbot[k]=level of the bottom at X=k*dX.
  30. //! Vector of size nX.
  31. double* hbot;
  32. //! Derivative of the bottom depending on X, vector of size nX.
  33. double* dhbot;
  34. //! Number of vertical step at a given X, vector of size nX.
  35. size_t* nZ;
  36. //! Vertical step at a given X, vector of size nX.
  37. double* dZ;
  38. //! Vertical considered positions at a given X, vector of vectors of size nX. For each k, Z[k] is a vector of size nZ[k]
  39. double** Z;
  40. Direction* runoff_directions;
  41. Basin* root_basin;
  42. //!
  43. Geometry();
  44. ~Geometry();
  45. void initZ(double dZ_avg,bool init=true);
  46. void save(fstream& file);
  47. void load(fstream& file,bool init);
  48. pair<list<Basin*>::iterator,list<Basin*>::iterator> find_basins(const Summit& s,list<Basin*>& basins);
  49. void compute_basins();
  50. };
  51. #endif