[GRASS-SVN] r72878 - grass-addons/grass7/raster/r.accumulate
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jun 21 22:59:14 PDT 2018
Author: hcho
Date: 2018-06-21 22:59:14 -0700 (Thu, 21 Jun 2018)
New Revision: 72878
Modified:
grass-addons/grass7/raster/r.accumulate/accumulate.c
Log:
r.accumulate: Remove a redundant variable
Modified: grass-addons/grass7/raster/r.accumulate/accumulate.c
===================================================================
--- grass-addons/grass7/raster/r.accumulate/accumulate.c 2018-06-22 05:38:08 UTC (rev 72877)
+++ grass-addons/grass7/raster/r.accumulate/accumulate.c 2018-06-22 05:59:14 UTC (rev 72878)
@@ -6,7 +6,7 @@
char **done, int row, int col)
{
int rows = weight_buf.rows, cols = weight_buf.cols;
- int i, j, neighbor_dir, loop_dir, has_inflow;
+ int i, j, neighbor_dir, loop_dir;
double acc_flow;
if (done[row][col])
@@ -23,7 +23,6 @@
for (j = -1; j <= 1; j++) {
if (col + j < 0 || col + j >= cols || (i == 0 && j == 0))
continue;
- has_inflow = 0;
neighbor_dir = dir_buf[row + i][col + j];
loop_dir = 0;
switch (i) {
@@ -30,22 +29,16 @@
case -1:
switch (j) {
case -1:
- if (neighbor_dir == 315) {
- has_inflow = 1;
+ if (neighbor_dir == 315)
loop_dir = 135;
- }
break;
case 0:
- if (neighbor_dir == 270) {
- has_inflow = 1;
+ if (neighbor_dir == 270)
loop_dir = 90;
- }
break;
case 1:
- if (neighbor_dir == 225) {
- has_inflow = 1;
+ if (neighbor_dir == 225)
loop_dir = 45;
- }
break;
}
break;
@@ -52,16 +45,12 @@
case 0:
switch (j) {
case -1:
- if (neighbor_dir == 360) {
- has_inflow = 1;
+ if (neighbor_dir == 360)
loop_dir = 180;
- }
break;
case 1:
- if (neighbor_dir == 180) {
- has_inflow = 1;
+ if (neighbor_dir == 180)
loop_dir = 360;
- }
break;
}
break;
@@ -68,27 +57,21 @@
case 1:
switch (j) {
case -1:
- if (neighbor_dir == 45) {
- has_inflow = 1;
+ if (neighbor_dir == 45)
loop_dir = 225;
- }
break;
case 0:
- if (neighbor_dir == 90) {
- has_inflow = 1;
+ if (neighbor_dir == 90)
loop_dir = 270;
- }
break;
case 1:
- if (neighbor_dir == 135) {
- has_inflow = 1;
+ if (neighbor_dir == 135)
loop_dir = 315;
- }
break;
}
break;
}
- if (has_inflow && dir_buf[row][col] != loop_dir)
+ if (loop_dir && dir_buf[row][col] != loop_dir)
acc_flow +=
accumulate(dir_buf, weight_buf, acc_buf, done, row + i,
col + j);
More information about the grass-commit
mailing list