[GRASS-CVS] markus: grass6/raster/r.los main.c,2.18,2.19
grass at intevation.de
grass at intevation.de
Fri Dec 7 16:45:04 EST 2007
Author: markus
Update of /grassrepository/grass6/raster/r.los
In directory doto:/tmp/cvs-serv6770
Modified Files:
main.c
Log Message:
reverted 'percent memory' patch due to 64bit failure
Index: main.c
===================================================================
RCS file: /grassrepository/grass6/raster/r.los/main.c,v
retrieving revision 2.18
retrieving revision 2.19
diff -u -d -r2.18 -r2.19
--- main.c 19 Nov 2007 15:36:13 -0000 2.18
+++ main.c 7 Dec 2007 21:45:02 -0000 2.19
@@ -52,7 +52,7 @@
{
int row_viewpt, col_viewpt, nrows, ncols, a, b, row, patt_flag;
int segment_no, flip, xmax, ymax, sign_on_y, sign_on_x;
- int length_data_item;
+ int submatrix_rows, submatrix_cols, lenth_data_item;
int patt = 0, in_fd, out_fd, patt_fd = 0;
int old, new;
double slope_1, slope_2, max_vert_angle = 0.0, color_factor;
@@ -66,13 +66,9 @@
CELL *cell;
FCELL *fcell, data, viewpt_elev;
SEGMENT seg_in, seg_out, seg_patt;
- int segments_in_memory;
- int maxmem;
- int nseg = 4; /* see r.walk */
- int srows, scols;
struct point *heads[16], *SEARCH_PT;
struct GModule *module;
- struct Option *opt1, *opt2, *opt3, *opt5, *opt6, *opt7, *opt8;
+ struct Option *opt1, *opt2, *opt3, *opt5, *opt6, *opt7;
struct History history;
char title[128];
@@ -116,16 +112,6 @@
opt6->options = "0-999999";
opt6->description = _("Maximum distance from the viewing point (meters)");
- opt8 = G_define_option();
- opt8->key = "percent_memory";
- opt8->type = TYPE_INTEGER;
- opt8->key_desc = "percent memory";
- opt8->required = NO;
- opt8->multiple = NO;
- opt8->answer = "100";
- opt8->description = _("Percent of map to keep in memory");
-
-
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
@@ -216,45 +202,40 @@
}
/* parameters for map submatrices */
- length_data_item = sizeof(FCELL);
- if (sscanf(opt8->answer, "%d", &maxmem) != 1 || maxmem < 0 || maxmem > 100)
- G_fatal_error(_("Inappropriate percent memory: %d"), maxmem);
-
- srows = nrows / nseg + 1;
- scols = ncols / nseg + 1;
- if (maxmem > 0)
- segments_in_memory =
- 2 + maxmem * (nrows / srows) * (ncols / scols) / 100;
- else
- segments_in_memory = 4 * (nrows / srows + ncols / scols + 2);
+ lenth_data_item = sizeof(FCELL);
+ submatrix_rows = nrows / 4 + 1;
+ submatrix_cols = ncols / 4 + 1;
/* create segmented format files for elevation layer, */
/* output layer and pattern layer (if present) */
in_name = G_tempfile();
in_fd = creat(in_name, 0666);
- segment_format(in_fd, nrows, ncols, srows, scols, length_data_item);
+ segment_format(in_fd, nrows, ncols,
+ submatrix_rows, submatrix_cols, lenth_data_item);
close(in_fd);
out_name = G_tempfile();
out_fd = creat(out_name, 0666);
- segment_format(patt_fd, nrows, ncols, srows, scols, length_data_item);
+ segment_format(out_fd, nrows, ncols,
+ submatrix_rows, submatrix_cols, lenth_data_item);
close(out_fd);
if (patt_flag == TRUE) {
patt_name = G_tempfile();
patt_fd = creat(patt_name, 0666);
- segment_format(patt_fd, nrows, ncols, srows, scols, sizeof(CELL));
+ segment_format(patt_fd, nrows, ncols,
+ submatrix_rows, submatrix_cols, sizeof(CELL));
close(patt_fd);
}
/* open, initialize and segment all files */
in_fd = open(in_name, 2);
- segment_init(&seg_in, in_fd, segments_in_memory);
+ segment_init(&seg_in, in_fd, 4);
out_fd = open(out_name, 2);
- segment_init(&seg_out, out_fd, segments_in_memory);
+ segment_init(&seg_out, out_fd, 4);
if (patt_flag == TRUE) {
patt_fd = open(patt_name, 2);
- segment_init(&seg_patt, patt_fd, segments_in_memory);
+ segment_init(&seg_patt, patt_fd, 4);
for (row = 0; row < nrows; row++) {
if (G_get_raster_row(patt, cell, row, CELL_TYPE) < 0)
G_fatal_error(_("Unable to read raster map <%s> row %d"), patt_layer, row);
More information about the grass-commit
mailing list