compress

Synopsis

Compress / uncompress user-chosen arrays in a field.

Input Ports

& data group reference the input field components

Parameters

compress_all int triggers compression of all arrays.
uncompress_all int triggers uncompression of all arrays.
process_nth int triggers compression/uncompression of the nth array.
nth int the array number of the array to process.

Description

Compresses/uncompresses arrays within an AVS/Express field. Any array within the field may be compressed independently - the user chooses an array using an array number to identify which array is to be processed. The array is compressed if it is a normal (i.e. uncompressed) field array. It is uncompressed if it has been previously compressed. Alternatively, all arrays may be compressed, or all arrays may be uncompressed.

Thus, one variable in a large multi-variate data set may be visualised whilst keeping all other variables compressed, or all arrays may be compressed before being subsequently written out to file (e.g. using the write_netCDF module). Note that arrays are compressed at source - a compressed copy of the field is not produced, rather the original arrays within the field are altered to be integer arrays of smaller size. The original types are restored when arrays are uncompressed.

Arrays are numbered starting from 1, and in the following order : grid, node data, cell data and connectivity. Since this module accepts any field or valid field subset, some of these components may be missing in the input data (the only requirement is for the integers nnodes, and nspace to be present, and for the Data_Array coordinates to be present either as an array or a connection to a function). Ordering of arrays within each of these categories is as in the input field. A connectivity array is defined as being the poly_connect_list in a Cell_Set, if it exists, otherwise it is the node_connect_list. The module examine_field may be used to determine which arrays are present in a field, display their sizes and types, and their array numbers.

The macro also includes a ui macro which provides buttons which cause : all arrays to be compressed, all arrays to be uncompressed, or the array number entered into a user editable field to be processed (i.e. it is compressed if it is in an uncompressed state, and is uncompressed if it is in a compressed state).

Input Ports

& data

A reference to the input data, which must be in the form of certain field sub-objects. The following objects must be present in the group : int nnodes, int nspace, Data_Array coordinates. All the other sub-objects of a field are optional. Thus, any valid field or sub-set of a field (e.g. Mesh+Node_Data) will be accepted.

Parameters

compress_all

Invokes the method to compress all arrays when set to non-zero. Is reset to zero after the method has finished executing.

uncompress_all

Invokes the method to uncompress all arrays when set to non-zero. Is reset to zero after the method has finished executing.

process_nth

Invokes the method to compress or uncompress the nth array when set to non-zero. If the nth array is in an uncompressed state it is compressed, if it is in a compressed state it is uncompressed. Is reset to zero after the method has finished executing.

nth

The array number of the array to process when the process_nth parameter is set to non-zero.

Utility Macros

The user macro compress combines the functional macro Compress with the ui macro Compress_UI, via the use of the common parameter block Compress_Param, to provide a usable macro in the visualization library.

Example

An example application Compress_Eg is provided, which uses the AVS/Express sample data file bluntfin.fld. This data file contains six arrays (one grid plus five node data). Executing compression on any of the arrays can be seen to change the size and type of the array in the field.

Files

iac_proj/Compress/compmacs.v
contains the V definitions for the functional macro Compress, the user macro compress, the ui macro Compress_UI and the example application Compress_Eg.

iac_proj/Compress/compmods.v
contains the V definitions for the Compress_Param group and the Compress_Prim module.

iac_proj/Compress/compress.cxx
contains source code for the primitive module.

iac_proj/Compress/deflate.c and iac_proj/Compress/deflate.h
contain source code for functions that access the compression library.

iac_proj/Compress/INSTALL
contains instructions on how to add Compress project modules and macros to the IAC library structure.

iac_proj/Compress/README
contains instructions on how to compile and install Compress project modules and macros.

Additional files are required for the compression library, and for AVS/Express utility functions (see below).

Other Notes

This module uses the general-purpose compression library Zlib. The source for this library may be obtained from http://www.cdrom.com/pub/infozip/zlib. The instructions given with the source should be followed to produce a linkable library. The link_files attribute for Compress_Prim should be altered to indicate the location of this library, so the line link_files = "-L/usr/local/lib -lz", in the file iac_proj/Compress/Compmods.v should have the path /usr/local/lib altered (if necessary) to point to the location of the library.

The Zlib public-domain compression library uses a combination of the Huffman and LZ77 compression algorithms. This algorithm is very similar to that used in the gzip compression tools.

The module also requires the xp_util AVS/Express utility code files. These may be obtained from http://www.iavsc.org/, and need to be installed in the iac_proj directory according to the instructions given with the package.

It is recommended to use this module together with the Examine_Field project examine_field user macro, which inspects a field and provides brief information on the number of arrays, their ordering, names, sizes etc. The Compress_Tool project provides a user macro which combines the compress and examine_field user macros, and produces a single user-interface. Both projects are available from the iavsc module repository.

If both the Examine_Field project and the Compress project are required, then the cxx_src_files line in either the examine_field_mods.v file or the compmods.v file should be removed or commented out (these cxx_src_files are common to both projects, which causes errors/warnings when linking if they are specified twice).

See the README and INSTALL files for full information about compiling and installing the Compress project modules and macros.

Author

Amardeep S Bhattal.
Manchester Visualisation Centre,
Manchester Computing,
University of Manchester,
Oxford Road,
Manchester,
M13 9PL,
UK.

See Also

utils_xp, Compress_Prim, Examine_Field_Prim, examine_field, compress_tool.

Copyright / Disclaimer

This software/documentation was produced as part of the INDEX project (Intelligent Data Extraction) which is funded under contract ESPRIT EP22745 of the European Community. For further details see http://www.man.ac.uk/MVC/research/INDEX/Public/. Copyright (c) June 1998, Manchester Visualisation Centre, UK. All Rights Reserved. Permission to use, copy, modify and distribute this software and its documentation is hereby granted without fee, provided that the above copyright notice and this permission notice appear in all copies of this software / documentation. This software/documentation is provided with no warranty, express or implied, including, without limitation, warrant of merchantability or fitness for a particular purpose.