[GRASS-SVN] r71620 - grass/trunk/raster/r.stream.extract
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Oct 31 12:46:06 PDT 2017
Author: mmetz
Date: 2017-10-31 12:46:05 -0700 (Tue, 31 Oct 2017)
New Revision: 71620
Modified:
grass/trunk/raster/r.stream.extract/bseg.c
grass/trunk/raster/r.stream.extract/cseg.c
grass/trunk/raster/r.stream.extract/dseg.c
grass/trunk/raster/r.stream.extract/load.c
grass/trunk/raster/r.stream.extract/local_proto.h
grass/trunk/raster/r.stream.extract/main.c
grass/trunk/raster/r.stream.extract/seg.c
grass/trunk/raster/r.stream.extract/seg.h
Log:
r.stream.extract: use 64 bit integer to support large regions
Modified: grass/trunk/raster/r.stream.extract/bseg.c
===================================================================
--- grass/trunk/raster/r.stream.extract/bseg.c 2017-10-31 19:07:34 UTC (rev 71619)
+++ grass/trunk/raster/r.stream.extract/bseg.c 2017-10-31 19:46:05 UTC (rev 71620)
@@ -72,7 +72,7 @@
return 0;
}
-int bseg_put(BSEG *bseg, char *value, int row, int col)
+int bseg_put(BSEG *bseg, char *value, GW_LARGE_INT row, GW_LARGE_INT col)
{
if (Segment_put(&(bseg->seg), value, row, col) < 0) {
G_warning(_("Unable to write segment file"));
@@ -81,7 +81,7 @@
return 0;
}
-int bseg_put_row(BSEG *bseg, char *value, int row)
+int bseg_put_row(BSEG *bseg, char *value, GW_LARGE_INT row)
{
if (Segment_put_row(&(bseg->seg), value, row) < 0) {
G_warning(_("Unable to write segment file"));
@@ -90,7 +90,7 @@
return 0;
}
-int bseg_get(BSEG *bseg, char *value, int row, int col)
+int bseg_get(BSEG *bseg, char *value, GW_LARGE_INT row, GW_LARGE_INT col)
{
if (Segment_get(&(bseg->seg), value, row, col) < 0) {
G_warning(_("Unable to read segment file"));
Modified: grass/trunk/raster/r.stream.extract/cseg.c
===================================================================
--- grass/trunk/raster/r.stream.extract/cseg.c 2017-10-31 19:07:34 UTC (rev 71619)
+++ grass/trunk/raster/r.stream.extract/cseg.c 2017-10-31 19:46:05 UTC (rev 71620)
@@ -73,7 +73,7 @@
return 0;
}
-int cseg_put(CSEG *cseg, CELL *value, int row, int col)
+int cseg_put(CSEG *cseg, CELL *value, GW_LARGE_INT row, GW_LARGE_INT col)
{
if (Segment_put(&(cseg->seg), value, row, col) < 0) {
G_warning(_("Unable to write segment file"));
@@ -82,7 +82,7 @@
return 0;
}
-int cseg_put_row(CSEG *cseg, CELL *value, int row)
+int cseg_put_row(CSEG *cseg, CELL *value, GW_LARGE_INT row)
{
if (Segment_put_row(&(cseg->seg), value, row) < 0) {
G_warning(_("Unable to write segment file"));
@@ -91,7 +91,7 @@
return 0;
}
-int cseg_get(CSEG *cseg, CELL *value, int row, int col)
+int cseg_get(CSEG *cseg, CELL *value, GW_LARGE_INT row, GW_LARGE_INT col)
{
if (Segment_get(&(cseg->seg), value, row, col) < 0) {
G_warning(_("Unabel to read segment file"));
Modified: grass/trunk/raster/r.stream.extract/dseg.c
===================================================================
--- grass/trunk/raster/r.stream.extract/dseg.c 2017-10-31 19:07:34 UTC (rev 71619)
+++ grass/trunk/raster/r.stream.extract/dseg.c 2017-10-31 19:46:05 UTC (rev 71620)
@@ -73,7 +73,7 @@
return 0;
}
-int dseg_put(DSEG *dseg, DCELL *value, int row, int col)
+int dseg_put(DSEG *dseg, DCELL *value, GW_LARGE_INT row, GW_LARGE_INT col)
{
if (Segment_put(&(dseg->seg), (DCELL *) value, row, col) < 0) {
G_warning(_("Unable to write segment file"));
@@ -82,7 +82,7 @@
return 0;
}
-int dseg_put_row(DSEG *dseg, DCELL *value, int row)
+int dseg_put_row(DSEG *dseg, DCELL *value, GW_LARGE_INT row)
{
if (Segment_put_row(&(dseg->seg), (DCELL *) value, row) < 0) {
G_warning(_("Unable to write segment file"));
@@ -91,7 +91,7 @@
return 0;
}
-int dseg_get(DSEG *dseg, DCELL *value, int row, int col)
+int dseg_get(DSEG *dseg, DCELL *value, GW_LARGE_INT row, GW_LARGE_INT col)
{
if (Segment_get(&(dseg->seg), (DCELL *) value, row, col) < 0) {
G_warning(_("Unable to read segment file"));
Modified: grass/trunk/raster/r.stream.extract/load.c
===================================================================
--- grass/trunk/raster/r.stream.extract/load.c 2017-10-31 19:07:34 UTC (rev 71619)
+++ grass/trunk/raster/r.stream.extract/load.c 2017-10-31 19:46:05 UTC (rev 71620)
@@ -161,5 +161,5 @@
G_debug(1, "%lld non-NULL cells", n_points);
- return n_points;
+ return (n_points > 0);
}
Modified: grass/trunk/raster/r.stream.extract/local_proto.h
===================================================================
--- grass/trunk/raster/r.stream.extract/local_proto.h 2017-10-31 19:07:34 UTC (rev 71619)
+++ grass/trunk/raster/r.stream.extract/local_proto.h 2017-10-31 19:46:05 UTC (rev 71620)
@@ -6,8 +6,6 @@
#include "flag.h"
#include "seg.h"
-#define GW_LARGE_INT off_t
-
#define INDEX(r, c) ((r) * ncols + (c))
#define MAXDEPTH 1000 /* maximum supported tree depth of stream network */
Modified: grass/trunk/raster/r.stream.extract/main.c
===================================================================
--- grass/trunk/raster/r.stream.extract/main.c 2017-10-31 19:07:34 UTC (rev 71619)
+++ grass/trunk/raster/r.stream.extract/main.c 2017-10-31 19:46:05 UTC (rev 71620)
@@ -386,7 +386,7 @@
/* the search heap will not hold more than 5% of all points at any given time ? */
/* chances are good that the heap will fit into one large segment */
seg_open(&search_heap, 1, n_points + 1, 1, seg_cols,
- num_open_array_segs, sizeof(HEAP_PNT), 1);
+ num_open_array_segs, sizeof(HEAP_PNT), 0);
/********************/
/* processing */
Modified: grass/trunk/raster/r.stream.extract/seg.c
===================================================================
--- grass/trunk/raster/r.stream.extract/seg.c 2017-10-31 19:07:34 UTC (rev 71619)
+++ grass/trunk/raster/r.stream.extract/seg.c 2017-10-31 19:46:05 UTC (rev 71620)
@@ -4,7 +4,8 @@
#include "seg.h"
int
-seg_open(SSEG *sseg, int nrows, int ncols, int row_in_seg, int col_in_seg,
+seg_open(SSEG *sseg, GW_LARGE_INT nrows, GW_LARGE_INT ncols,
+ int row_in_seg, int col_in_seg,
int nsegs_in_memory, int size_struct, int fill)
{
char *filename;
@@ -69,7 +70,7 @@
return 0;
}
-int seg_put(SSEG *sseg, char *value, int row, int col)
+int seg_put(SSEG *sseg, char *value, GW_LARGE_INT row, GW_LARGE_INT col)
{
if (Segment_put(&(sseg->seg), value, row, col) < 0) {
G_warning(_("Unable to write segment file"));
@@ -78,7 +79,7 @@
return 0;
}
-int seg_put_row(SSEG *sseg, char *value, int row)
+int seg_put_row(SSEG *sseg, char *value, GW_LARGE_INT row)
{
if (Segment_put_row(&(sseg->seg), value, row) < 0) {
G_warning(_("seg_put_row(): could not write segment file"));
@@ -87,7 +88,7 @@
return 0;
}
-int seg_get(SSEG *sseg, char *value, int row, int col)
+int seg_get(SSEG *sseg, char *value, GW_LARGE_INT row, GW_LARGE_INT col)
{
if (Segment_get(&(sseg->seg), value, row, col) < 0) {
G_warning(_("Unable to read segment file"));
@@ -96,7 +97,7 @@
return 0;
}
-int seg_get_row(SSEG *sseg, char *value, int row)
+int seg_get_row(SSEG *sseg, char *value, GW_LARGE_INT row)
{
if (Segment_get_row(&(sseg->seg), value, row) < 0) {
G_warning(_("Unable to read segment file"));
Modified: grass/trunk/raster/r.stream.extract/seg.h
===================================================================
--- grass/trunk/raster/r.stream.extract/seg.h 2017-10-31 19:07:34 UTC (rev 71619)
+++ grass/trunk/raster/r.stream.extract/seg.h 2017-10-31 19:46:05 UTC (rev 71620)
@@ -4,6 +4,8 @@
#include <grass/raster.h>
#include <grass/segment.h>
+#define GW_LARGE_INT off_t
+
#define CSEG struct _c_s_e_g_
CSEG {
SEGMENT seg; /* segment structure */
@@ -40,39 +42,38 @@
/* bseg.c */
int bseg_close(BSEG *);
-int bseg_get(BSEG *, char *, int, int);
+int bseg_get(BSEG *, char *, GW_LARGE_INT, GW_LARGE_INT);
int bseg_open(BSEG *, int, int, int);
-int bseg_put(BSEG *, char *, int, int);
-int bseg_put_row(BSEG *, char *, int);
+int bseg_put(BSEG *, char *, GW_LARGE_INT, GW_LARGE_INT);
+int bseg_put_row(BSEG *, char *, GW_LARGE_INT);
int bseg_read_raster(BSEG *, char *, char *);
int bseg_write_raster(BSEG *, char *);
/* cseg.c */
int cseg_close(CSEG *);
-int cseg_get(CSEG *, CELL *, int, int);
+int cseg_get(CSEG *, CELL *, GW_LARGE_INT, GW_LARGE_INT);
int cseg_open(CSEG *, int, int, int);
-int cseg_put(CSEG *, CELL *, int, int);
-int cseg_put_row(CSEG *, CELL *, int);
+int cseg_put(CSEG *, CELL *, GW_LARGE_INT, GW_LARGE_INT);
+int cseg_put_row(CSEG *, CELL *, GW_LARGE_INT);
int cseg_read_raster(CSEG *, char *, char *);
int cseg_write_raster(CSEG *, char *);
/* dseg.c */
int dseg_close(DSEG *);
-int dseg_get(DSEG *, double *, int, int);
+int dseg_get(DSEG *, double *, GW_LARGE_INT, GW_LARGE_INT);
int dseg_open(DSEG *, int, int, int);
-int dseg_put(DSEG *, double *, int, int);
-int dseg_put_row(DSEG *, double *, int);
+int dseg_put(DSEG *, double *, GW_LARGE_INT, GW_LARGE_INT);
+int dseg_put_row(DSEG *, double *, GW_LARGE_INT);
int dseg_read_raster(DSEG *, char *, char *);
int dseg_write_raster(DSEG *, char *);
/* seg.c */
int seg_close(SSEG *);
-int seg_get(SSEG *, char *, int, int);
-int seg_open(SSEG *, int, int, int, int, int, int, int);
-int seg_put(SSEG *, char *, int, int);
-int seg_put_row(SSEG *, char *, int);
-int seg_get(SSEG *, char *, int, int);
-int seg_get_row(SSEG *, char *, int);
+int seg_get(SSEG *, char *, GW_LARGE_INT, GW_LARGE_INT);
+int seg_open(SSEG *, GW_LARGE_INT, GW_LARGE_INT, int, int, int, int, int);
+int seg_put(SSEG *, char *, GW_LARGE_INT, GW_LARGE_INT);
+int seg_put_row(SSEG *, char *, GW_LARGE_INT);
+int seg_get_row(SSEG *, char *, GW_LARGE_INT);
int seg_flush(SSEG *);
#endif /* __SEG_H__ */
More information about the grass-commit
mailing list