[GRASS-SVN] r61149 - grass-addons/grass7/raster/r.stream.basins
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jul 4 02:40:13 PDT 2014
Author: hamish
Date: 2014-07-04 02:40:13 -0700 (Fri, 04 Jul 2014)
New Revision: 61149
Modified:
grass-addons/grass7/raster/r.stream.basins/main.c
Log:
better balance of memory= option (#2356)
Modified: grass-addons/grass7/raster/r.stream.basins/main.c
===================================================================
--- grass-addons/grass7/raster/r.stream.basins/main.c 2014-07-04 07:56:38 UTC (rev 61148)
+++ grass-addons/grass7/raster/r.stream.basins/main.c 2014-07-04 09:40:13 UTC (rev 61149)
@@ -194,12 +194,14 @@
if (segmentation) {
SEG map_dirs, map_streams, map_basins;
SEGMENT *streams = NULL, *dirs, *basins;
- int number_of_segs;
+ int number_of_segs, num_maps;
G_message(_("Memory swap calculation (may take some time)..."));
-
+
+ num_maps = b_test == 2 ? 3 : 2;
number_of_segs = (int)atof(opt_swapsize->answer);
- number_of_segs = number_of_segs < 32 ? (int)(32 / 0.12) : number_of_segs / 0.12;
+ number_of_segs = number_of_segs < 32 ? (int)(32 / 0.12) :
+ (int)(number_of_segs * 4.0 / num_maps);
seg_create_map(&map_dirs, SROWS, SCOLS, number_of_segs, CELL_TYPE);
seg_read_map(&map_dirs, in_dir_opt->answer, 1, CELL_TYPE);
More information about the grass-commit
mailing list