/* Copyright (C) 2009 Andrew Collette http://h5py.alfven.org License: BSD (see LICENSE.txt) Example program demonstrating use of the LZF filter from C code. To compile this program: h5cc -DH5_USE_16_API lzf/*.c lzf_filter.c example.c -o example To run: $ ./example Success! $ h5ls -v test_lzf.hdf5 Opened "test_lzf.hdf5" with sec2 driver. dset Dataset {100/100, 100/100, 100/100} Location: 0:1:0:976 Links: 1 Modified: 2009-02-15 16:35:11 PST Chunks: {1, 100, 100} 40000 bytes Storage: 4000000 logical bytes, 174288 allocated bytes, 2295.05% utilization Filter-0: shuffle-2 OPT {4} Filter-1: lzf-32000 OPT {1, 261, 40000} Type: native float */ #include #include "hdf5.h" #include "lzf_filter.h" #define SIZE 100*100*100 #define SHAPE {100,100,100} #define CHUNKSHAPE {1,100,100} int main(){ static float data[SIZE]; static float data_out[SIZE]; const hsize_t shape[] = SHAPE; const hsize_t chunkshape[] = CHUNKSHAPE; int r, i; int return_code = 1; hid_t fid, sid, dset, plist = 0; for(i=0; i0) H5Dclose(dset); if(sid>0) H5Sclose(sid); if(plist>0) H5Pclose(plist); if(fid>0) H5Fclose(fid); return return_code; }