[ HDF5 Tutorial Top ]

Selecting Individual Points and Copying a Dataspace


Contents:


Description

You can select independent points to read from or write to in a dataspace by use of the H5Sselect_elements / h5sselect_elements_f function.

The H5Scopy / h5scopy_f function allows you to make an exact copy of a dataspace. This can reduce the number of function calls needed when selecting a dataspace.

Programming Example

Description

This example shows how to use H5Sselect_elements / h5sselect_elements_f to select individual points in a dataset and how to use H5Scopy / h5scopy_f to make a copy of a dataspace.
NOTE: To download a tar file of the examples, including a Makefile, please go to the References page.

Remarks

File Contents

Following is the DDL for copy1.h5 and copy2.h5, as viewed with the following commands:
             h5dump copy1.h5
             h5dump copy2.h5


C:

Fig. S.1a   copy1.h5 in DDL

   HDF5 "copy1.h5" {
   GROUP "/" {
      DATASET "Copy1" {
         DATATYPE { H5T_STD_I32BE }
         DATASPACE { SIMPLE ( 3, 4 ) / ( 3, 4 ) }
         DATA {
            0, 59, 0, 53,
            0, 0, 0, 0,
            0, 0, 0, 0
         }
      }
   }
   }
Fig. S.1b   copy2.h5 in DDL
   HDF5 "copy2.h5" {
   GROUP "/" {
      DATASET "Copy2" {
         DATATYPE { H5T_STD_I32BE }
         DATASPACE { SIMPLE ( 3, 4 ) / ( 3, 4 ) }
         DATA {
            1, 59, 1, 53,
            1, 1, 1, 1,
            1, 1, 1, 1
         }
      }
   }
   }

FORTRAN:

Fig. S.2a   copy1.h5 in DDL

   HDF5 "copy1.h5" {
   GROUP "/" {
      DATASET "Copy1" {
         DATATYPE { H5T_STD_I32BE }
         DATASPACE { SIMPLE ( 4, 3 ) / ( 4, 3 ) }
         DATA {
            0, 0, 0,
            53, 0, 0,
            0, 0, 0,
            59, 0, 0
         }
      }
   }
   }
Fig. S.2b   copy2.h5 in DDL
   HDF5 "copy2.h5" {
   GROUP "/" {
      DATASET "Copy2" {
         DATATYPE { H5T_STD_I32BE }
         DATASPACE { SIMPLE ( 4, 3 ) / ( 4, 3 ) }
         DATA {
            1, 1, 1,
            53, 1, 1,
            1, 1, 1,
            59, 1, 1
         }
      }
   }
   }


NCSA
The National Center for Supercomputing Applications

University of Illinois at Urbana-Champaign

hdfhelp@ncsa.uiuc.edu

Last Modified: June 22, 2001