[Nexus] Trouble with HDF5 under Nexus3.0

tieman tieman at aps.anl.gov
Thu Nov 30 16:50:30 GMT 2006


Hello all!

I'm trying to update all my Nexus code to Nexus3.0 specifically so I can 
make use of HDF5.  I've been able to get HDF4 and XML to work fine, but 
I get errors whenever I try and create an HDF5 file.

Specifically, the problem appears to be in this portion of the code from 
the routine NX5open:

    /* start HDF5 interface */
    if (am == NXACC_CREATE5) {
       fapl = H5Pcreate(H5P_FILE_ACCESS);
       
iRet=H5Pget_cache(fapl,&mdc_nelmts,&rdcc_nelmts,&rdcc_nbytes,&rdcc_w0);
       rdcc_nbytes=(size_t)nx_cacheSize;
       iRet = H5Pset_cache(fapl,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0);
       /*
     setting the close degree is absolutely necessary in HDF5
         versions > 1.6. If you use a lessere version and the compiler
        complains, comment it out but keep this in mind.
       */
       H5Pset_fclose_degree(fapl,H5F_CLOSE_STRONG);
       am1 = H5F_ACC_TRUNC;
       pNew->iFID = H5Fcreate (filename, am1, H5P_DEFAULT, fapl);
    } else {

H5Pcreate (H5P_FILE_ACCESS) returns -1 which later causes H5Fcreate to 
fail and I get a "cannot open file" error.

If I simply execute the code:

   hid_t       file_id;   /* file identifier */
   herr_t      status;

   /* Create a new file using default properties. */
   file_id = 
H5Fcreate("C:\\Development\\CBuilder2006\\NexusLibraryV5.0\\hdf5_test_file.hdf", 
H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);

   /* Terminate access to the file. */
   status = H5Fclose(file_id);

taken from the HDF5 tutorial, I get an HDF5 file without problem. So I 
believe I'm linked to HDF5 OK.

Any suggestions?  I'm using the same routine to create files for HDF4, 
HDF5 and XML.  HDF4 and XML work fine--just HDF5 fails.  I'm using 
Nexus3.0 and HDF5-1.65.

Thanks in advance for any help!

Brian Tieman
Advanced Photon Source
Argonne National Laboratory


More information about the NeXus mailing list