GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
tileread.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <grass/raster.h>
#include "raster3d_intern.h"
Include dependency graph for tileread.c:

Go to the source code of this file.

Functions

int Rast3d_read_tile (RASTER3D_Map *map, int tileIndex, void *tile, int type)
 Reads tile with index tileIndex into the tile buffer. The cells are stored with type type which must be one of FCELL_TYPE and DCELL_TYPE. If the tile with tileIndex is not stored on the file corresponding to map, and tileIndex is a valid index tile is filled with NULL-values. More...
 
int Rast3d_read_tile_float (RASTER3D_Map *map, int tileIndex, void *tile)
 Is equivalent to Rast3d_read_tile (map, tileIndex, tile, FCELL_TYPE). More...
 
int Rast3d_read_tile_double (RASTER3D_Map *map, int tileIndex, void *tile)
 Is equivalent to Rast3d_read_tile (map, tileIndex, tile, DCELL_TYPE). More...
 
int Rast3d_lock_tile (RASTER3D_Map *map, int tileIndex)
 Locks tile with tileIndex in cache. If after locking fewer than the minimum number of unlocked tiles are unlocked, the lock request is ignored. More...
 
int Rast3d_unlock_tile (RASTER3D_Map *map, int tileIndex)
 Unlocks tile with tileIndex. More...
 
int Rast3d_unlock_all (RASTER3D_Map *map)
 Unlocks every tile in cache of map. More...
 
void Rast3d_autolock_on (RASTER3D_Map *map)
 Turns autolock mode on. More...
 
void Rast3d_autolock_off (RASTER3D_Map *map)
 Turns autolock mode Off. More...
 
void Rast3d_min_unlocked (RASTER3D_Map *map, int minUnlocked)
 Sets the minimum number of unlocked tiles to minUnlocked. This function should be used in combination with Rast3d_unlock_all () in order to avoid situations where the new minimum is larger than the actual number of unlocked tiles. minUnlocked must be one of RASTER3D_USE_CACHE_X, RASTER3D_USE_CACHE_Y, RASTER3D_USE_CACHE_Z, RASTER3D_USE_CACHE_XY, RASTER3D_USE_CACHE_XZ, RASTER3D_USE_CACHE_YZ, RASTER3D_USE_CACHE_XYZ, the result of Rast3d_cache_size_encode() (cf.{g3d:G3d.cacheSizeEncode}), or any positive integer which explicitly specifies the number of tiles. More...
 
int Rast3d_begin_cycle (RASTER3D_Map *map)
 Starts a new cycle. More...
 
int Rast3d_end_cycle (RASTER3D_Map *map)
 Ends a cycle. More...
 

Function Documentation

◆ Rast3d_autolock_off()

void Rast3d_autolock_off ( RASTER3D_Map map)

Turns autolock mode Off.

Parameters
map
Returns
void

Definition at line 357 of file tileread.c.

References RASTER3D_Map::cache, Rast3d_cache_autolock_off(), Rast3d_fatal_error(), and RASTER3D_Map::useCache.

Referenced by Rast3d_end_cycle().

◆ Rast3d_autolock_on()

void Rast3d_autolock_on ( RASTER3D_Map map)

Turns autolock mode on.

Parameters
map
Returns
void

Definition at line 337 of file tileread.c.

References RASTER3D_Map::cache, Rast3d_cache_autolock_on(), Rast3d_fatal_error(), and RASTER3D_Map::useCache.

Referenced by Rast3d_begin_cycle().

◆ Rast3d_begin_cycle()

int Rast3d_begin_cycle ( RASTER3D_Map map)

Starts a new cycle.

Parameters
map
Returns
1 ... if successful, 0 ... otherwise.

Definition at line 408 of file tileread.c.

References Rast3d_autolock_on(), Rast3d_fatal_error(), and Rast3d_unlock_all().

◆ Rast3d_end_cycle()

int Rast3d_end_cycle ( RASTER3D_Map map)

Ends a cycle.

Parameters
map
Returns
1 ... if successful, 0 ... otherwise.

Definition at line 432 of file tileread.c.

References Rast3d_autolock_off().

◆ Rast3d_lock_tile()

int Rast3d_lock_tile ( RASTER3D_Map map,
int  tileIndex 
)

Locks tile with tileIndex in cache. If after locking fewer than the minimum number of unlocked tiles are unlocked, the lock request is ignored.

Parameters
map
tileIndex
Returns
1 ... if successful, -1 ... if request is ignored, 0 ... otherwise.

Definition at line 259 of file tileread.c.

References RASTER3D_Map::cache, Rast3d_cache_lock(), Rast3d_error(), Rast3d_fatal_error(), and RASTER3D_Map::useCache.

◆ Rast3d_min_unlocked()

void Rast3d_min_unlocked ( RASTER3D_Map map,
int  minUnlocked 
)

Sets the minimum number of unlocked tiles to minUnlocked. This function should be used in combination with Rast3d_unlock_all () in order to avoid situations where the new minimum is larger than the actual number of unlocked tiles. minUnlocked must be one of RASTER3D_USE_CACHE_X, RASTER3D_USE_CACHE_Y, RASTER3D_USE_CACHE_Z, RASTER3D_USE_CACHE_XY, RASTER3D_USE_CACHE_XZ, RASTER3D_USE_CACHE_YZ, RASTER3D_USE_CACHE_XYZ, the result of Rast3d_cache_size_encode() (cf.{g3d:G3d.cacheSizeEncode}), or any positive integer which explicitly specifies the number of tiles.

Parameters
map
minUnlocked
Returns
void

Definition at line 386 of file tileread.c.

References RASTER3D_Map::cache, Rast3d__compute_cache_size(), Rast3d_cache_set_min_unlock(), Rast3d_fatal_error(), and RASTER3D_Map::useCache.

◆ Rast3d_read_tile()

int Rast3d_read_tile ( RASTER3D_Map map,
int  tileIndex,
void *  tile,
int  type 
)

Reads tile with index tileIndex into the tile buffer. The cells are stored with type type which must be one of FCELL_TYPE and DCELL_TYPE. If the tile with tileIndex is not stored on the file corresponding to map, and tileIndex is a valid index tile is filled with NULL-values.

Parameters
map
tileIndex
tile
type
Returns
1 ... if successful, 0 ... otherwise

Definition at line 145 of file tileread.c.

References RASTER3D_Map::compression, RASTER3D_Map::data_fd, RASTER3D_Map::index, RASTER3D_Map::nTiles, Rast3d_compute_clipped_tile_dimensions(), Rast3d_error(), Rast3d_fatal_error(), Rast3d_set_null_tile_type(), and RASTER3D_NO_COMPRESSION.

Referenced by Rast3d_get_tile_ptr(), Rast3d_read_tile_double(), and Rast3d_read_tile_float().

◆ Rast3d_read_tile_double()

int Rast3d_read_tile_double ( RASTER3D_Map map,
int  tileIndex,
void *  tile 
)

Is equivalent to Rast3d_read_tile (map, tileIndex, tile, DCELL_TYPE).

Parameters
map
tileIndex
tile
Returns
int

Definition at line 229 of file tileread.c.

References DCELL_TYPE, Rast3d_error(), and Rast3d_read_tile().

◆ Rast3d_read_tile_float()

int Rast3d_read_tile_float ( RASTER3D_Map map,
int  tileIndex,
void *  tile 
)

Is equivalent to Rast3d_read_tile (map, tileIndex, tile, FCELL_TYPE).

Parameters
map
tileIndex
tile
Returns
int

Definition at line 205 of file tileread.c.

References FCELL_TYPE, Rast3d_error(), and Rast3d_read_tile().

◆ Rast3d_unlock_all()

int Rast3d_unlock_all ( RASTER3D_Map map)

Unlocks every tile in cache of map.

Parameters
map
Returns
1 ... if successful, 0 ... otherwise.

Definition at line 312 of file tileread.c.

References RASTER3D_Map::cache, Rast3d_cache_unlock_all(), Rast3d_error(), Rast3d_fatal_error(), and RASTER3D_Map::useCache.

Referenced by Rast3d_begin_cycle().

◆ Rast3d_unlock_tile()

int Rast3d_unlock_tile ( RASTER3D_Map map,
int  tileIndex 
)

Unlocks tile with tileIndex.

Parameters
map
tileIndex
Returns
1 ... if successful, 0 ... otherwise.

Definition at line 286 of file tileread.c.

References RASTER3D_Map::cache, Rast3d_cache_unlock(), Rast3d_error(), Rast3d_fatal_error(), and RASTER3D_Map::useCache.