10 G3d_xdrTile2tile(G3D_Map * map,
void *
tile,
int rows,
int cols,
int depths,
11 int xRedundant,
int yRedundant,
int zRedundant,
int nofNum,
14 int y, z, xLength, yLength, length;
17 G3d_error(
"G3d_xdrTile2tile: error in G3d_initCopyFromXdr");
21 if (nofNum == map->tileSize) {
23 G3d_error(
"G3d_xdrTile2tile: error in G3d_copyFromXdr");
30 xLength = xRedundant * length;
31 yLength = map->tileX * yRedundant * length;
34 for (z = 0; z < depths; z++) {
35 for (y = 0; y < rows; y++) {
37 G3d_error(
"G3d_xdrTile2tile: error in G3d_copyFromXdr");
57 for (z = 0; z < depths; z++) {
59 G3d_error(
"G3d_xdrTile2tile: error in G3d_copyFromXdr");
74 G3d_error(
"G3d_xdrTile2tile: error in G3d_copyFromXdr");
89 static int G3d_readTileUncompressed(G3D_Map * map,
int tileIndex,
int nofNum)
93 nofBytes = nofNum * map->numLengthExtern;
94 nofBytes =
G3D_MIN(nofBytes, map->fileEndPtr - map->index[tileIndex]);
96 if (read(map->data_fd,
xdr, nofBytes) != nofBytes) {
97 G3d_error(
"G3d_readTileUncompressed: can't read file");
106 static int G3d_readTileCompressed(G3D_Map * map,
int tileIndex,
int nofNum)
109 map->tileLength[tileIndex],
111 map->type == FCELL_TYPE)) {
113 (
"G3d_readTileCompressed: error in G_fpcompress_readXdrNums");
147 int nofNum, rows,
cols, depths, xRedundant, yRedundant, zRedundant;
149 if ((tileIndex >= map->nTiles) || (tileIndex < 0))
152 if (map->index[tileIndex] == -1) {
158 &rows, &cols, &depths,
159 &xRedundant, &yRedundant,
162 if (lseek(map->data_fd, map->index[tileIndex], SEEK_SET) == -1) {
163 G3d_error(
"G3d_readTile: can't position file");
167 if (map->compression == G3D_NO_COMPRESSION) {
168 if (!G3d_readTileUncompressed(map, tileIndex, nofNum)) {
169 G3d_error(
"G3d_readTile: error in G3d_readTileUncompressed");
173 else if (!G3d_readTileCompressed(map, tileIndex, nofNum)) {
174 G3d_error(
"G3d_readTile: error in G3d_readTileCompressed");
178 if (!G3d_xdrTile2tile(map, tile, rows, cols, depths,
179 xRedundant, yRedundant, zRedundant, nofNum, type)) {
180 G3d_error(
"G3d_readTile: error in G3d_xdrTile2tile");
208 G3d_error(
"G3d_readTileFloat: error in G3d_readTile");
232 G3d_error(
"G3d_readTileDouble: error in G3d_readTile");
262 G3d_fatalError(
"G3d_lockTile: function invalid in non-cache mode");
265 G3d_error(
"G3d_lockTile: error in G3d_cache_lock");
289 G3d_fatalError(
"G3d_unlockTile: function invalid in non-cache mode");
292 G3d_error(
"G3d_unlockTile: error in G3d_cache_unlock");
315 G3d_fatalError(
"G3d_unlockAll: function invalid in non-cache mode");
318 G3d_error(
"G3d_unlockAll: error in G3d_cache_unlock_all");
340 G3d_fatalError(
"G3d_autoLockOn: function invalid in non-cache mode");
360 G3d_fatalError(
"G3d_autoLockOff: function invalid in non-cache mode");
389 G3d_fatalError(
"G3d_autoLockOff: function invalid in non-cache mode");
int G_fpcompress_readXdrNums(int fd, char *dst, int nofNum, int fileBytes, int precision, char *compressBuf, int isFloat)
int G3d_readTileFloat(G3D_Map *map, int tileIndex, void *tile)
Is equivalent to G3d_readTile (map, tileIndex, tile, FCELL_TYPE).
void G3d_setNullValue(void *c, int nofElts, int type)
Fills the vector pointed to by c with nofElts NULL-values of type.
void G3d_error(const char *msg,...)
void G3d_autolockOff(G3D_Map *map)
Turns autolock mode Off.
int G3d_cache_unlock(G3D_cache *c, int name)
void G3d_cache_autolock_off(G3D_cache *c)
void * G_incr_void_ptr(const void *ptr, const size_t size)
Advance void pointer.
void G3d_cache_set_minUnlock(G3D_cache *c, int nofMinUnLocked)
void G3d_cache_autolock_on(G3D_cache *c)
int G3d_copyFromXdr(int nofNum, void *dst)
int G3d_initCopyFromXdr(G3D_Map *map, int dType)
int G3d_readTileDouble(G3D_Map *map, int tileIndex, void *tile)
Is equivalent to G3d_readTile (map, tileIndex, tile, DCELL_TYPE).
int G3d_maskIsOff(G3D_Map *map)
Returns 1 if the mask for map is turned off. Returns 0 otherwise.
int G3d_cache_lock(G3D_cache *c, int name)
int G3d_cache_unlock_all(G3D_cache *c)
int G3d_endCycle(G3D_Map *map)
Ends a cycle.
int G3d_unlockAll(G3D_Map *map)
Unlocks every tile in cache of map.
int G3d_computeClippedTileDimensions(G3D_Map *map, int tileIndex, int *rows, int *cols, int *depths, int *xRedundant, int *yRedundant, int *zRedundant)
Computes the dimensions of the tile when clipped to fit the region of map. The clipped dimensions are...
int G3d_beginCycle(G3D_Map *map)
Starts a new cycle.
void G3d_minUnlocked(G3D_Map *map, int minUnlocked)
Sets the minimum number of unlocked tiles to minUnlocked. This function should be used in combination...
void G3d_setNullTileType(G3D_Map *map, void *tile, int type)
Assumes that tile is a tile with the same dimensions as the tiles of map. Fills tile with NULL-values...
int G3d_unlockTile(G3D_Map *map, int tileIndex)
Unlocks tile with tileIndex.
void G3d_autolockOn(G3D_Map *map)
Turns autolock mode on.
int G3d_readTile(G3D_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 ...
void G3d_fatalError(const char *,...)
This function prints the error message msg, and terminates the program with an error status...
int G3d_lockTile(G3D_Map *map, int tileIndex)
Locks tile with tileIndex in cache. If after locking fewer than the minimum number of unlocked tiles ...
void G3d_maskTile(G3D_Map *map, int tileIndex, void *tile, int type)
Replaces the values stored in tile (with tileIndex) for which G3d_isMasked returns 1 with NULL-values...