/*Marcus G Daniels, swarm-support 03/18/2001 

In today's snapshot there is low-level support for extending simple
vector HDF5 datasets.  This feature is useful if you have several data
streams coming out of a simulation and you want to record them and
load them later into R.  Note I haven't merged it with the analysis module --
maybe someone would find that useful and do the work...

  ftp://ftp.swarm.org/pub/swarm/src/testing/swarm-2001-03-18.tar.gz
  ftp://ftp.swarm.org/pub/swarm/binaries/w32/latest

Here's an example of use of the `extensible double vector' methods in
the HDF5 interface.  (Note this isn't object serialization.)*/

/* Incidentally, I think marcus did the suggested work just a day later*/

import swarm.Globals;
import swarm.defobj.HDF5;
import swarm.defobj.HDF5C;
import swarm.defobj.HDF5Impl;
import swarm.defobj.HDF5CImpl;

public class TestHDF5Vectors {
    static void main (String args[]) {
        Globals.env.initSwarm ("TestHDF5Vectors", "0.0", "bug-swarm@swarm.org",
                               args);

        TestHDF5Vectors test = new TestHDF5Vectors ();
        test.createFile ();
    }
    
    TestHDF5Vectors () {
    }

    public void createFile () {
        HDF5CImpl hdf5C = new HDF5CImpl (new HDF5Impl ());
        hdf5C.createBegin (Globals.env.globalZone);
        hdf5C.setWriteFlag (true);
        hdf5C.setName ("test.hdf");
        HDF5 hdf5file = (HDF5) hdf5C.createEnd ();

        hdf5C = new HDF5CImpl (new HDF5Impl ());
        hdf5C.createBegin (Globals.env.globalZone);
        hdf5C.setParent (hdf5file);
        hdf5C.setName ("foo");
        hdf5C.setWriteFlag (true);
        hdf5C.setDatasetFlag (true);
        hdf5C.setExtensibleDoubleVector ();
        HDF5 hdf5dataset = (HDF5) hdf5C.createEnd ();

        for (int i = 0; i < 1024; i++)
            hdf5dataset.addDoubleToVector ((double) i);
        hdf5dataset.drop ();

        hdf5file.drop ();
    }
}


