[GRASS-SVN] r65984 - grass/trunk/raster/r.water.outlet

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 21 00:38:35 PDT 2015


Author: hcho
Date: 2015-08-21 00:38:35 -0700 (Fri, 21 Aug 2015)
New Revision: 65984

Removed:
   grass/trunk/raster/r.water.outlet/flag.h
   grass/trunk/raster/r.water.outlet/flag_clr_all.c
   grass/trunk/raster/r.water.outlet/flag_create.c
   grass/trunk/raster/r.water.outlet/flag_destroy.c
   grass/trunk/raster/r.water.outlet/flag_get.c
   grass/trunk/raster/r.water.outlet/flag_set.c
   grass/trunk/raster/r.water.outlet/flag_unset.c
Modified:
   grass/trunk/raster/r.water.outlet/basin.h
   grass/trunk/raster/r.water.outlet/main.c
Log:
r.water.outlet: Remove unused files and variables

Modified: grass/trunk/raster/r.water.outlet/basin.h
===================================================================
--- grass/trunk/raster/r.water.outlet/basin.h	2015-08-21 07:15:42 UTC (rev 65983)
+++ grass/trunk/raster/r.water.outlet/basin.h	2015-08-21 07:38:35 UTC (rev 65984)
@@ -1,52 +1,10 @@
-#include <math.h>
 #include <grass/raster.h>
 #include "ramseg.h"
-#include "flag.h"
 
-#define NODE		struct _n_o_d_e_
-#define AR_SIZE			16
-#define AR_INCR		64
-#define ABS(x)		(((x) < 0) ? -(x) : (x))
-#ifdef MIN
- #undef MIN
- #define MIN(x,y)	(((x) < (y)) ? (x) : (y))
-#endif
-#define MAX_RAM		1000000
-#define SROW		11
-#define SCOL		10
-#define SHORT			int
-#define NOMASK			1
-#define MIN_SLOPE		.00001
-#define MIN_GRADIENT_DEGREES	1
-#define DEG_TO_RAD		.017453293	/* pi / 180 */
-#define METER_TO_FOOT		3.281
-#define PAGE_BLOCK		512
-#define RITE			1
-#define LEFT			2
-#define NEITHER			0
+#define SHORT int
 
-NODE {
-    int row, col;
-};
-
 extern SHORT drain[3][3];
-extern SHORT updrain[3][3];
-extern char dr_mod[9];
-extern char dc_mod[9];
-extern char basin_name[GNAME_MAX], swale_name[GNAME_MAX],
-    half_name[GNAME_MAX], elev_name[GNAME_MAX], armsed_name[GNAME_MAX];
-extern int nrows, ncols, done, total;
-extern int array_size, high_index, do_index;
-extern char *drain_ptrs, ha_f, el_f, ar_f;
-extern RAMSEG ba_seg, pt_seg, sl_seg;
-extern int ncols_less_one, nrows_less_one;
-extern NODE *to_do;
-extern FILE *arm_fd, *fp;
-extern FLAG *doner, *swale, *left;
+extern int nrows, ncols;
+extern char *drain_ptrs;
+extern RAMSEG ba_seg, pt_seg;
 extern CELL *bas;
-extern double half_res, diag, max_length, dep_slope;
-extern struct Cell_head window;
-
-/*
-   GLOBAL CELL     *dis, *alt, *wat, *asp, *bas, *haf, *r_h, *dep, *ril_buf;
- */

Deleted: grass/trunk/raster/r.water.outlet/flag.h
===================================================================
--- grass/trunk/raster/r.water.outlet/flag.h	2015-08-21 07:15:42 UTC (rev 65983)
+++ grass/trunk/raster/r.water.outlet/flag.h	2015-08-21 07:38:35 UTC (rev 65984)
@@ -1,70 +0,0 @@
-/* flag.[ch] is a set of routines which will set up an array of bits
- ** that allow the programmer to "flag" cells in a raster map.
- **
- ** FLAG *
- ** flag_create(nrows,ncols)
- ** int nrows, ncols;
- **     opens the structure flag.  
- **     The flag structure will be a two dimensional array of bits the
- **     size of nrows by ncols.  Will initalize flags to zero (unset).
- **
- ** flag_destroy(flags)
- ** FLAG *flags;
- **     closes flags and gives the memory back to the system.
- **
- ** flag_clear_all(flags)
- ** FLAG *flags;
- **     sets all values in flags to zero.
- **
- ** flag_unset(flags, row, col)
- ** FLAG *flags;
- ** int row, col;
- **     sets the value of (row, col) in flags to zero.
- **
- ** flag_set(flags, row, col)
- ** FLAG *flags;
- ** int row, col;
- **     will set the value of (row, col) in flags to one.
- **
- ** int
- ** flag_get(flags, row, col)
- ** FLAG *flags;
- ** int row, col;
- **     returns the value in flags that is at (row, col).
- **
- ** idea by Michael Shapiro
- ** code by Chuck Ehlschlaeger
- ** April 03, 1989
- */
-#define FLAG struct _flagsss_
-FLAG {
-    int nrows, ncols, leng;
-    unsigned char **array;
-};
-
-#define FLAG_UNSET(flags,row,col) \
-	(flags)->array[(row)][(col)>>3] &= ~(1<<((col) & 7))
-
-#define FLAG_SET(flags,row,col) \
-	(flags)->array[(row)][(col)>>3] |= (1<<((col) & 7))
-
-#define FLAG_GET(flags,row,col) \
-	(flags)->array[(row)][(col)>>3] & (1<<((col) & 7))
-
-/* flag_clr_all.c */
-int flag_clear_all(FLAG *);
-
-/* flag_create.c */
-FLAG *flag_create(int, int);
-
-/* flag_destroy.c */
-int flag_destroy(FLAG *);
-
-/* flag_get.c */
-int flag_get(FLAG *, int, int);
-
-/* flag_set.c */
-int flag_set(FLAG *, int, int);
-
-/* flag_unset.c */
-int flag_unset(FLAG *, int, int);

Deleted: grass/trunk/raster/r.water.outlet/flag_clr_all.c
===================================================================
--- grass/trunk/raster/r.water.outlet/flag_clr_all.c	2015-08-21 07:15:42 UTC (rev 65983)
+++ grass/trunk/raster/r.water.outlet/flag_clr_all.c	2015-08-21 07:38:35 UTC (rev 65984)
@@ -1,15 +0,0 @@
-#include "flag.h"
-
-int flag_clear_all(FLAG * flags)
-{
-    register int r, c;
-
-    r = flags->nrows - 1;
-    while (r--) {
-	c = flags->leng - 1;
-	while (c--)
-	    flags->array[r][c] = 0;
-    }
-
-    return 0;
-}

Deleted: grass/trunk/raster/r.water.outlet/flag_create.c
===================================================================
--- grass/trunk/raster/r.water.outlet/flag_create.c	2015-08-21 07:15:42 UTC (rev 65983)
+++ grass/trunk/raster/r.water.outlet/flag_create.c	2015-08-21 07:38:35 UTC (rev 65984)
@@ -1,39 +0,0 @@
-#include <grass/gis.h>
-#include "flag.h"
-
-FLAG *flag_create(int nrows, int ncols)
-{
-    unsigned char *temp;
-    FLAG *new_flag;
-    register int i;
-
-    new_flag = (FLAG *) G_malloc(sizeof(FLAG));
-    if (!new_flag) {
-	G_warning("Memory error in flag_create() at FLAG");
-	return (NULL);
-    }
-    new_flag->nrows = nrows;
-    new_flag->ncols = ncols;
-    new_flag->leng = (ncols + 7) / 8;
-    new_flag->array =
-	(unsigned char **)G_malloc(nrows * sizeof(unsigned char *));
-    if (!new_flag->array) {
-	G_warning("Memory error in flag_create() at array");
-	G_free(new_flag);
-	return (NULL);
-    }
-    temp =
-	(unsigned char *)G_calloc(nrows * new_flag->leng,
-				  sizeof(unsigned char));
-    if (!temp) {
-	G_warning("Memory error in flag_create() at temp");
-	G_free(new_flag->array);
-	G_free(new_flag);
-	return (NULL);
-    }
-    for (i = 0; i < nrows; i++) {
-	new_flag->array[i] = temp;
-	temp += new_flag->leng;
-    }
-    return (new_flag);
-}

Deleted: grass/trunk/raster/r.water.outlet/flag_destroy.c
===================================================================
--- grass/trunk/raster/r.water.outlet/flag_destroy.c	2015-08-21 07:15:42 UTC (rev 65983)
+++ grass/trunk/raster/r.water.outlet/flag_destroy.c	2015-08-21 07:38:35 UTC (rev 65984)
@@ -1,11 +0,0 @@
-#include <grass/gis.h>
-#include "flag.h"
-
-int flag_destroy(FLAG * flags)
-{
-    G_free(flags->array[0]);
-    G_free(flags->array);
-    G_free(flags);
-
-    return 0;
-}

Deleted: grass/trunk/raster/r.water.outlet/flag_get.c
===================================================================
--- grass/trunk/raster/r.water.outlet/flag_get.c	2015-08-21 07:15:42 UTC (rev 65983)
+++ grass/trunk/raster/r.water.outlet/flag_get.c	2015-08-21 07:38:35 UTC (rev 65984)
@@ -1,6 +0,0 @@
-#include "flag.h"
-
-int flag_get(FLAG * flags, int row, int col)
-{
-    return (flags->array[row][col >> 3] & (1 << (col & 7)));
-}

Deleted: grass/trunk/raster/r.water.outlet/flag_set.c
===================================================================
--- grass/trunk/raster/r.water.outlet/flag_set.c	2015-08-21 07:15:42 UTC (rev 65983)
+++ grass/trunk/raster/r.water.outlet/flag_set.c	2015-08-21 07:38:35 UTC (rev 65984)
@@ -1,8 +0,0 @@
-#include "flag.h"
-
-int flag_set(FLAG * flags, int row, int col)
-{
-    flags->array[row][col >> 3] |= (1 << (col & 7));
-
-    return 0;
-}

Deleted: grass/trunk/raster/r.water.outlet/flag_unset.c
===================================================================
--- grass/trunk/raster/r.water.outlet/flag_unset.c	2015-08-21 07:15:42 UTC (rev 65983)
+++ grass/trunk/raster/r.water.outlet/flag_unset.c	2015-08-21 07:38:35 UTC (rev 65984)
@@ -1,8 +0,0 @@
-#include "flag.h"
-
-int flag_unset(FLAG * flags, int row, int col)
-{
-    flags->array[row][col >> 3] &= ~(1 << (col & 7));
-
-    return 0;
-}

Modified: grass/trunk/raster/r.water.outlet/main.c
===================================================================
--- grass/trunk/raster/r.water.outlet/main.c	2015-08-21 07:15:42 UTC (rev 65983)
+++ grass/trunk/raster/r.water.outlet/main.c	2015-08-21 07:38:35 UTC (rev 65984)
@@ -31,34 +31,23 @@
 #include "basin.h"
 #include "outletP.h"
 
-SHORT drain[3][3]	= {{ 7,6,5 },{ 8,-17,4 },{ 1,2,3 }};
-SHORT updrain[3][3]	= {{ 3,2,1 },{ 4,-17,8 },{ 5,6,7 }};
-char dr_mod[9]	= {0,1,1,1,0,-1,-1,-1,0};
-char dc_mod[9]	= {0,1,0,-1,-1,-1,0,1,1};
-char basin_name[GNAME_MAX], swale_name[GNAME_MAX],
-  half_name[GNAME_MAX], elev_name[GNAME_MAX], armsed_name[GNAME_MAX];
-int nrows, ncols, done, total;
-int array_size, high_index, do_index;
-char *drain_ptrs, ha_f, el_f, ar_f;
-RAMSEG ba_seg, pt_seg, sl_seg;
-int ncols_less_one, nrows_less_one;
-NODE *to_do;
-FILE *arm_fd, *fp;
-FLAG *doner, *swale, *left;
+SHORT drain[3][3] = {{ 7,6,5 },{ 8,-17,4 },{ 1,2,3 }};
+int nrows, ncols;
+char *drain_ptrs;
+RAMSEG ba_seg, pt_seg;
 CELL *bas;
-double half_res, diag, max_length, dep_slope;
-struct Cell_head window;
 
 int main(int argc, char *argv[])
 {
-    double N, E;
-    int row, col, basin_fd, drain_fd;
-    CELL *cell_buf;
-    char drain_name[GNAME_MAX];
     struct GModule *module;
     struct {
       struct Option *input, *output, *coords;
     } opt;
+    double N, E;
+    int row, col, basin_fd, drain_fd;
+    CELL *cell_buf;
+    char drain_name[GNAME_MAX], basin_name[GNAME_MAX];
+    struct Cell_head window;
 
     G_gisinit(argv[0]);
 
@@ -103,9 +92,6 @@
 
     nrows = Rast_window_rows();
     ncols = Rast_window_cols();
-    total = nrows * ncols;
-    nrows_less_one = nrows - 1;
-    ncols_less_one = ncols - 1;
     drain_fd = Rast_open_old(drain_name, "");
 
     drain_ptrs =
@@ -116,8 +102,6 @@
     for (row = 0; row < nrows; row++) {
 	Rast_get_c_row(drain_fd, cell_buf, row);
 	for (col = 0; col < ncols; col++) {
-	    if (cell_buf[col] == 0) 
-		total--;
 	    drain_ptrs[SEG_INDEX(pt_seg, row, col)] = cell_buf[col];
 	}
     }



More information about the grass-commit mailing list