summaryrefslogtreecommitdiffstats
path: root/qtools/qtools.pro.in
Commit message (Expand)AuthorAgeFilesLines
* Introduce new optimized string implementation (attempt 2)Dimitri van Heesch2014-10-231-2/+1
* Reverted back to old string implementation. New one needs more work.Dimitri van Heesch2014-10-211-1/+2
* Added faster reference counted string implementation with short string optimi...Dimitri van Heesch2014-10-211-2/+1
* Spitting generated files better from source filesalbert-github2014-01-211-1/+1
* Reduced and improved functionality of QListDimitri van Heesch2013-12-301-1/+1
* Release-1.7.0Dimitri van Heesch2010-06-151-2/+5
* Release-1.6.3-20100603Dimitri van Heesch2010-06-031-4/+18
* Release-1.4.7-20060910Dimitri van Heesch2006-09-101-0/+2
* Doxygen-1.3.9.1-20041206Dimitri van Heesch2004-12-061-1/+2
* Release-1.3.5-20031215Dimitri van Heesch2003-12-151-0/+3
* Release-1.3-rc3-20020215Dimitri van Heesch2003-02-151-1/+1
* Release-1.2.15-20020430Dimitri van Heesch2002-04-301-0/+1
* Release-1.2.9-20010812Dimitri van Heesch2001-08-121-1/+1
* Release-1.2.4-20010121Dimitri van Heesch2001-01-211-0/+1
* Release-1.2.3-20001203Dimitri van Heesch2000-12-031-2/+8
* Release-1.2.2-20001015Dimitri van Heesch2000-10-151-0/+71
href='#n40'>40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by the Board of Trustees of the University of Illinois.         *
 * All rights reserved.                                                      *
 *                                                                           *
 * This file is part of HDF5.  The full HDF5 copyright notice, including     *
 * terms governing use, modification, and redistribution, is contained in    *
 * the files COPYING and Copyright.html.  COPYING can be found at the root   *
 * of the source code distribution tree; Copyright.html can be found at the  *
 * root level of an installed copy of the electronic HDF5 document set and   *
 * is linked from the top-level documents page.  It can also be found at     *
 * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html.  If you do not have     *
 * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */


#ifndef H5REPACK_H__
#define H5REPACK_H__

#include "hdf5.h"
#include "h5trav.h"
#include "h5diff.h"
#include "h5tools.h"

#define H5FOPENERROR "unable to open file"

#define PFORMAT  "%-7s %-7s %-7s\n" /*chunk info, compression info, name*/
#define PFORMAT1 "%-7s %-7s %-7s"     /*chunk info, compression info, name*/

#define MAX_NC_NAME 256 /* max length of a name */
#define MAX_VAR_DIMS 32 /* max per variable dimensions */


/*-------------------------------------------------------------------------
 * data structures for command line options
 *-------------------------------------------------------------------------
 */

/* a list of names */
typedef struct {
 char obj[MAX_NC_NAME]; 
} obj_list_t;

/* 
 the type of filter and additional parameter 
 type can be one of the filters
 H5Z_FILTER_NONE       0,  uncompress if compressed
 H5Z_FILTER_DEFLATE	   1 , deflation like gzip	   
 H5Z_FILTER_SHUFFLE    2 , shuffle the data
 H5Z_FILTER_FLETCHER32 3 , letcher32 checksum of EDC
 H5Z_FILTER_SZIP       4 , szip compression 
*/

#define CDVALUES 2

typedef struct {
 H5Z_filter_t filtn;               /* filter identification number */
 int          cd_values[CDVALUES]; /* filter client data values */
 /* extra input for szip, selects the coding method
    entropy coding method: EC=0 
    nearest neighbor coding method: NN=1 
 */
 int          szip_coding;         
} filter_info_t;

/* chunk lengths along each dimension and rank */
typedef struct {
 hsize_t chunk_lengths[MAX_VAR_DIMS]; 
 int     rank;
} chunk_info_t;

/* we currently define a maximum value for the filters array,
   that corresponds to the current library filters */
#define H5_REPACK_MAX_NFILTERS 4

/* information for one object, contains PATH, CHUNK info and FILTER info */
typedef struct {
 char          path[MAX_NC_NAME];               /* name of object */
 filter_info_t filter[H5_REPACK_MAX_NFILTERS];  /* filter array */
 int           nfilters;                        /* current number of filters */
 H5D_layout_t  layout;                          /* layout information */
 chunk_info_t  chunk;                           /* chunk information */
 hid_t         refobj_id;                       /* object ID, references */
} pack_info_t;

/* store a table of all objects */
typedef struct {
 int         size;
 int         nelems;
 pack_info_t *objs;
} pack_opttbl_t;


/*-------------------------------------------------------------------------
 * command line options
 *-------------------------------------------------------------------------
 */

/* all the above, ready to go to the hrepack call */
typedef struct {
 pack_opttbl_t   *op_tbl;     /*table with all -c and -f options */
 int             all_layout;  /*apply the layout to all objects */
 int             all_filter;  /*apply the filter to all objects */
 filter_info_t   filter_g;    /*global filter INFO for the ALL case */
 chunk_info_t    chunk_g;     /*global chunk INFO for the ALL case */
 H5D_layout_t    layout_g;    /*global layout information for the ALL case */
 int verbose;                 /*verbose mode */
 hsize_t threshold;               /*minimum size to compress, in bytes */
} pack_opt_t;



/*-------------------------------------------------------------------------
 * public functions
 *-------------------------------------------------------------------------
 */

#ifdef __cplusplus
extern "C" {
#endif

int h5repack           (const char* infile, const char* outfile, pack_opt_t *options);
int h5repack_addfilter (const char* str, pack_opt_t *options);
int h5repack_addlayout (const char* str, pack_opt_t *options);
int h5repack_init      (pack_opt_t *options, int verbose);
int h5repack_end       (pack_opt_t *options);
int h5repack_verify    (const char *fname,pack_opt_t *options);
int h5repack_cmpdcpl   (const char *fname1,
                        const char *fname2);


#ifdef __cplusplus
}
#endif



/*-------------------------------------------------------------------------
 * private functions
 *-------------------------------------------------------------------------
 */


int check_objects(const char* fname, 
                  pack_opt_t *options);

int copy_objects(const char* fnamein, 
                 const char* fnameout,
                 pack_opt_t *options);

void print_objlist(const char *filename, 
                   int nobjects, 
                   trav_info_t *travi );

int do_copy_objects(hid_t fidin, 
                    hid_t fidout, 
                    trav_table_t *travt,
                    pack_opt_t *options);

int copy_attr(hid_t loc_in, 
              hid_t loc_out, 
              pack_opt_t *options
              );

int do_copy_refobjs(hid_t fidin, 
                    hid_t fidout, 
                    trav_table_t *travt,
                    pack_opt_t *options); /* repack options */



void read_info(const char *filename,pack_opt_t *options);
void init_packobject(pack_info_t *obj);
int print_filters(hid_t dcpl_id);



/*-------------------------------------------------------------------------
 * filters
 *-------------------------------------------------------------------------
 */

int filter_this(const char* name,
                pack_opt_t *options,
                pack_info_t *pack); /* info about object to filter */

int apply_filters(const char* name,    /* object name from traverse list */
                  int rank,            /* rank of dataset */
                  hsize_t *dims,       /* dimensions of dataset */
                  hid_t dcpl_id,       /* dataset creation property list */
                  hid_t type_id,       /* datatype */
                  pack_opt_t *options, /* repack options */
                  pack_info_t *obj);   /* info about object to filter */

int has_filter(hid_t dcpl_id,
               H5Z_filter_t filtnin);


int can_read(const char* name,    /* object name from traverse list */
             hid_t dcpl_id,       /* dataset creation property list */
             pack_opt_t *options); /* repack options */


/*-------------------------------------------------------------------------
 * layout functions
 *-------------------------------------------------------------------------
 */

int has_layout(hid_t dcpl_id,
               pack_info_t *obj);

int layout_this(hid_t dcpl_id,             /* DCPL from input object */
                const char* name,          /* object name from traverse list */
                pack_opt_t *options,       /* repack options */
                pack_info_t *pack /*OUT*/) /* object to apply layout */;

int apply_layout(hid_t dcpl_id,
                 pack_info_t *pack);  /* info about object  */


/*-------------------------------------------------------------------------
 * options table
 *-------------------------------------------------------------------------
 */
int          options_table_init( pack_opttbl_t **tbl );
int          options_table_free( pack_opttbl_t *table );
int          options_add_layout( obj_list_t *obj_list,
                                 int n_objs,
                                 pack_info_t *pack,
                                 pack_opttbl_t *table );
int          options_add_filter ( obj_list_t *obj_list,
                                 int n_objs,
                                 filter_info_t filt,
                                 pack_opttbl_t *table );
pack_info_t* options_get_object( const char *path,
                                 pack_opttbl_t *table);

/*-------------------------------------------------------------------------
 * parse functions
 *-------------------------------------------------------------------------
 */

obj_list_t* parse_filter(const char *str, 
                         int *n_objs, 
                         filter_info_t *filt,
                         pack_opt_t *options);

obj_list_t* parse_layout(const char *str, 
                         int *n_objs, 
                         pack_info_t *pack,    /* info about object */
                         pack_opt_t *options);

const char* get_sfilter (H5Z_filter_t filtn);
int         parse_number(char *str);

/*-------------------------------------------------------------------------
 * tests
 *-------------------------------------------------------------------------
 */

#define FNAME0     "test0.h5"
#define FNAME0OUT  "test0.out.h5"
#define FNAME1     "test1.h5"
#define FNAME1OUT  "test1.out.h5"
#define FNAME2     "test2.h5"
#define FNAME2OUT  "test2.out.h5"
#define FNAME3     "test3.h5"
#define FNAME3OUT  "test3.out.h5"
#define FNAME4     "test4.h5"
#define FNAME4OUT  "test4.out.h5"
#define FNAME5     "test5.h5"
#define FNAME5OUT  "test5.out.h5"
#define FNAME6     "test6.h5"
#define FNAME7     "test_szip.h5"
#define FNAME8     "test_deflate.h5"
#define FNAME9     "test_shuffle.h5"
#define FNAME10    "test_fletcher32.h5"
#define FNAME11    "test_all.h5"
#define FNAME7OUT     "test_szip.out.h5"
#define FNAME8OUT     "test_deflate.out.h5"
#define FNAME9OUT     "test_shuffle.out.h5"
#define FNAME10OUT    "test_fletcher32.out.h5"
#define FNAME11OUT    "test_all.out.h5"

int make_testfiles(void);

int write_dset( hid_t loc_id, 
                int rank, 
                hsize_t *dims, 
                const char *dset_name,
                hid_t type_id, 
                void *buf );
int write_attr(hid_t loc_id, 
               int rank, 
               hsize_t *dims, 
               const char *attr_name,
               hid_t type_id, 
               void *buf);
void write_attr_in(hid_t loc_id, 
                   const char* dset_name, /* for saving reference to dataset*/
                   hid_t fid, /* for reference create */
                   int make_diffs /* flag to modify data buffers */);
void write_dset_in(hid_t loc_id, 
                   const char* dset_name, /* for saving reference to dataset*/
                   hid_t file_id,
                   int make_diffs /* flag to modify data buffers */);



/*-------------------------------------------------------------------------
 * tests utils
 *-------------------------------------------------------------------------
 */
int make_dset(hid_t loc_id,
              const char *name,
              hid_t sid, 
              hid_t dcpl,
              void *buf);

int make_attr(hid_t loc_id, 
               int rank, 
               hsize_t *dims, 
               const char *attr_name,
               hid_t type_id, 
               void *buf);




#endif  /* H5REPACK_H__ */