[GRASS-SVN] r48398 - grass/trunk/lib/raster3d
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Sep 21 15:57:28 EDT 2011
Author: huhabla
Date: 2011-09-21 12:57:28 -0700 (Wed, 21 Sep 2011)
New Revision: 48398
Modified:
grass/trunk/lib/raster3d/open2.c
grass/trunk/lib/raster3d/tilemath.c
Log:
Fixed wrong tile size computation in case of huge raster3d maps.
Modified: grass/trunk/lib/raster3d/open2.c
===================================================================
--- grass/trunk/lib/raster3d/open2.c 2011-09-21 17:54:06 UTC (rev 48397)
+++ grass/trunk/lib/raster3d/open2.c 2011-09-21 19:57:28 UTC (rev 48398)
@@ -105,9 +105,11 @@
Rast3d_get_tile_dimension(&oldTileX, &oldTileY, &oldTileZ);
-
+
Rast3d_compute_optimal_tile_dimension(region, type, &tileX, &tileY, &tileZ, maxSize);
+ G_debug(1, "New tile dimension X %i Y %i Z %i\n", tileX, tileY, tileZ);
+
Rast3d_set_tile_dimension(tileX, tileY, tileZ);
oldType = Rast3d_get_file_type();
Modified: grass/trunk/lib/raster3d/tilemath.c
===================================================================
--- grass/trunk/lib/raster3d/tilemath.c 2011-09-21 17:54:06 UTC (rev 48397)
+++ grass/trunk/lib/raster3d/tilemath.c 2011-09-21 19:57:28 UTC (rev 48398)
@@ -331,13 +331,13 @@
void
Rast3d_compute_optimal_tile_dimension(RASTER3D_Region *region, int type, int *tileX, int *tileY, int *tileZ, int maxSize)
{
- int size = 0;
- int x, y, z;
- int i = 0;
- int tileSize;
- int divx = 2;
- int divy = 2;
- int divz = 2;
+ unsigned long size = 0;
+ unsigned long x, y, z;
+ unsigned long i = 0;
+ unsigned long tileSize;
+ unsigned long divx = 2;
+ unsigned long divy = 2;
+ unsigned long divz = 2;
if(type == FCELL_TYPE)
size = sizeof(FCELL);
@@ -352,9 +352,7 @@
while(1) {
tileSize = size * x * y * z;
- /*
- printf("Tilesize %i x %i y %i z %i\n", tileSize, x, y, z);
- */
+ G_debug(2, "Rast3d_compute_optimal_tile_dimension: tilesize %li x %li y %li z %li\n", tileSize, x, y, z);
if(tileSize <= maxSize * 1024)
break;
@@ -391,9 +389,9 @@
break;
}
- *tileX = x;
- *tileY = y;
- *tileZ = z;
+ *tileX = (int)x;
+ *tileY = (int)y;
+ *tileZ = (int)z;
}
More information about the grass-commit
mailing list