diff options
author | Barbara Jones <bljones@hdfgroup.org> | 2001-03-08 16:47:44 (GMT) |
---|---|---|
committer | Barbara Jones <bljones@hdfgroup.org> | 2001-03-08 16:47:44 (GMT) |
commit | 345e07fc11458901632c697ae794d91962eed817 (patch) | |
tree | bb30b14de021bd2c70480b9126008002d6bdb36e /doc/html/Tutor/crtgrpd.html | |
parent | d8c843156a3879a51f7e3062f51beba4e84b1ca2 (diff) | |
download | hdf5-345e07fc11458901632c697ae794d91962eed817.zip hdf5-345e07fc11458901632c697ae794d91962eed817.tar.gz hdf5-345e07fc11458901632c697ae794d91962eed817.tar.bz2 |
[svn-r3563] Add changes to tutorial for Fortran
Purpose:
[is this a bug fix? feature? ...]
Description:
[describe the bug, or describe the new feature, etc]
Solution:
[details about the changes, algorithm, etc...]
[Please as detail as you can since your own explanation is
better than others guessing it from the code.]
Platforms tested:
[machines you have tested the changed version. This is absolute
important. Test it out on at least two or three different platforms
such as Big-endian-32bit (SUN/IRIX), little-endian-32(LINUX) and
64-bit (IRIX64/UNICOS/DEC-ALPHA) would be good.]
Diffstat (limited to 'doc/html/Tutor/crtgrpd.html')
-rw-r--r-- | doc/html/Tutor/crtgrpd.html | 198 |
1 files changed, 87 insertions, 111 deletions
diff --git a/doc/html/Tutor/crtgrpd.html b/doc/html/Tutor/crtgrpd.html index e92a101..c9c7129 100644 --- a/doc/html/Tutor/crtgrpd.html +++ b/doc/html/Tutor/crtgrpd.html @@ -32,13 +32,16 @@ width=78 height=27 alt="NCSA"><P></A> <HR> <A NAME="ds"> <H2><U>Creating datasets in groups</U></H2> -We have shown how to create groups, datasets and attributes. In this section, -we show how to create datasets in groups. Recall that H5Dcreate creates a -dataset at the location specified by a location identifier and a name. Similar to -H5Gcreate, the location identifier can be a file identifier or a group identifier and the name can be -relative or absolute. The location identifier and the name together determine the -location where the dataset is to be created. If the location identifier and name -refers to a group, then the dataset is created in that group. +We have shown how to create groups, datasets, and attributes. +In this section, we show how to create datasets in groups. +Recall that <code>H5Dcreate</code>/<code>h5dcreate_f</code> +creates a dataset at the location specified by a location identifier and +a name. Similar to <code>H5Gcreate</code>/<code>h5gcreate_f</code>, +the location identifier can be a +file identifier or a group identifier and the name can be +relative or absolute. The location identifier and the name together determine +the location where the dataset is to be created. If the location identifier +and name refer to a group, then the dataset is created in that group. <H2> Programming Example</H2> @@ -46,127 +49,98 @@ refers to a group, then the dataset is created in that group. <H3><U>Description</U></H3> This example shows how to create a dataset in a particular group. It opens the file created in the previous example and creates two datasets.<BR> -[ <A HREF="examples/h5_crtgrpd.c">Download h5_crtgrpd.c</A> ] -<PRE> - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -#include <hdf5.h> -#define FILE "groups.h5" - -main() { - - hid_t file_id, group_id, dataset_id, dataspace_id; /* identifiers */ - hsize_t dims[2]; - herr_t status; - int i, j, dset1_data[3][3], dset2_data[2][10]; - - /* Initialize the first dataset. */ - for (i = 0; i < 3; i++) - for (j = 0; j < 3; j++) - dset1_data[i][j] = j + 1; - - /* Initialize the second dataset. */ - for (i = 0; i < 2; i++) - for (j = 0; j < 10; j++) - dset2_data[i][j] = j + 1; - - /* Open an existing file. */ - file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT); - - /* Create the data space for the first dataset. */ - dims[0] = 3; - dims[1] = 3; - dataspace_id = H5Screate_simple(2, dims, NULL); - - /* Create a dataset in group "MyGroup". */ - dataset_id = H5Dcreate(file_id, "/MyGroup/dset1", H5T_STD_I32BE, dataspace_id -, - H5P_DEFAULT); - - /* Write the first dataset. */ - status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - dset1_data); - - /* Close the data space for the first dataset. */ - status = H5Sclose(dataspace_id); - - /* Close the first dataset. */ - status = H5Dclose(dataset_id); - - /* Open an existing group of the specified file. */ - group_id = H5Gopen(file_id, "/MyGroup/Group_A"); - - /* Create the data space for the second dataset. */ - dims[0] = 2; - dims[1] = 10; - dataspace_id = H5Screate_simple(2, dims, NULL); - - /* Create the second dataset in group "Group_A". */ - dataset_id = H5Dcreate(group_id, "dset2", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT); - - /* Write the second dataset. */ - status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - dset2_data); - - /* Close the data space for the second dataset. */ - status = H5Sclose(dataspace_id); - - /* Close the second dataset */ - status = H5Dclose(dataset_id); - - /* Close the group. */ - status = H5Gclose(group_id); - - /* Close the file. */ - status = H5Fclose(file_id); -} -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -</PRE> +<UL> +[ <A HREF="examples/h5_crtgrpd.c">C Example</A> ] - <code>h5_crtgrpd.c</code> +<BR> +[ <A HREF="examples/grpdsetexample.f90">FORTRAN Example</A> ] +- <code>grpdsetexample.f90</code><BR> +[ <A HREF="examples/java/CreateGroupDataset.java">Java Example</A> ] +- <code>CreateGroupDataset.java</code> +</UL> +<B>NOTE:</B> To download a tar file of the examples, including a Makefile, +please go to the <A HREF="references.html">References</A> page. <A NAME="fc"> <H3><U>File Contents</U></H3> <P> -<B>Fig. 10.1</B> <I>The Contents of 'groups.h5'</I> +<B>Fig. 10.1</B> <I>The Contents of <code>groups.h5</code> + (<code>groupsf.h5</code> for FORTRAN)</I> <PRE> <IMG src="img005.gif"></PRE> <!-- <IMG src="groups2.jpg" width="324" height="433"></PRE> --> </PRE> - <B>Fig. 10.2</B> <I>'groups.h5' in DDL</I> + <B>Fig. 10.2a</B> <I><code>groups.h5</code> in DDL</I> <PRE> - HDF5 "groups.h5" { - GROUP "/" { - GROUP "MyGroup" { - GROUP "Group_A" { - DATASET "dset2" { - DATATYPE { H5T_STD_I32BE } - DATASPACE { SIMPLE ( 2, 10 ) / ( 2, 10 ) } - DATA { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 - } - } - } - GROUP "Group_B" { - } - DATASET "dset1" { - DATATYPE { H5T_STD_I32BE } - DATASPACE { SIMPLE ( 3, 3 ) / ( 3, 3 ) } - DATA { - 1, 2, 3, - 1, 2, 3, - 1, 2, 3 - } +HDF5 "groups.h5" { +GROUP "/" { + GROUP "MyGroup" { + GROUP "Group_A" { + DATASET "dset2" { + DATATYPE { H5T_STD_I32BE } + DATASPACE { SIMPLE ( 2, 10 ) / ( 2, 10 ) } + DATA { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } } } + GROUP "Group_B" { } + DATASET "dset1" { + DATATYPE { H5T_STD_I32BE } + DATASPACE { SIMPLE ( 3, 3 ) / ( 3, 3 ) } + DATA { + 1, 2, 3, + 1, 2, 3, + 1, 2, 3 + } + } + } +} +} </PRE> + <B>Fig. 10.2b</B> <I><code>groupsf.h5</code> in DDL</I> +<PRE> - +HDF5 "groupsf.h5" { +GROUP "/" { + GROUP "MyGroup" { + GROUP "Group_A" { + DATASET "dset2" { + DATATYPE { H5T_STD_I32BE } + DATASPACE { SIMPLE ( 10, 2 ) / ( 10, 2 ) } + DATA { + 1, 1, + 2, 2, + 3, 3, + 4, 4, + 5, 5, + 6, 6, + 7, 7, + 8, 8, + 9, 9, + 10, 10 + } + } + } + GROUP "Group_B" { + } + DATASET "dset1" { + DATATYPE { H5T_STD_I32BE } + DATASPACE { SIMPLE ( 3, 3 ) / ( 3, 3 ) } + DATA { + 1, 1, 1, + 2, 2, 2, + 3, 3, 3 + } + } + } +} +} +</PRE> <!-- BEGIN FOOTER INFO --> <P><hr noshade size=1> @@ -178,7 +152,9 @@ main() { <!-- <A HREF="helpdesk.mail.html"> --> <BR><A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> hdfhelp@ncsa.uiuc.edu</A> -<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<br> +Describes HDF5 Release 1.2.2, June 2000 +<BR> <H6>Last Modified: April 5, 2000</H6><BR> <!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> </FONT> <BR> |