[][src]Function xdrfile::c_abi::xdrfile::xdrfile_compress_coord_double

pub unsafe extern "C" fn xdrfile_compress_coord_double(
    ptr: *mut c_double,
    ncoord: c_int,
    precision: c_double,
    xfp: *mut XDRFILE
) -> c_int

\brief Compress coordiates in a double array to XDR file

This routine will perform \a lossy compression on the three-dimensional coordinate data data specified and store it in the XDR file. Double will NOT give you any extra precision since the coordinates are compressed. This routine just avoids allocating a temporary array of floats.

The lossy part of the compression consists of multiplying each coordinate with the precision argument and then rounding to integers. We suggest a default value of 1000.0, which means you are guaranteed three decimals of accuracy. The only limitation is that scaled coordinates must still fit in an integer variable, so if the precision is 1000.0 the coordinate magnitudes must be less than +-2e6.

\param ptr Pointer to coordinates to compress (length 3*ncoord) \param ncoord Number of coordinate triplets in data \param precision Scaling factor for lossy compression. If it is <=0, the default value of 1000.0 is used. \param xfp Handle to portably binary file

\return Number of coordinate triplets written. IMPORTANT: Check that this is equal to ncoord - if it is negative, an error occured. This should not happen with normal data, but if your coordinates are NaN or very large (>1e6) it is not possible to use the compression.

\warning The compression algorithm is not part of the XDR standard, and very complicated, so you will need this xdrfile module to read it later.