visad.data.hdf5.hdf5objects
Class HDF5Dataset

java.lang.Object
  extended by visad.data.hdf5.hdf5objects.HDF5Object
      extended by visad.data.hdf5.hdf5objects.HDF5Dataset
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
HDF5Attribute, HDF5DatasetAdapted

public class HDF5Dataset
extends HDF5Object

This class provides a mechanism to describe properties of datasets and to transfer data between memory and disk. A dataset is composed of a collection of raw data points and four classes of meta data to describe the data points.

The four classes of meta data are:

        Constant Meta Data
        Meta data that is created when the dataset is created and exists unchanged
                for the life of the dataset. For instance, the data type of stored array
                elements is defined when the dataset is created and cannot be subsequently
                changed.
        Persistent Meta Data
                Meta data that is an integral and permanent part of a dataset but can
                change over time. For instance, the size in any dimension can increase
                over time if such an increase is allowed when the dataset was created.
        Memory Meta Data
                Meta data that exists to describe how raw data is organized in the
                application's memory space. For instance, the data type of elements in
                an application array might not be the same as the data type of those
                elements as stored in the HDF5 file.
        Transport Meta Data
                Meta data that is used only during the transfer of raw data from one
                location to another. For instance, the number of processes participating
                in a collective I/O request or hints to the library to control caching
                of raw data.
  
For details of the HDF5 libraries, see the HDF5 Documentation at: http://hdf.ncsa.uiuc.edu/HDF5/doc/

See Also:
Serialized Form

Field Summary
protected  long[] count
          the selected subset of the dataset
protected  Object data
          the data array
protected  HDF5Dataspace dataspace
          the dataspace
protected  HDF5Datatype datatype
          the datatype
protected  long[] dims
          the dimensions of the dataset
protected  long[] maxdims
          the maximum dimensions of the dataset
protected  Vector member_names
          a list of member names of compound data
protected  int rank
          the rank of the dataset
 
Fields inherited from class visad.data.hdf5.hdf5objects.HDF5Object
ATTRIBUTE, DATASET, DATASPACE, DATATYPE, description, GROUP, HDF5FILE, id, LINK, name, shortName, type, UNKNOWN
 
Constructor Summary
HDF5Dataset()
          Constructs a HDF5Dataset
HDF5Dataset(int loc_id, String set_name)
          Opens a HDF5Dataset
HDF5Dataset(int loc_id, String set_name, int type_id, int space_id, int create_plist_id)
          Creates a dataset at the specified location
HDF5Dataset(String name)
          Constructs a HDF5Dataset
 
Method Summary
static Object convertUnsignedData(Object data_in)
          convert unsigned data because Java does not support unsigned integers.
protected  void finalize()
          finalize() is called by the garbage collector on the object when garbage collection determines that there are no more references to the object.
 long[] getCount()
          Returns the selected counts of the data
 Object getData()
          Returns the data array
 HDF5Dataspace getDataspace()
          Returns the dataspace
 HDF5Datatype getDatatype()
          Returns the datatype
 long[] getDims()
          Returns the dimensions of the dataset
 long[] getMaxdims()
          Returns the maximum dimensions of the dataspace
 int getRank()
          Returns the rank of the dataset
 void init()
          initialize the HDF5Dataset: open HDF5 library.
 Object readData()
          Read the entire dataset from file
 Object readData(int mspace, int fspace)
          Read the data with specified memory and file space
 String toString()
          Converts this object to a String representation.
 void writeData(int mspace, int fspace, Object buf)
          write the data with specified memory and file space
 void writeData(Object buf)
          write the entire dataset from file
 
Methods inherited from class visad.data.hdf5.hdf5objects.HDF5Object
getDescription, getID, getName, getShortName, getType, setID, setShortName, setType
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected Object data
the data array


datatype

protected HDF5Datatype datatype
the datatype


dataspace

protected HDF5Dataspace dataspace
the dataspace


rank

protected int rank
the rank of the dataset


dims

protected long[] dims
the dimensions of the dataset


maxdims

protected long[] maxdims
the maximum dimensions of the dataset


count

protected long[] count
the selected subset of the dataset


member_names

protected Vector member_names
a list of member names of compound data

Constructor Detail

HDF5Dataset

public HDF5Dataset()
Constructs a HDF5Dataset


HDF5Dataset

public HDF5Dataset(String name)
Constructs a HDF5Dataset


HDF5Dataset

public HDF5Dataset(int loc_id,
                   String set_name,
                   int type_id,
                   int space_id,
                   int create_plist_id)
Creates a dataset at the specified location

Parameters:
loc_id - Identifier of the file or group to create the dataset within.
set_name - The name of the dataset to create.
type_id - Identifier of the datatype to use when creating the dataset.
space_id - Identifier of the dataspace to use when creating the dataset.
create_plist_id - Identifier of the set creation property list.

HDF5Dataset

public HDF5Dataset(int loc_id,
                   String set_name)
Opens a HDF5Dataset

Parameters:
loc_id - A file, group, or datatype identifier.
set_name - A datatset name.
Method Detail

init

public void init()
          throws HDF5Exception
initialize the HDF5Dataset:
  1. open HDF5 library.
  2. Set up datatype and dataspace.
  3. Set up data ranks and dimensions.

Overrides:
init in class HDF5Object
Throws:
HDF5Exception

readData

public Object readData()
                throws HDF5Exception,
                       NullPointerException
Read the entire dataset from file

Returns:
the data array
Throws:
HDF5Exception
NullPointerException

readData

public Object readData(int mspace,
                       int fspace)
                throws HDF5Exception,
                       NullPointerException
Read the data with specified memory and file space

Parameters:
mspace - the memory space id
fspace - the file space id
Returns:
the data array
Throws:
HDF5Exception
NullPointerException

convertUnsignedData

public static Object convertUnsignedData(Object data_in)
                                  throws HDF5Exception
convert unsigned data because Java does not support unsigned integers.

Throws:
HDF5Exception

writeData

public void writeData(Object buf)
               throws HDF5Exception,
                      NullPointerException
write the entire dataset from file

Throws:
HDF5Exception
NullPointerException

writeData

public void writeData(int mspace,
                      int fspace,
                      Object buf)
               throws HDF5Exception,
                      NullPointerException
write the data with specified memory and file space

Throws:
HDF5Exception
NullPointerException

getData

public Object getData()
Returns the data array


getDatatype

public HDF5Datatype getDatatype()
Returns the datatype


getDataspace

public HDF5Dataspace getDataspace()
Returns the dataspace


getRank

public int getRank()
Returns the rank of the dataset


getDims

public long[] getDims()
Returns the dimensions of the dataset


getMaxdims

public long[] getMaxdims()
Returns the maximum dimensions of the dataspace


getCount

public long[] getCount()
Returns the selected counts of the data


toString

public String toString()
Converts this object to a String representation.

Overrides:
toString in class HDF5Object
Returns:
a string representation of this object

finalize

protected void finalize()
                 throws Throwable
finalize() is called by the garbage collector on the object when garbage collection determines that there are no more references to the object. It is used to dispose of system resources or to perform other cleanup as C++ destructors

Overrides:
finalize in class Object
Throws:
Throwable