hdf5/doc/html/RM_H5D.html
Frank Baker ce9b565b18 [svn-r5337]
Purpose:
    New function
Description:
    Added new H5Dfill function (development branch only)
Platforms tested:
    IE 5
2002-05-02 16:28:30 -05:00

1022 lines
37 KiB
HTML

<html>
<head><title>
HDF5/H5D API Specification
</title></head>
<body bgcolor="#FFFFFF">
<hr>
<center>
<table border=0 width=98%>
<tr><td valign=top align=left>
<a href="H5.intro.html">Introduction to HDF5</a>&nbsp;<br>
<a href="H5.user.html">HDF5 User Guide</a>&nbsp;<br>
<a href="index.html">Other HDF5 documents and links</a>&nbsp;<br>
<!--
<a href="Glossary.html">Glossary</a><br>
-->
</td>
<td valign=top align=right>
And in this document, the
<a href="RM_H5Front.html">HDF5 Reference Manual</a>&nbsp;&nbsp;
<br>
<a href="RM_H5.html">H5</a>&nbsp;&nbsp;
<a href="RM_H5A.html">H5A</a>&nbsp;&nbsp;
H5D&nbsp;&nbsp;
<a href="RM_H5E.html">H5E</a>&nbsp;&nbsp;
<a href="RM_H5F.html">H5F</a>&nbsp;&nbsp;
<a href="RM_H5G.html">H5G</a>&nbsp;&nbsp;
<a href="RM_H5I.html">H5I</a>&nbsp;&nbsp;
<a href="RM_H5P.html">H5P</a>&nbsp;&nbsp;
<br>
<a href="RM_H5R.html">H5R</a>&nbsp;&nbsp;
<a href="RM_H5S.html">H5S</a>&nbsp;&nbsp;
<a href="RM_H5T.html">H5T</a>&nbsp;&nbsp;
<a href="RM_H5Z.html">H5Z</a>&nbsp;&nbsp;
<a href="Tools.html">Tools</a>&nbsp;&nbsp;
<a href="PredefDTypes.html">Datatypes</a>&nbsp;&nbsp;
</td></tr>
</table>
</center>
<hr>
<center>
<h1>H5D: Datasets Interface</h1>
</center>
<h2>Dataset Object API Functions</h2>
These functions create and manipulate dataset objects,
and set and retrieve their constant or persistent properties.
<p>
<strong>The C Interfaces:</strong>
<table border=0>
<tr><td valign=top>
<ul>
<li><a href="#Dataset-Create">H5Dcreate</a>
<li><a href="#Dataset-Open">H5Dopen</a>
<li><a href="#Dataset-Close">H5Dclose</a>
<li><a href="#Dataset-GetSpace">H5Dget_space</a>
<li><a href="#Dataset-GetType">H5Dget_type</a>
</ul>
</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td valign=top>
<ul>
<li><a href="#Dataset-GetCreatePlist">H5Dget_create_plist</a>
<li><a href="#Dataset-GetStorageSize">H5Dget_storage_size</a>
<li><a href="#Dataset-VLGetBuf">H5Dvlen_get_buf_size</a>
<li><a href="#Dataset-VLReclaim">H5Dvlen_reclaim</a>
</ul>
</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td valign=top>
<ul>
<li><a href="#Dataset-Read">H5Dread</a>
<li><a href="#Dataset-Write">H5Dwrite</a>
<li><a href="#Dataset-Iterate">H5Diterate</a>
<!--
<li><a href="#Dataset-Debug">H5Ddebug</a>
-->
<li><a href="#Dataset-Extend">H5Dextend</a>
<li><a href="#Dataset-Fill">H5Dfill</a>
</ul>
</td></tr>
</table>
<p>
<strong>The FORTRAN90 Interfaces:</strong>
<br>
<font size=-1>
<i>In general, each FORTRAN90 subroutine performs exactly the same task
as the corresponding C function. The links below go to the C function
descriptions, which serve as general descriptions for both. A button,
under <strong>Non-C API(s)</strong> at the end of the C function description,
opens an external browser window displaying the FORTRAN90-specific
information. You will probably want to adjust the size and location of
this external window so that both browser windows are visible and to
facilitate moving easily between them.</i>
</font>
<table border=0>
<tr><td valign=top>
<ul>
<li><a href="#Dataset-Create">h5dcreate_f</a>
<li><a href="#Dataset-Open">h5dopen_f</a>
<li><a href="#Dataset-Close">h5dclose_f</a>
</ul>
</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td valign=top>
<ul>
<li><a href="#Dataset-GetSpace">h5dget_space_f</a>
<li><a href="#Dataset-GetType">h5dget_type_f</a>
<li><a href="#Dataset-GetCreatePlist">h5dget_create_plist_f</a>
<!--<li><a href="#Dataset-GetStorageSize">h5dget_storage_size_f</a> -->
<!--<li><a href="#Dataset-VLGetBuf">h5dvlen_get_buf_size_f</a> -->
<!--<li><a href="#Dataset-VLReclaim">h5dvlen_reclaim_f</a> -->
</ul>
</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td valign=top>
<ul>
<li><a href="#Dataset-Read">h5dread_f</a>
<li><a href="#Dataset-Write">h5dwrite_f</a>
<!--<li><a href="#Dataset-Iterate">h5diterate_f</a> -->
<!--<li><a href="#Dataset-Debug">h5ddebug_f</a> -->
<li><a href="#Dataset-Extend">h5dextend_f</a>
</ul>
</td></tr>
</table>
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Dataset-Create">H5Dcreate</a>
<dt><strong>Signature:</strong>
<dd><em>hid_t </em><code>H5Dcreate</code>(<em>hid_t </em><code>loc_id</code>,
<em>const char *</em><code>name</code>,
<em>hid_t</em> <code>type_id</code>,
<em>hid_t</em> <code>space_id</code>,
<em>hid_t</em> <code>create_plist_id</code>
)
<dt><strong>Purpose:</strong>
<dd>Creates a dataset at the specified location.
<dt><strong>Description:</strong>
<dd><code>H5Dcreate</code> creates a data set with a name,
<code>name</code>, in the file or in the group specified by
the identifier <code>loc_id</code>.
The dataset has the datatype and dataspace identified by
<code>type_id</code> and <code>space_id</code>, respectively.
The specified datatype and dataspace are the datatype and
dataspace of the dataset as it will exist in the file,
which may be different than in application memory.
Dataset creation properties are specified by the argument
<code>create_plist_id</code>.
<p>
Dataset names within a group are unique:
<code>H5Dcreate</code> will return an error if a dataset with
the name specified in <code>name</code> already exists at the
location specified in <code>loc_id</code>.
<p>
<code>create_plist_id</code> is a <code>H5P_DATASET_CREATE</code>
property list created with <code>H5Pcreate</code> and
initialized with the various functions described above.
<code>H5Dcreate</code> returns a dataset identifier for success
or negative for failure. The identifier should eventually be
closed by calling <code>H5Dclose</code> to release resources
it uses.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>loc_id</code>
<dd>IN: Identifier of the file or group
within which to create the dataset.
<dt><em>const char *</em> <code>name</code>
<dd>IN: The name of the dataset to create.
<dt><em>hid_t</em> <code>type_id</code>
<dd>IN: Identifier of the datatype to use
when creating the dataset.
<dt><em>hid_t</em> <code>space_id</code>
<dd>IN: Identifier of the dataspace to use
when creating the dataset.
<dt><em>hid_t</em> <code>create_plist_id</code>
<dd>IN: Identifier of the set creation property list.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a dataset identifier if successful;
otherwise returns a negative value.
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5d_FORTRAN.html#h5dcreate_f"
target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
<!--
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Dataset-Open">H5Dopen</a>
<dt><strong>Signature:</strong>
<dd><em>hid_t </em><code>H5Dopen</code>(<em>hid_t </em><code>loc_id</code>,
<em>const char *</em><code>name</code>
)
<dt><strong>Purpose:</strong>
<dd>Opens an existing dataset.
<dt><strong>Description:</strong>
<dd><code>H5Dopen</code> opens an existing dataset for access in the file
or group specified in <code>loc_id</code>. <code>name</code> is
a dataset name and is used to identify the dataset in the file.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>loc_id</code>
<dd>IN: Identifier of the file or group
within which the dataset to be accessed will be found.
<dt><em>const char *</em> <code>name</code>
<dd>IN: The name of the dataset to access.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a dataset identifier if successful;
otherwise returns a negative value.
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5d_FORTRAN.html#h5dopen_f"
target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
<!--
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Dataset-GetSpace">H5Dget_space</a>
<dt><strong>Signature:</strong>
<dd><em>hid_t </em><code>H5Dget_space</code>(<em>hid_t </em><code>dataset_id</code>
)
<dt><strong>Purpose:</strong>
<dd>Returns an identifier for a copy of the dataspace for a dataset.
<dt><strong>Description:</strong>
<dd><code>H5Dget_space</code> returns an identifier for a copy of the
dataspace for a dataset.
The dataspace identifier should be released with the
<code>H5Sclose</code> function.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>dataset_id</code>
<dd>IN: Identifier of the dataset to query.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a dataspace identifier if successful;
otherwise returns a negative value.
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5d_FORTRAN.html#h5dget_space_f"
target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
<!--
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Dataset-GetType">H5Dget_type</a>
<dt><strong>Signature:</strong>
<dd><em>hid_t </em><code>H5Dget_type</code>(<em>hid_t </em><code>dataset_id</code>
)
<dt><strong>Purpose:</strong>
<dd>Returns an identifier for a copy of the datatype for a dataset.
<dt><strong>Description:</strong>
<dd><code>H5Dget_type</code> returns an identifier for a copy of the
datatype for a dataset.
The datatype should be released with the <code>H5Tclose</code> function.
<p>
If a dataset has a named datatype, then an identifier to the
opened datatype is returned.
Otherwise, the returned datatype is read-only.
If atomization of the datatype fails, then the datatype is closed.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>dataset_id</code>
<dd>IN: Identifier of the dataset to query.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a datatype identifier if successful;
otherwise returns a negative value.
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5d_FORTRAN.html#h5dget_type_f"
target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
<!--
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Dataset-GetCreatePlist">H5Dget_create_plist</a>
<dt><strong>Signature:</strong>
<dd><em>hid_t </em><code>H5Dget_create_plist</code>(<em>hid_t </em><code>dataset_id</code>
)
<dt><strong>Purpose:</strong>
<dd>Returns an identifier for a copy of the
dataset creation property list for a dataset.
<dt><strong>Description:</strong>
<dd><code>H5Dget_create_plist</code> returns an identifier for a
copy of the dataset creation property list for a dataset.
The creation property list identifier should be released with
the <code>H5Pclose</code> function.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>dataset_id</code>
<dd>IN: Identifier of the dataset to query.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a dataset creation property list identifier if successful;
otherwise returns a negative value.
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5d_FORTRAN.html#h5dget_create_plist_f"
target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
<!--
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Dataset-GetStorageSize">H5Dget_storage_size</a>
<dt><strong>Signature:</strong>
<dd><em>hsize_t </em><code>H5Dget_storage_size</code>(<em>hid_t </em><code>dataset_id</code>
)
<dt><strong>Purpose:</strong>
<dd>Returns the amount of storage required for a dataset.
<dt><strong>Description:</strong>
<dd><code>H5Dget_storage_size</code> returns the amount of storage
that is required for the specified dataset, <code>dataset_id</code>.
For chunked datasets, this is the number of allocated chunks times
the chunk size.
The return value may be zero if no data has been stored.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>dataset_id</code>
<dd>IN: Identifier of the dataset to query.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns the amount of storage space allocated for the dataset,
not counting meta data;
otherwise returns 0 (zero).
<!--
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5d_FORTRAN.html#h5dget_storage_size"
target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
--> <!--
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Dataset-VLGetBuf">H5Dvlen_get_buf_size</a>
<dt><strong>Signature:</strong>
<dd><em>herr_t </em><code>H5Dvlen_get_buf_size</code>(<em>hid_t </em><code>dataset_id</code>,
<em>hid_t</em> <code>type_id</code>,
<em>hid_t</em> <code>space_id</code>,
<em>hsize_t</em> *<code>size</code>
)
<dt><strong>Purpose:</strong>
<dd>Determines the number of bytes required to store VL data.
<dt><strong>Description:</strong>
<dd><code>H5Dvlen_get_buf_size</code> determines the number of bytes
required to store the VL data from the dataset, using the
<code>space_id</code> for the selection in the dataset on
disk and the <code>type_id</code> for the memory representation
of the VL data in memory.
<p>
<code>*size</code> is returned with the number of bytes
required to store the VL data in memory.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>dataset_id</code>
<dd>IN: Identifier of the dataset to query.
<dt><em>hid_t</em> <code>type_id</code>
<dd>IN: Datatype identifier.
<dt><em>hid_t</em> <code>space_id</code>
<dd>IN: Dataspace identifier.
<dt><em>hsize_t</em> *<code>size</code>
<dd>OUT: The size in bytes of the memory buffer required to store the VL data.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns non-negative value if successful;
otherwise returns a negative value.
<!--
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5d_FORTRAN.html#h5dvlen_get_buf_size_f"
target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
--> <!--
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Dataset-VLReclaim">H5Dvlen_reclaim</a>
<dt><strong>Signature:</strong>
<dd><em>herr_t </em><code>H5Dvlen_reclaim</code>(<em>hid_t </em><code>type_id</code>,
<em>hid_t</em> <code>space_id</code>,
<em>hid_t</em> <code>plist_id</code>,
<em>void</em> *<code>buf</code>
)
<dt><strong>Purpose:</strong>
<dd>Reclaims VL datatype memory buffers.
<dt><strong>Description:</strong>
<dd><code>H5Dvlen_reclaim</code> reclaims memory buffers created to
store VL datatypes.
<p>
The <code>type_id</code> must be the datatype stored in the buffer.
The <code>space_id</code> describes the selection for the memory buffer
to free the VL datatypes within.
The <code>plist_id</code> is the dataset transfer property list which
was used for the I/O transfer to create the buffer.
And <code>buf</code> is the pointer to the buffer to be reclaimed.
<p>
The VL structures (<code>hvl_t</code>) in the user's buffer are
modified to zero out the VL information after the memory has been reclaimed.
<p>
If nested VL datatypes were used to create the buffer,
this routine frees them <em>from the bottom up</em>, releasing all
the memory without creating memory leaks.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>type_id</code>
<dd>IN: Identifier of the datatype.
<dt><em>hid_t</em> <code>space_id</code>
<dd>IN: Identifier of the dataspace.
<dt><em>hid_t</em> <code>plist_id</code>
<dd>IN: Identifier of the property list used to create the buffer.
<dt><em>void</em> *<code>buf</code>
<dd>IN: Pointer to the buffer to be reclaimed.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns non-negative value if successful;
otherwise returns a negative value.
<!--
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5d_FORTRAN.html#h5dvlen_reclaim_f"
target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
--> <!--
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Dataset-Read">H5Dread</a>
<dt><strong>Signature:</strong>
<dd><em>herr_t </em><code>H5Dread</code>(<em>hid_t </em><code>dataset_id</code>,
<em>hid_t</em> <code>mem_type_id</code>,
<em>hid_t</em> <code>mem_space_id</code>,
<em>hid_t</em> <code>file_space_id</code>,
<em>hid_t</em> <code>xfer_plist_id</code>,
<em>void *</em> <code>buf</code>
)
<dt><strong>Purpose:</strong>
<dd>Reads raw data from the specified dataset into an application buffer <code>buf</code>,
converting from
file datatype and dataspace to memory datatype and dataspace.
<dt><strong>Description:</strong>
<dd><code>H5Dread</code> reads a (partial) dataset, specified by its
identifier <code>dataset_id</code>, from the
file info an application memory buffer <code>buf</code>.
Data transfer properties are defined by the argument
<code>xfer_plist_id</code>.
The memory datatype of the (partial) dataset is identified by
the identifier <code>mem_type_id</code>.
The part of the dataset to read is defined by
<code>mem_space_id</code> and <code>file_space_id</code>.
<p>
<code>file_space_id</code> is used to specify only the selection within
the file dataset's dataspace. Any dataspace specified in <code>file_space_id</code>
is ignored by the library and the dataset's dataspace is always used.
<code>file_space_id</code> can be the constant <code>H5S_ALL</code>.
which indicates that the entire file dataspace, as defined by the
current dimensions of the dataset, is to be selected.
<p>
<code>mem_space_id</code> is used to specify both the memory dataspace
and the selection within that dataspace.
<code>mem_space_id</code> can be the constant <code>H5S_ALL</code>,
in which case the file dataspace is used for the memory dataspace and
the selection defined with <code>file_space_id</code> is used for the
selection within that dataspace.
<p>
The behavior of the library for the various combinations of valid
dataspace IDs and H5S_ALL for the <code>mem_space_id</code> and the
<code>file_space_id</code> parameters is described below:
<br><br>
<table border=1>
<tr>
<th>
<code>mem_space_id</code>
</th>
<th>
<code>file_space_id</code>
</th>
<th>
Behavior
</th>
</tr>
<tr>
<td>
valid dataspace ID
</td>
<td>
valid dataspace ID
</td>
<td>
<code>mem_space_id</code> specifies the memory dataspace and the
selection within it.
<code>file_space_id</code> specifies the selection within the file
dataset's dataspace.
</td>
</tr>
<tr>
<td>
H5S_ALL
</td>
<td>
valid dataspace ID
</td>
<td>
The file dataset's dataspace is used for the memory dataspace and the
selection specified with <code>file_space_id</code> specifies the
selection within it.
<code>file_space_id</code> specifies the selection within the file
dataset's dataspace.
</td>
</tr>
<tr>
<td>
valid dataspace ID
</td>
<td>
H5S_ALL
</td>
<td>
<code>mem_space_id</code> specifies the memory dataspace and the
selection within it.
The selection within the file dataset's dataspace is set to the "all"
selection.
</td>
</tr>
<tr>
<td>
H5S_ALL
</td>
<td>
H5S_ALL
</td>
<td>
The file dataset's dataspace is used for the memory dataspace and the
selection within the memory dataspace is set to the "all" selection.
The selection within the file dataset's dataspace is set to the "all"
selection.
</td>
</tr>
</table>
<p>
Setting an "all" selection indicates that the entire dataspace, as
defined by the current dimensions of a dataspace, will be selected.
The number of elements selected in the memory dataspace must match the
number of elements selected in the file dataspace.
<p>
<code>xfer_plist_id</code> can be the constant <code>H5P_DEFAULT</code>.
in which case the default data transfer properties are used.
<p>
Datatype conversion takes place at the time of the read
and is automatic. See the
<a href="Datatypes.html#Datatypes-DataConversion">Data Conversion</a>
section of <cite>The Data Type Interface (H5T)</cite> in the
<cite>HDF5 User's Guide</cite> for a discussion of
data conversion, including the range of conversions currently
supported by the HDF5 libraries.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>dataset_id</code>
<dd>IN: Identifier of the dataset read from.
<dt><em>hid_t</em> <code>mem_type_id</code>
<dd>IN: Identifier of the memory datatype.
<dt><em>hid_t</em> <code>mem_space_id</code>
<dd>IN: Identifier of the memory dataspace.
<dt><em>hid_t</em> <code>file_space_id</code>
<dd>IN: Identifier of the dataset's dataspace in the file.
<dt><em>hid_t</em> <code>xfer_plist_id</code>
<dd>IN: Identifier of a transfer property list
for this I/O operation.
<dt><em>void *</em> <code>buf</code>
<dd>OUT: Buffer to receive data read from file.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a non-negative value if successful;
otherwise returns a negative value.
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5d_FORTRAN.html#h5dread_f"
target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
<!--
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Dataset-Write">H5Dwrite</a>
<dt><strong>Signature:</strong>
<dd><em>herr_t </em><code>H5Dwrite</code>(<em>hid_t </em><code>dataset_id</code>,
<em>hid_t</em> <code>mem_type_id</code>,
<em>hid_t</em> <code>mem_space_id</code>,
<em>hid_t</em> <code>file_space_id</code>,
<em>hid_t</em> <code>xfer_plist_id</code>,
<em>const void *</em> <code>buf</code>
)
<dt><strong>Purpose:</strong>
<dd>Writes raw data from an application buffer <code>buf</code> to
the specified dataset, converting from
memory datatype and dataspace to file datatype and dataspace.
<dt><strong>Description:</strong>
<dd><code>H5Dwrite</code> writes a (partial) dataset, specified by its
identifier <code>dataset_id</code>, from the
application memory buffer <code>buf</code> into the file.
Data transfer properties are defined by the argument
<code>xfer_plist_id</code>.
The memory datatype of the (partial) dataset is identified by
the identifier <code>mem_type_id</code>.
The part of the dataset to write is defined by
<code>mem_space_id</code> and <code>file_space_id</code>.
<p>
<code>file_space_id</code> is used to specify only the selection within
the file dataset's dataspace. Any dataspace specified in <code>file_space_id</code>
is ignored by the library and the dataset's dataspace is always used.
<code>file_space_id</code> can be the constant <code>H5S_ALL</code>.
which indicates that the entire file dataspace, as defined by the
current dimensions of the dataset, is to be selected.
<p>
<code>mem_space_id</code> is used to specify both the memory dataspace
and the selection within that dataspace.
<code>mem_space_id</code> can be the constant <code>H5S_ALL</code>,
in which case the file dataspace is used for the memory dataspace and
the selection defined with <code>file_space_id</code> is used for the
selection within that dataspace.
<p>
The behavior of the library for the various combinations of valid
dataspace IDs and H5S_ALL for the <code>mem_space_id</code> and the
<code>file_space_id</code> parameters is described below:
<br><br>
<table border=1>
<tr>
<th>
<code>mem_space_id</code>
</th>
<th>
<code>file_space_id</code>
</th>
<th>
Behavior
</th>
</tr>
<tr>
<td>
valid dataspace ID
</td>
<td>
valid dataspace ID
</td>
<td>
<code>mem_space_id</code> specifies the memory dataspace and the
selection within it.
<code>file_space_id</code> specifies the selection within the file
dataset's dataspace.
</td>
</tr>
<tr>
<td>
H5S_ALL
</td>
<td>
valid dataspace ID
</td>
<td>
The file dataset's dataspace is used for the memory dataspace and the
selection specified with <code>file_space_id</code> specifies the
selection within it.
<code>file_space_id</code> specifies the selection within the file
dataset's dataspace.
</td>
</tr>
<tr>
<td>
valid dataspace ID
</td>
<td>
H5S_ALL
</td>
<td>
<code>mem_space_id</code> specifies the memory dataspace and the
selection within it.
The selection within the file dataset's dataspace is set to the "all"
selection.
</td>
</tr>
<tr>
<td>
H5S_ALL
</td>
<td>
H5S_ALL
</td>
<td>
The file dataset's dataspace is used for the memory dataspace and the
selection within the memory dataspace is set to the "all" selection.
The selection within the file dataset's dataspace is set to the "all"
selection.
</td>
</tr>
</table>
<p>
Setting an "all" selection indicates that the entire dataspace, as
defined by the current dimensions of a dataspace, will be selected.
The number of elements selected in the memory dataspace must match the
number of elements selected in the file dataspace.
<p>
<code>xfer_plist_id</code> can be the constant <code>H5P_DEFAULT</code>.
in which case the default data transfer properties are used.
<p>
Writing to an dataset will fail if the HDF5 file was
not opened with write access permissions.
<p>
Datatype conversion takes place at the time of the write
and is automatic. See the
<a href="Datatypes.html#Datatypes-DataConversion">Data Conversion</a>
section of <cite>The Data Type Interface (H5T)</cite> in the
<cite>HDF5 User's Guide</cite> for a discussion of
data conversion, including the range of conversions currently
supported by the HDF5 libraries.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>dataset_id</code>
<dd>IN: Identifier of the dataset to write to.
<dt><em>hid_t</em> <code>mem_type_id</code>
<dd>IN: Identifier of the memory datatype.
<dt><em>hid_t</em> <code>mem_space_id</code>
<dd>IN: Identifier of the memory dataspace.
<dt><em>hid_t</em> <code>file_space_id</code>
<dd>IN: Identifier of the dataset's dataspace in the file.
<dt><em>hid_t</em> <code>xfer_plist_id</code>
<dd>IN: Identifier of a transfer property list
for this I/O operation.
<dt><em>const void *</em> <code>buf</code>
<dd>IN: Buffer with data to be written to the file.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a non-negative value if successful;
otherwise returns a negative value.
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5d_FORTRAN.html#h5dwrite_f"
target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
<!--
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Dataset-Extend">H5Dextend</a>
<dt><strong>Signature:</strong>
<dd><em>herr_t </em><code>H5Dextend</code>(<em>hid_t </em><code>dataset_id</code>,
<em>const hsize_t *</em> <code>size</code>
)
<dt><strong>Purpose:</strong>
<dd>Extends a dataset with unlimited dimension.
<dt><strong>Description:</strong>
<dd><code>H5Dextend</code> verifies that the dataset is at least of size
<code>size</code>.
The dimensionality of <code>size</code> is the same as that of
the dataspace of the dataset being changed.
This function cannot be applied to a dataset with fixed dimensions.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>dataset_id</code>
<dd>IN: Identifier of the dataset.
<dt><em>const hsize_t *</em> <code>size</code>
<dd>IN: Array containing the new magnitude of each dimension.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a non-negative value if successful;
otherwise returns a negative value.
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5d_FORTRAN.html#h5dextend_f"
target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
<!--
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Dataset-Close">H5Dclose</a>
<dt><strong>Signature:</strong>
<dd><em>herr_t </em><code>H5Dclose</code>(<em>hid_t </em><code>dataset_id</code>
)
<dt><strong>Purpose:</strong>
<dd>Closes the specified dataset.
<dt><strong>Description:</strong>
<dd><code>H5Dclose</code> ends access to a dataset specified by
<code>dataset_id</code> and releases resources used by it.
Further use of the dataset identifier is illegal in calls to
the dataset API.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>dataset_id</code>
<dd>IN: Identifier of the dataset to close access to.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a non-negative value if successful;
otherwise returns a negative value.
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5d_FORTRAN.html#h5dclose_f"
target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
<!--
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Dataset-Iterate">H5Diterate</a>
<dt><strong>Signature:</strong>
<dd><em>herr_t </em><code>H5Diterate</code>(
<em>void *</em><code>buf</code>,
<em>hid_t </em><code>type_id</code>,
<em>hid_t </em><code>space_id</code>,
<em>H5D_operator_t </em><code>operator</code>,
<em>void *</em><code>operator_data</code>
)
<dt><strong>Purpose:</strong>
<dd>Iterates over all selected elements in a dataspace.
<dt><strong>Description:</strong>
<dd><code>H5Diterate</code> iterates over all the elements selected
in a memory buffer. The callback function is called once for each
element selected in the dataspace.
<p>
The selection in the dataspace is modified so that any elements
already iterated over are removed from the selection if the
iteration is interrupted (by the <code>H5D_operator_t</code>
function returning non-zero) before the iteration is complete;
the iteration may then be re-started by the user where it left off.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>void *</em><code>buf</code>
<dd>IN/OUT: Pointer to the buffer in memory containing the
elements to iterate over.
<dt><em>hid_t </em><code>type_id</code>
<dd>IN: Datatype identifier for the elements stored in
<code>buf</code>.
<dt><em>hid_t </em><code>space_id</code>
<dd>IN: Dataspace identifier for <code>buf</code>.
Also contains the selection to iterate over.
<dt><em>H5D_operator_t </em><code>operator</code>
<dd>IN: Function pointer to the routine to be called
for each element in <code>buf</code> iterated over.
<dt><em>void *</em><code>operator_data</code>
<dd>IN/OUT: Pointer to any user-defined data associated
with the operation.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns the return value of the last operator if it was non-zero,
or zero if all elements have been processed.
Otherwise returns a negative value.
<!--
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5d_FORTRAN.html#h5diterate_f"
target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
--> <!--
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Dataset-Fill">H5Dfill</a>
<dt><strong>Signature:</strong>
<dd><em>herr_t </em><code>H5Dfill</code>(
<em>const void *</em><code>fill</code>,
<em>hid_t </em><code>fill_type_id</code>,
<em>void *</em><code>buf</code>,
<em>hid_t </em><code>buf_type_id</code>,
<em>hid_t </em><code>space_id</code>
)
<dt><strong>Purpose:</strong>
<dd>Fills dataspace elements with a fill value in a memory buffer.
<dt><strong>Description:</strong>
<dd><code>H5Dfill</code> explicitly fills a dataspace selection
in memory with the fill value specified in <code>fill</code>.
<p>
If <code>fill</code> is <code>NULL</code>,
a fill value of <code>0</code> (zero) is used.
<p>
Note that if the fill value datatype differs
from the memory buffer datatype, the fill value
will be converted to the memory buffer datatype
before filling the selection.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>const void *</em><code>fill</code>
<dd>IN: Pointer to the fill value to be used.
<dt><em>hid_t </em><code>fill_type_id</code>
<dd>IN: Fill value datatype identifier.
<dt><em>void *</em><code>buf</code>
<dd>IN/OUT: Pointer to the memory buffer containing the
selection to be filled.
<dt><em>hid_t </em><code>buf_type_id</code>
<dd>IN: Datatype of dataspace elements to be filled.
<dt><em>hid_t </em><code>space_id</code>
<dd>IN: Dataspace describing memory buffer and
containing the selection to be filled.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a non-negative value if successful;
otherwise returns a negative value.
<!--
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5d_FORTRAN.html#h5diterate_f"
target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
--> <!--
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<hr>
<center>
<table border=0 width=98%>
<tr><td valign=top align=left>
<a href="H5.intro.html">Introduction to HDF5</a>&nbsp;<br>
<a href="H5.user.html">HDF5 User Guide</a>&nbsp;<br>
<a href="index.html">Other HDF5 documents and links</a>&nbsp;<br>
<!--
<a href="Glossary.html">Glossary</a><br>
-->
</td>
<td valign=top align=right>
And in this document, the
<a href="RM_H5Front.html">HDF5 Reference Manual</a>&nbsp;&nbsp;
<br>
<a href="RM_H5.html">H5</a>&nbsp;&nbsp;
<a href="RM_H5A.html">H5A</a>&nbsp;&nbsp;
H5D&nbsp;&nbsp;
<a href="RM_H5E.html">H5E</a>&nbsp;&nbsp;
<a href="RM_H5F.html">H5F</a>&nbsp;&nbsp;
<a href="RM_H5G.html">H5G</a>&nbsp;&nbsp;
<a href="RM_H5I.html">H5I</a>&nbsp;&nbsp;
<a href="RM_H5P.html">H5P</a>&nbsp;&nbsp;
<br>
<a href="RM_H5R.html">H5R</a>&nbsp;&nbsp;
<a href="RM_H5S.html">H5S</a>&nbsp;&nbsp;
<a href="RM_H5T.html">H5T</a>&nbsp;&nbsp;
<a href="RM_H5Z.html">H5Z</a>&nbsp;&nbsp;
<a href="Tools.html">Tools</a>&nbsp;&nbsp;
<a href="PredefDTypes.html">Datatypes</a>&nbsp;&nbsp;
</td></tr>
</table>
</center>
<hr>
<address>
<a href="mailto:hdfhelp@ncsa.uiuc.edu">HDF Help Desk</a>
<br>
Last modified: 19 April 2002
<br>
Describes HDF5 Release 1.5, Unreleased Development Branch
</body>
</html>