filldepr.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /****************************************************************************
  2. *
  3. * MODULE: r.terraflow
  4. *
  5. * COPYRIGHT (C) 2007 Laura Toma
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. *****************************************************************************/
  18. #ifndef __FILL_DEPR_H
  19. #define __FILL_DEPR_H
  20. #include <grass/iostream/ami.h>
  21. #include "types.h"
  22. #include "water.h"
  23. /************************************************************/
  24. /* INPUT: edgelist of watershed adjacency graph E={(u,v,h)}, 1 \le u,v
  25. \le W; the maximum number of watersheds
  26. h is the smallest height on the boundary between watershed u and
  27. watershed v;
  28. E contains the edges between the watersheds on the boundary and the
  29. outside face;
  30. the outside face is assumed to be watershed number W+1
  31. E is sorted increasingly by (h,u,v)
  32. OUTPUT: an array raise[1..W], raise[i] is the height to which the
  33. watershed i must be raised in order to have a valid flow path to the
  34. outside watershed;
  35. */
  36. /************************************************************/
  37. elevation_type* fill_depression(AMI_STREAM<boundaryType>*boundaryStr,
  38. cclabel_type maxWatersheds);
  39. elevation_type* inmemory_fill_depression(AMI_STREAM<boundaryType>*boundaryStr,
  40. cclabel_type maxWatersheds);
  41. elevation_type* ext_fill_depression(AMI_STREAM<boundaryType>*boundaryStr,
  42. cclabel_type maxWatersheds);
  43. /************************************************************/
  44. /* returns the amount of mmemory allocated by
  45. inmemory_fill_depression() */
  46. /************************************************************/
  47. size_t inmemory_fill_depression_mmusage(cclabel_type maxWatersheds);
  48. /************************************************************/
  49. /* produce a new stream where each elevation e inside watershed i is
  50. replaced with max(raise[i], e) */
  51. /************************************************************/
  52. void commit_fill(AMI_STREAM<labelElevType>* labeledGrid,
  53. elevation_type* raise, cclabel_type maxWatersheds,
  54. AMI_STREAM<elevation_type>* filledGrid);
  55. #endif