HDflush

HDF User Support hdfhelp at ncsa.uiuc.edu
Mon Oct 9 17:57:40 BST 2000


Hi Mark,

>   I have a HDF-4.1r3 application where it would be nice to flush the
>   HDF buffers and continue writing to the file later on. Flushing

We do not document that there is a "flush" function in HDF,
because there is not one that is generally usable.  Users have asked
for this in the past and we decided not to provide one.  I don't know
the exact reasons, but there are some issues regarding it that were
not easily resolvable.

-Barbara


+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Barbara Jones, HDF Helpdesk
National Center for Supercomputing Applications
University of Illinois at Urbana-Champaign

hdfhelp at ncsa.uiuc.edu
http://hdf.ncsa.uiuc.edu/
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

  Well, this being as it is, I implemented NXflush with the following
  algorithm:
    - inquire the filename and access mode
    - close the file
    - reopen the file with the same access mode
  This is clumsy and ugly but works. But there are consequences to this:
    - The signature is now NXstatus NXflush(NXhandle *pHandle) because
      a new file handle is allocated.
    - NXflush leaves you at root level in the NeXus file. Is this what we
      want? One could analyze the stack before closing the file, keep a
      copy of the names of all vGroups opened and reopen them again 
      after reopening the file. Any opinions on this?

  The next thing is unlimited dimensions. The first dimension (or the last
  in F77) of a dataset can be 0 or unlimited. I put this in, easy enough.
  When doing test code though I learned that I cannot expand on the 
  unlimited dimension without closing and reopening the file before
  a second write (i.e. use NXflush after the write). To make this a little
  bit clearer I give the algorithm for using unlimited dimensions:

   - open the file
   - create and write first part of dataset.
   - close and reopen file (or NXflush)
   - write second part of dataset.
   - close and reopen file (or NXflush)
   - write third part of dataset 
   ..................
  
  Even the HDF example code is like this. And your program will act VERY
  funny if you do it differently, i.e. have another write without 
  closing and reopening the file. 
   
  Now, this is so far implemented for the C, F77 and F90-API's. But due
  to the limitations stated above I would like to hear opinions before I 
  write this back into the repository. Clearly we would need some 
  documentation effort on both NXflush and unlimited dimension usage in order 
  to ease the pain out of this.

                        Yours,

                             Mark
 





More information about the NeXus-developers mailing list