watershed.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #ifndef __WATERSHED_H__
  2. #define __WATERSHED_H__
  3. #include <stdio.h>
  4. #include <grass/gis.h>
  5. #define RAM_NAME "ram"
  6. #define SEG_NAME "seg"
  7. #define NON_NAME "watershed"
  8. #define ACRE_TO_METERSQ 4047.0
  9. #define MILESQ_TO_ACRE 640.0
  10. #define HECTACRE_TO_METERSQ 10000.0
  11. #define KILOSQ_TO_ACRE 247.1
  12. #define KILOSQ_TO_METERSQ 1000000.0
  13. #define MILESQ_TO_METERSQ 2590080.0
  14. #define METERSQ_TO_ACRE 0.00024709661
  15. #define METERSQ_TO_MILESQ 0.00000038608
  16. #define METERSQ_TO_HECTACRE 0.0001
  17. #define METERSQ_TO_KILOSQ 0.000001
  18. #define METER_TO_FOOT 3.281
  19. #define INCR 32
  20. #define INPUT struct inputtttttt
  21. #define OUTPUT struct outputttttt
  22. #define BASIN struct mapvallllllll
  23. #define MAP struct mapssssss
  24. #define B_FACTS struct bfactsssssss
  25. #define CAT struct cattttttttttt
  26. INPUT {
  27. char *ar_file_name, *com_line_ram, *com_line_seg, *haf_name, *accum_name;
  28. char fast, slow;
  29. };
  30. CAT {
  31. int num_cat; /* num of cells */
  32. CELL cat_val;
  33. CAT *nxt;
  34. };
  35. BASIN {
  36. CAT first_cat; /* linked list of cats with num */
  37. double sum_values; /* summation */
  38. };
  39. MAP {
  40. char *name, *mapset;
  41. BASIN *basins; /* array of basins */
  42. struct Categories cats;
  43. char do_cats;
  44. };
  45. OUTPUT {
  46. MAP *maps; /* map layers of output stuff */
  47. B_FACTS *basin_facts; /* basin information array */
  48. FILE *out_file;
  49. struct Cell_head window;
  50. int num_maps, num_basins;
  51. /* output file, display map name, flag for basin by percent, flag for accum of percent */
  52. char *file_name, do_basin, do_accum, type_area;
  53. };
  54. B_FACTS {
  55. double str_length, str_slope, accum_length, accum_slope, easting,
  56. northing;
  57. int num_cells, down_basin, valid;
  58. };
  59. /* accum_down.c */
  60. int accum_down(OUTPUT *);
  61. /* basin_maps.c */
  62. int basin_maps(INPUT *, OUTPUT *);
  63. /* com_line.c */
  64. int com_line_Gwater(INPUT *, OUTPUT *);
  65. int com_line_add(char **, char *, char *, char *);
  66. int basin_com_add(char **, double, double, struct Cell_head *);
  67. int com_add(char **, char *, int);
  68. /* file_in.c */
  69. int ar_file_in(char *, OUTPUT *);
  70. /* free.c */
  71. int free_input(INPUT *);
  72. int free_output(OUTPUT *);
  73. /* insert_cat.c */
  74. int insert_cat(CAT *, CELL, int);
  75. CAT *new_cat(CELL, int);
  76. /* intro.c */
  77. int intro(void);
  78. /* print.c */
  79. int print_output(OUTPUT *);
  80. /* read.c */
  81. int read_basins(char *, OUTPUT *);
  82. /* valid.c */
  83. int valid_basins(char *, OUTPUT *);
  84. #endif /* __WATERSHED_H__ */