[GRASS-dev] uploaded r.terracost to GRASS Addons

Laura Toma ltoma at bowdoin.edu
Wed Apr 8 14:31:45 EDT 2009


Andy,

Thanks  for looking at this. I am downloading  the grass-trunk right  
now, and I'll be able to compile shortly.

-Laura

On Apr 8, 2009, at 2:16 PM, Andrew Danner wrote:

> Markus Neteler wrote:
>> On Thu, Apr 2, 2009 at 7:08 PM, Laura Toma <ltoma at bowdoin.edu> wrote:
>>> If you're looking for a fast version of r.cost, try  
>>> r.terracost.    I think
>>> I put it at some point in the add-ons repository. Otherwise it's  
>>> available
>>> from my website.  Depending on the amount  of memory you specify  
>>> on the
>>> command line, it runs in memory (an optimized CPU algorithm)  or  
>>> an I/O
>>> algorithm.
>> I have (upon request from Laura) now uploaded r.terracost to Addons:
>> svn checkout https://svn.osgeo.org/grass/grass-addons/raster/r.terracost
>> r.terracost
>> It is r.terracost-1.1 but with various include file fixes, a new
>> description.html,
>> a new Makefile. Also I didn't not include the IOSTREAM lib as it is  
>> already
>> present in GRASS 6 in the lib/ directory.
>> Compilation:
>> make MODULE_TOPDIR=/path/to/grass6svn/
>> Currently, I get these two errors:
>> iterator.cc: In member function ‘int  
>> Iterator::getNext(ijCostSource*)’:
>> iterator.cc:42: error: no match for ‘operator=’ in ‘* out =
>> ((Iterator*)this)->Iterator::tile- 
>> > 
>> Tile 
>> ::< 
>> anonymous 
>> >.mappedTile<costSourceType>::<anonymous>.genericTile<T>::get
>> [with T = costSourceType](((int)((short
>> int)((Iterator*)this)->Iterator::iMarker)), ((int)((short
>> int)((Iterator*)this)->Iterator::jMarker)))’
>> input.h:160: note: candidates are: ijCostType<costSourceType>&
>> ijCostType<costSourceType>::operator=(const
>> ijCostType<costSourceType>&)
>> make: *** [OBJ.x86_64-unknown-linux-gnu/iterator.o] Error 1
>
> get() returns a costSourceType. You want an
> typedef ijCostType<costSourceType> ijCostSource returned by  
> getComplex (I think)
>
> Index: iterator.cc
> ===================================================================
> --- iterator.cc	(revision 36633)
> +++ iterator.cc	(working copy)
> @@ -39,7 +39,7 @@
>   if (iMarker > tileSizeRows - 1)
>     return 0;
>
> -  *out = tile->get(iMarker, jMarker);
> +  *out = tile->getComplex(iMarker, jMarker);
>
>
>> Makefile:15: warning: overriding commands for target
>> `/home/neteler/grass64/dist.x86_64-unknown-linux-gnu/bin/r.terracost'
>> /home/neteler/grass64//include/Make/Module.make:14: warning: ignoring
>> old commands for target
>> `/home/neteler/grass64/dist.x86_64-unknown-linux-gnu/bin/r.terracost'
>> c++ -I/home/neteler/grass64/dist.x86_64-unknown-linux-gnu/include  -g
>> -O2      -DPACKAGE=\""grassmods"\"
>> -I/home/neteler/grass64/dist.x86_64-unknown-linux-gnu/include -o
>> OBJ.x86_64-unknown-linux-gnu/main.o -c main.cc
>> main.cc: In function ‘void printGrid(AMI_STREAM<ijCostType<float>
>>> *)’:
>> main.cc:432: warning: deprecated conversion from string constant to
>> ‘char*’
>> main.cc: In function ‘int main(int, char**)’:
>> main.cc:976: error: no matching function for call to
>> ‘AMI_sort(AMI_STREAM<distanceType>*&, AMI_STREAM<distanceType>**,
>> distanceIJCompareType*, int&, char*&)’
>> make: *** [OBJ.x86_64-unknown-linux-gnu/main.o] Error 1
>> Fixes appreciated.
>>
>
> There is no matching signature for that kind of AMI_sort. The last  
> two parameters are new and missing in the iostream library. Laura,  
> do you know what these parameters are for and is there an iostream  
> update?
>
> For the const warnings
>
> Index: stats.h
> ===================================================================
> --- stats.h	(revision 36633)
> +++ stats.h	(working copy)
> @@ -28,14 +28,14 @@
>
> #define HAVE_STATS
>
> -int noclobberFile(char *);
> +int noclobberFile(const char *);
>
> class statsRecorder : public ofstream {
> private:
>   Rtimer tm;
>   void *bss;
> public:
> -  statsRecorder(char *fname);
> +  statsRecorder(const char* fname);
>
> Index: stats.cc
> ===================================================================
> --- stats.cc	(revision 36633)
> +++ stats.cc	(working copy)
> @@ -113,7 +113,7 @@
>
>
> int
> -noclobberFile(char *fname) {
> +noclobberFile(char * const fname) {
>   int fd=-1;
>
>   while(fd<0) {
> @@ -162,7 +162,7 @@
>
> /*  
> ********************************************************************** */
>
> -statsRecorder::statsRecorder(char *fname) {
> +statsRecorder::statsRecorder(char * const fname) {
>
>
> for suspiciousness (missing template arguments):
> Index: input.h
> ===================================================================
> --- input.h	(revision 36633)
> +++ input.h	(working copy)
> @@ -194,15 +194,14 @@
>     cout << *this;
>   };
>
> -  friend ostream& operator << (ostream& s, const ijCostType &ct) {
> +  friend ostream& operator << (ostream& s, const ijCostType<T> &ct) {
>     s << "(" << ct.getI() << "," << ct.getJ() << ": " << ct.cs << ")";
>     return s;
>   };
>
> -  friend int operator == (const ijCostType &a, const ijCostType &b) {
> +  friend int operator == (const ijCostType<T> &a, const  
> ijCostType<T> &b) {
>     return (basicIJType(a) == basicIJType(b) && a.cs == b.cs);
>   };
>
>
>> Markus
>> _______________________________________________
>> grass-dev mailing list
>> grass-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-dev
>



More information about the grass-dev mailing list