13 G3d_tile2xdrTile(G3D_Map * map, 
const void *
tile, 
int rows, 
int cols,
 
   14                  int depths, 
int xRedundant, 
int yRedundant, 
int zRedundant,
 
   20         G3d_error(
"G3d_tile2xdrTile: error in G3d_initCopyToXdr");
 
   25     if (nofNum == map->tileSize) {
 
   27             G3d_error(
"G3d_tile2xdrTile: error in G3d_copyToXdr");
 
   34         for (z = 0; z < depths; z++) {
 
   35             for (y = 0; y < rows; y++) {
 
   37                     G3d_error(
"G3d_tile2xdrTile: error in G3d_copyToXdr");
 
   45                                     map->tileX * yRedundant *
 
   52         for (z = 0; z < depths; z++) {
 
   54                 G3d_error(
"G3d_tile2xdrTile: error in G3d_copyToXdr");
 
   63         G3d_error(
"G3d_tile2xdrTile: error in G3d_copyToXdr");
 
   71 static int G3d_writeTileUncompressed(G3D_Map * map, 
int nofNum)
 
   73     if (write(map->data_fd, 
xdr, map->numLengthExtern * nofNum) !=
 
   74         map->numLengthExtern * nofNum) {
 
   75         G3d_error(
"G3d_writeTileUncompressed: can't write file.");
 
   84 static int G3d_writeTileCompressed(G3D_Map * map, 
int nofNum)
 
   88                                    map->useRle, map->useLzw)) {
 
   90             (
"G3d_writeTileCompressed: error in G_fpcompress_writeXdrNums");
 
  130     int rows, 
cols, depths, xRedundant, yRedundant, zRedundant, nofNum;
 
  133     if ((tileIndex >= map->nTiles) || (tileIndex < 0))
 
  137     if (map->index[tileIndex] != -1)
 
  141     map->index[tileIndex] = lseek(map->data_fd, (
long)0, SEEK_END);
 
  142     if (map->index[tileIndex] == -1) {
 
  143         G3d_error(
"G3d_writeTile: can't position file");
 
  148                                               &rows, &cols, &depths,
 
  149                                               &xRedundant, &yRedundant,
 
  153                              xRedundant, yRedundant, zRedundant, nofNum,
 
  156     if (!G3d_tile2xdrTile(map, tile, rows, cols, depths,
 
  157                           xRedundant, yRedundant, zRedundant, nofNum, type)) {
 
  158         G3d_error(
"G3d_writeTileCompressed: error in G3d_tile2xdrTile");
 
  162     if (map->compression == G3D_NO_COMPRESSION) {
 
  163         if (!G3d_writeTileUncompressed(map, nofNum)) {
 
  164             G3d_error(
"G3d_writeTile: error in G3d_writeTileUncompressed");
 
  168     else if (!G3d_writeTileCompressed(map, nofNum)) {
 
  169         G3d_error(
"G3d_writeTile: error in G3d_writeTileCompressed");
 
  174     map->tileLength[tileIndex] = lseek(map->data_fd, (
long)0, SEEK_END) -
 
  175         map->index[tileIndex];
 
  198     if ((status = 
G3d_writeTile(map, tileIndex, tile, FCELL_TYPE)))
 
  201     G3d_error(
"G3d_writeTileFloat: error in G3d_writeTile");
 
  223     if ((status = 
G3d_writeTile(map, tileIndex, tile, DCELL_TYPE)))
 
  226     G3d_error(
"G3d_writeTileDouble: error in G3d_writeTile");
 
  260         G3d_error(
"G3d_flushTile: error in G3d_getTilePtr");
 
  265         G3d_error(
"G3d_flushTile: error in G3d_writeTile");
 
  270         G3d_error(
"G3d_flushTile: error in G3d__removeTile");
 
  280 #define MIN(a,b) (a < b ? a : b) 
  281 #define MAX(a,b) (a > b ? a : b) 
  313             (
"G3d_flushTileCube: function invalid in non-cache mode");
 
  315     for (x = xMin; x <= xMax; x++)
 
  316         for (y = yMin; y <= yMax; y++)
 
  317             for (z = zMin; z <= zMax; z++)
 
  319                     G3d_error(
"G3d_flushTileCube: error in G3d_flushTile");
 
  355     int xTileMin, yTileMin, zTileMin, xTileMax, yTileMax, zTileMax;
 
  356     int xOffs, yOffs, zOffs;
 
  357     int regionMaxX, regionMaxY, regionMaxZ;
 
  361             (
"G3d_flushTilesInCube: function invalid in non-cache mode");
 
  372     if ((xMin < 0) && (xMax < 0))
 
  374     if ((xMin >= regionMaxX) && (xMax >= regionMaxX))
 
  377     xMin = 
MIN(
MAX(0, xMin), regionMaxX - 1);
 
  379     if ((yMin < 0) && (yMax < 0))
 
  381     if ((yMin >= regionMaxY) && (yMax >= regionMaxY))
 
  384     yMin = 
MIN(
MAX(0, yMin), regionMaxY - 1);
 
  386     if ((zMin < 0) && (zMax < 0))
 
  388     if ((zMin >= regionMaxZ) && (zMax >= regionMaxZ))
 
  391     zMin = 
MIN(
MAX(0, zMin), regionMaxZ - 1);
 
  394                         &xTileMin, &yTileMin, &zTileMin,
 
  395                         &xOffs, &yOffs, &zOffs);
 
  405                         &xTileMax, &yTileMax, &zTileMax,
 
  406                         &xOffs, &yOffs, &zOffs);
 
  413                            xTileMax, yTileMax, zTileMax)) {
 
  414         G3d_error(
"G3d_flushTilesInCube: error in G3d_flushTileCube");
 
  461     if (map->typeIntern == DCELL_TYPE) {
 
  463             G3d_error(
"G3d_putFloat: error in G3d_putDouble");
 
  472         G3d_error(
"G3d_putFloat: error in G3d_getTilePtr");
 
  501     if (map->typeIntern == FCELL_TYPE) {
 
  503             G3d_error(
"G3d_putDouble: error in G3d_putFloat");
 
  512         G3d_error(
"G3d_putDouble: error in G3d_getTilePtr");
 
  542     if (type == FCELL_TYPE) {
 
  544             G3d_error(
"G3d_putValue: error in G3d_putFloat");
 
  551         G3d_error(
"G3d_putValue: error in G3d_putDouble");
 
int G3d_flushTilesInCube(G3D_Map *map, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax)
Writes those tiles for which every cell has coordinate contained in the axis-parallel cube defined by...
 
int G3d__removeTile(G3D_Map *map, int tileIndex)
 
int G3d_writeTile(G3D_Map *map, int tileIndex, const void *tile, int type)
Writes tile with index tileIndex to the file corresponding to map. It is assumed that the cells in ti...
 
void G3d_error(const char *msg,...)
 
void * G_incr_void_ptr(const void *ptr, const size_t size)
Advance void pointer. 
 
void * G3d_getTilePtr(G3D_Map *map, int tileIndex)
This function returns a pointer to a tile which contains the data for the tile with index tileIndex...
 
int G3d_copyToXdr(const void *src, int nofNum)
 
int G3d_flushTile(G3D_Map *map, int tileIndex)
Writes the tile with tileIndex to the file corresponding to map and removes the tile from the cache (...
 
int G3d_putDouble()
Is equivalent to G3d_putValue (map, x, y, z, &value, DCELL_TYPE). 
 
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_writeTileDouble(G3D_Map *map, int tileIndex, const void *tile)
Is equivalent to G3d_writeTile (map, tileIndex, tile, DCELL_TYPE). 
 
int G3d_putFloat(G3D_Map *map, int x, int y, int z, float value)
Is equivalent to G3d_putValue (map, x, y, z, &value, FCELL_TYPE). 
 
int G_fpcompress_writeXdrNums(int fd, char *src, int nofNum, int precision, char *compressBuf, int isFloat, int useRle, int useLzw)
 
void G3d_coord2tileCoord(G3D_Map *map, int x, int y, int z, int *xTile, int *yTile, int *zTile, int *xOffs, int *yOffs, int *zOffs)
Converts cell-coordinates (x, y, z) into tile-coordinates (xTile, yTile, zTile) and the coordinate of...
 
int G3d_tile2tileIndex(G3D_Map *map, int xTile, int yTile, int zTile)
Returns tile-index corresponding to tile-coordinates (xTile, yTile, zTile). 
 
void G3d_coord2tileIndex(G3D_Map *map, int x, int y, int z, int *tileIndex, int *offset)
Converts cell-coordinates (x, y, z) into tileIndex and the offset of the cell within the tile...
 
void G3d_fatalError(const char *,...)
This function prints the error message msg, and terminates the program with an error status...
 
void G3d_range_updateFromTile(G3D_Map *map, const void *tile, int rows, int cols, int depths, int xRedundant, int yRedundant, int zRedundant, int nofNum, int type)
 
int G3d_writeTileFloat(G3D_Map *map, int tileIndex, const void *tile)
Is equivalent to G3d_writeTile (map, tileIndex, tile, FCELL_TYPE). 
 
int G3d_putValue(G3D_Map *map, int x, int y, int z, const void *value, int type)
After converting *value of type into the type specified at the initialization time (i...
 
int G3d_flushTileCube(G3D_Map *map, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax)
Writes the tiles with tile-coordinates contained in the axis-parallel cube with vertices (xMin...
 
int G3d_initCopyToXdr(G3D_Map *map, int sType)