[GRASS-dev] G_put_raster_row and OpenMP

Glynn Clements glynn at gclements.plus.com
Tue Dec 4 06:12:52 EST 2007


[Please keep discussions on the mailing list.]

Yann wrote:

> > > > This has several consequences: the map is stored uncompressed, it
> > > > cannot contain nulls, and it cannot be floating-point (essentially,
> > > > when FP and null values were added in 5.x, the random-access case
> > > > wasn't upgraded).
> > > >
> > > > Neither of these factors would be particularly hard to change.
> > >
> > > Could you direct me a bit on changing those?
> >
> > Mostly you just need to check that put_row.c allows for all of the
> > cases.
> 
> 
> int G_put_fp_map_row_random(int fd, const void *buf, int row, int col, int 
> n,RASTER_MAP_TYPE data_type)

I suggest a generic G_put_raster_row_random() which works with any
data type.

Also, as a matter of convention, functions _raster_ raster in their
names correspond to the new raster API (which supports FP and null),
while those which use _map_ correspond to the old API (integer only,
zero is null).

> {
>     struct fileinfo *fcb = &G__.fileinfo[fd];
>     if (!check_open("G_put_fp_map_row_random", fd, 1))
>         return -1;
>     buf += adjust(fd, &col, &n);
>     switch (put_fp_data(fd, buf, row, col, n, data_type))
>     {
>     case -1: return -1;
>     case  0: return  1;
>     }
>     G_row_update_range (buf, n, &fcb->range);
>     return 1;
> }
> 
> int static put_fp_data(int fd, const void *rast, int row, int col, int n, 
> RASTER_MAP_TYPE data_type) in line 456 of put_row.c seems to handle 
> uncompressed fcell and dcell.

Note that put_fp_data() only writes the data, not the null bitmap.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list