[GRASS-SVN] r40658 -
grass/branches/develbranch_6/raster/r.watershed/seg
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jan 26 03:57:52 EST 2010
Author: mmetz
Date: 2010-01-26 03:57:49 -0500 (Tue, 26 Jan 2010)
New Revision: 40658
Modified:
grass/branches/develbranch_6/raster/r.watershed/seg/init_vars.c
Log:
fix for small regions
Modified: grass/branches/develbranch_6/raster/r.watershed/seg/init_vars.c
===================================================================
--- grass/branches/develbranch_6/raster/r.watershed/seg/init_vars.c 2010-01-26 08:56:27 UTC (rev 40657)
+++ grass/branches/develbranch_6/raster/r.watershed/seg/init_vars.c 2010-01-26 08:57:49 UTC (rev 40658)
@@ -10,7 +10,7 @@
int init_vars(int argc, char *argv[])
{
SHORT r, c;
- int fd, num_cseg_total, num_open_segs;
+ int fd, num_cseg_total, num_open_segs, n_array_segs;
int seg_rows, seg_cols;
double segs_mb;
@@ -345,12 +345,22 @@
if (ls_flag)
dseg_open(&l_s, 1, seg_rows * seg_cols, num_open_segs);
+ if (num_open_segs / 2 > 0)
+ n_array_segs = num_open_segs / 2;
+ else
+ n_array_segs = 1;
+
seg_open(&astar_pts, 1, do_points, 1, seg_rows * seg_cols * 2,
- num_open_segs / 2, sizeof(POINT));
+ n_array_segs, sizeof(POINT));
/* heap_index will track astar_pts in ternary min-heap */
/* heap_index is one-based */
- seg_open(&heap_index, 1, do_points + 1, 1, seg_cols * num_open_segs * seg_rows / 10,
+ if (seg_cols * num_open_segs * seg_rows / 10 > 0)
+ n_array_segs = seg_cols * num_open_segs * seg_rows / 10;
+ else
+ n_array_segs = 1;
+
+ seg_open(&heap_index, 1, do_points + 1, 1, n_array_segs,
10, sizeof(HEAP));
G_message(_("SECTION 1b (of %1d): Determining Offmap Flow."), tot_parts);
More information about the grass-commit
mailing list