[GRASS5] Re: r.terraflow

Hi Laura,
dear developers,

developers: Laura asked me to forward her mail.
Please cc her answer also to her!

Markus

On Wed, Nov 20, 2002 at 04:36:28PM -0500, Laura I. Toma wrote:

Hi Markus,

Helena told me I should talk to you about submitting r.terraflow. I went
through the submission instructions. Below are some points where I
had troubles or could not conform to the suggestions:

- a big part of the code is in C++ and uses templates. converting it to C
is a long tedious job, so I hope it is acceptable as is..

- cannot use GRASS malloc functions, because r.terraflow has its own
memory manager. basically it overloads new and delete to keep track of how
much memory is in use.

- r.terraflow uses a library libiostream.a that resides in the IOSTREAM
directory inside r.terraflow. This library contains the memory
manager and the basic I/O-efficient stream routines, like sorting,
priority queues and so on. This library has to be built
separately, before calling gmake5 (I did not know how to handle
this inside Gmakefile).

[laura@duckabush r.terraflow]$ cd IOStream/lib/src/
[laura@duckabush src]$ gmake
/bin/sh -ec 'g++ -Wall -M -I../../include -g mm_utils.C | sed '\''s/mm_utils.o/& mm_utils.d/g'\'' > mm_utils.d'
/bin/sh -ec 'g++ -Wall -M -I../../include -g mm.C | sed '\''s/mm.o/& mm.d/g'\'' > mm.d'
g++ -Wall -I../../include -g -c -o mm.o mm.C
ar rv libiostream.a mm.o
a - mm.o
g++ -Wall -I../../include -g -c -o mm_utils.o mm_utils.C
ar rv libiostream.a mm_utils.o
a - mm_utils.o
[laura@duckabush src]$ cd ..
[laura@duckabush lib]$ gmake
cp src/libiostream.a libiostream.a
ranlib libiostream.a
[laura@duckabush lib]$ cd ../..

- r.terraflow has to be compiled either with -DELEV_SHORT, or with
-DELEV_FLOAT. In the first case, PGM=r.terraflow; in the latter,
PGM=r.terraflow.float. Right now the Gmakefile builds by default
r.terraflow. If you want to build r.terraflow.float you have to
modify the Gmakefile. I guess i should be able to build both r.terraflow
and r.terraflow.float with the same Gmakefile, I just dont know how.

You can download the package from
http://www.cs.duke.edu/~laura/TALKS/r.terraflow.tar.gz

Please take a look and tell me if you have any suggestions.

thanks,
-Laura

just a note for those who do not know what terraflow does - it computes flowaccumulation
map for massive DEMs - to give you an idea about its capabilities, it computes flow accumulation
map for rasters with thousands or rows and columns within few hours, while r.watershed
gets stuck on them for weeks and some commercial packages simply refuse to compute such big grids at all.
Given the increasing amount of massive data available from IFSARE, LIDAR and other sources,
such tools can become invaluable. It also has D8 and MFD options and other good stuff and
some more enhancements are planned too.
We just need some help to decide how to handle this type of non-standard code with unique capabilities -
so far we discussed handling it as contrib code as we did for SG3d..

thank you for any comments,

helena

Markus Neteler wrote:

Hi Laura,
dear developers,

developers: Laura asked me to forward her mail.
Please cc her answer also to her!

Markus

On Wed, Nov 20, 2002 at 04:36:28PM -0500, Laura I. Toma wrote:
> Hi Markus,
>
> Helena told me I should talk to you about submitting r.terraflow. I went
> through the submission instructions. Below are some points where I
> had troubles or could not conform to the suggestions:
>
> - a big part of the code is in C++ and uses templates. converting it to C
> is a long tedious job, so I hope it is acceptable as is..
>
> - cannot use GRASS malloc functions, because r.terraflow has its own
> memory manager. basically it overloads new and delete to keep track of how
> much memory is in use.
>
> - r.terraflow uses a library libiostream.a that resides in the IOSTREAM
> directory inside r.terraflow. This library contains the memory
> manager and the basic I/O-efficient stream routines, like sorting,
> priority queues and so on. This library has to be built
> separately, before calling gmake5 (I did not know how to handle
> this inside Gmakefile).
>
> [laura@duckabush r.terraflow]$ cd IOStream/lib/src/
> [laura@duckabush src]$ gmake
> /bin/sh -ec 'g++ -Wall -M -I../../include -g mm_utils.C | sed '\''s/mm_utils.o/& mm_utils.d/g'\'' > mm_utils.d'
> /bin/sh -ec 'g++ -Wall -M -I../../include -g mm.C | sed '\''s/mm.o/& mm.d/g'\'' > mm.d'
> g++ -Wall -I../../include -g -c -o mm.o mm.C
> ar rv libiostream.a mm.o
> a - mm.o
> g++ -Wall -I../../include -g -c -o mm_utils.o mm_utils.C
> ar rv libiostream.a mm_utils.o
> a - mm_utils.o
> [laura@duckabush src]$ cd ..
> [laura@duckabush lib]$ gmake
> cp src/libiostream.a libiostream.a
> ranlib libiostream.a
> [laura@duckabush lib]$ cd ../..
>
> - r.terraflow has to be compiled either with -DELEV_SHORT, or with
> -DELEV_FLOAT. In the first case, PGM=r.terraflow; in the latter,
> PGM=r.terraflow.float. Right now the Gmakefile builds by default
> r.terraflow. If you want to build r.terraflow.float you have to
> modify the Gmakefile. I guess i should be able to build both r.terraflow
> and r.terraflow.float with the same Gmakefile, I just dont know how.
>
>
> You can download the package from
> http://www.cs.duke.edu/~laura/TALKS/r.terraflow.tar.gz
>
> Please take a look and tell me if you have any suggestions.
>
>
> thanks,
> -Laura

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5