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/crtgrp.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/crtgrp.html')
-rw-r--r-- | doc/html/Tutor/crtgrp.html | 131 |
1 files changed, 85 insertions, 46 deletions
diff --git a/doc/html/Tutor/crtgrp.html b/doc/html/Tutor/crtgrp.html index 566fd2c..678f805 100644 --- a/doc/html/Tutor/crtgrp.html +++ b/doc/html/Tutor/crtgrp.html @@ -42,13 +42,25 @@ program must: <LI> Create the group. <LI> Close the group. </OL> -To create a group, the calling program must contain the following calls: +To create a group, the calling program must call +<code>H5Gcreate</code>/<code>h5gcreate_f</code>. +To close the group, <code>H5Gclose</code>/<code>h5gclose_f</code> +must be called. For example: +<P> +<I>C:</I> <PRE> group_id = H5Gcreate (loc_id, name, size_hint); - H5Gclose (group_id); + status = H5Gclose (group_id); </PRE> +<I>FORTRAN:</I> +<PRE> + CALL h5gcreate_f (loc_id, name, group_id, error, size_hint=size) + <i>or</i> + CALL h5gcreate_f (loc_id, name, group_id, error) + CALL h5gclose_f (group_id, error) +</PRE> <P> @@ -56,77 +68,102 @@ To create a group, the calling program must contain the following calls: <A NAME="desc"> <H3><U>Description</U></H3> The following example shows how to create and close a group. It creates a file -called 'group.h5', creates a group called <I>MyGroup</I> in the root group, +called <code>group.h5</code> (<code>groupf.h5</code> for FORTRAN), +creates a group called <code>MyGroup</code> in the root group, and then closes the group and file. <BR> -[ <A HREF="examples/h5_crtgrp.c">Download h5_crtgrp.c</A> ] -<PRE> - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -#include <hdf5.h> -#define FILE "group.h5" - -main() { - - hid_t file_id, group_id; /* identifiers */ - herr_t status; - - /* Create a new file using default properties. */ - file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - - /* Create a group named "/MyGroup" in the file. */ - group_id = H5Gcreate(file_id, "/MyGroup", 0); - - /* Close the group. */ - status = H5Gclose(group_id); +<UL> +[ <A HREF="examples/h5_crtgrp.c">C Example</A> ] + - <code>h5_crtgrp.c</code><BR> +[ <A HREF="examples/groupexample.f90">FORTRAN Example</A> ] + - <code>groupexample.f90</code><BR> +[ <A HREF="examples/java/CreateGroup.java">Java Example</A> ] + - <code>CreateGroup.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. - /* Terminate access to the file. */ - status = H5Fclose(file_id); -} -++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ </PRE> <A NAME="rem"> <H3><U>Remarks</U></H3> <UL> -<LI> H5Gcreate creates a new empty group and returns a group identifier. +<LI><code>H5Gcreate</code>/<code>h5gcreate_f</code> creates + a new empty group, named <code>MyGroup</code> and located in the + root group, and returns a group identifier. +<P> +<I>C:</I> <PRE> hid_t H5Gcreate (hid_t loc_id, const char *name, size_t size_hint) </PRE> +<I>FORTRAN:</I> +<PRE> + h5gcreate_f (loc_id, name, group_id, hdferr, size_hint) + + loc_id INTEGER(HID_T) + name CHARACTER(LEN=*) + group_id INTEGER(HID_T) + hdferr INTEGER + (Possible values: 0 on success and -1 on failure) + size_hint INTEGER(SIZE_T), OPTIONAL + (Default value: OBJECT_NAMELEN_DEFAULT_F) + +</PRE> <UL> - <LI> The first parameter specifies the location to create the group. - - <LI> The second parameter specifies the name of the group to be created. - - <LI> The third parameter specifies how much file space to reserve to store the + <LI>The <I>loc_id</I> parameter specifies the location at which + to create the group. +<P> + <LI> The <I>name</I> parameter specifies the name of the group to be created. +<P> + <LI> The <I>size_hint</I> parameter specifies how much file space to + reserve to store the names that will appear in the group. If a non-positive value is supplied, then a default size is used. Passing a value of zero is usually adequate since the library is able to dynamically resize the name heap. +<P> + <LI>In FORTRAN, the return value for the routine is passed in + <I>hdferr</I>: 0 if successful, -1 otherwise. The group identifier + is passed back in <I>group_id</I>. In C, the function returns a valid + group identifier if successful and a negative value otherwise. + </UL> <P> -<LI> H5Gcreate creates a group named <I>MyGroup</I> in the root group of the specified - file. +<LI><code>H5Gclose</code>/<code>h5gclose_f</code> closes the group. + This call is mandatory. <P> -<LI> H5Gclose closes the group. This call is mandatory. +<I>C:</I> <PRE> herr_t H5Gclose (hid_t group_id) </PRE> +<I>FORTRAN:</I> +<PRE> + h5gclose_f (group_id, hdferr) + + group_id INTEGER(HID_T) + hdferr INTEGER + (Possible values: 0 on success and -1 on failure) + +</PRE> </UL> <A NAME="fc"> <H3><U>File Contents</U></H3> -The contents of 'group.h5' and the definition of the group are given in the -following: +The contents of <code>group.h5</code> and the +definition of the group are shown below. (The FORTRAN program +creates the HDF5 file <code>groupf.h5</code> and the resulting DDL shows +<code>groupf.h5</code> in the first line.) <P> -<table width="56%" border="1" bordercolor="#FFFFFF" cellpadding="6" cellspacing="6"> - <tr> - <td width="47%"><b>Fig. 8.1</b> <i>The Contents of 'group.h5'.</i> +<table width="80%" border="1" bordercolor="#FFFFFF" cellpadding="6" cellspacing="6"> + <tr valign=top> + <td width="43%"><b>Fig. 8.1</b> <i>The Contents of <code>group.h5</code>.</i> + </td> + <td width="10%"> </td> - <td width="53%"><b>Fig. 8.2</b> <i>'group.h5' in DDL</i> </td> + <td width="47%"><b>Fig. 8.2</b> <i><code>group.h5</code> in DDL</i> </td> </tr> <tr bordercolor="#000000"> <!-- <td width="47%"><IMG src="grouph5.jpg" width="205" height="333"></td> --> - <td width="47%"><IMG src="img003.gif"></td> - <td width="53%" valign="top"> + <td align=center><IMG src="img003.gif"></td> + <td bordercolor="#FFFFFF"> </td> + <td valign="top"> <pre> HDF5 "group.h5" { GROUP "/" { @@ -154,7 +191,9 @@ GROUP "/" { <!-- <A HREF="helpdesk.mail.html"> --> <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> |