/* This is part of the netCDF package. Copyright 2018 University Corporation for Atmospheric Research/Unidata See COPYRIGHT file for conditions of use. Test HDF5 alignment Dennis Heimbigner */ #include #include "err_macros.h" #include #include #undef DEBUG #define THRESHOLD 512 #define ALIGNMENT 4096 #define CHUNKSIZE 513 int main(int argc, char **argv) { int i,ncid, varid, dimids[1]; size_t chunks[1]; unsigned char data[CHUNKSIZE]; hid_t fileid, grpid, datasetid; hid_t dxpl_id = H5P_DEFAULT; /*data transfer property list */ unsigned int filter_mask = 0; hsize_t hoffset[1]; haddr_t addr; hsize_t size ; hid_t fspace; H5Eset_auto2(H5E_DEFAULT,(H5E_auto2_t)H5Eprint1,stderr); printf("\n*** Testing HDF5 alignment.\n"); printf("chunksize=%d threshold=%d alignment=%d\n",CHUNKSIZE,THRESHOLD,ALIGNMENT); if(nc_set_alignment(THRESHOLD,ALIGNMENT)) ERR; if (nc_create("tst_alignment.nc", NC_NETCDF4, &ncid)) ERR; if (nc_def_dim(ncid, "d0", CHUNKSIZE, &dimids[0])) ERR; if (nc_def_var(ncid, "var", NC_UBYTE, 1, dimids, &varid)) ERR; chunks[0] = CHUNKSIZE; if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, chunks)) ERR; if (nc_enddef(ncid)) ERR; for(i=0;i