Page tree

The license could not be verified: License Certificate has expired!

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Content Layer
id1195548671
Content Column
width50.00001%
id1195578110
classrm_pagetree_col mobile-hide
Content Block
id1195578111
 
Content Column
width50.00001%
id1195548673
classhdf-rm-main-column
Content Block
id1195548672

Include Content
render-without-blockstrue
page.rm-navbar

HTML Wrap
classhdf-print-only

Page Title

HTML Wrap
classhdf-rm-summary-block

Hdf rm anchor
AnchorNamesummary
Excerpt

Retrieves selected data from the dataset.

HTML Wrap
classhdf-rm-content-block

Hdf rm anchor
AnchorNameprocedure

Procedure:
HTML Wrap
classhdf-rm-section
HTML Wrap
classhdf_procedure

H5LD_GET_DSET_ELMTS(dset_id, prev_dims, cur_dims, fields, buf)

Hdf rm anchor
AnchorNamesignature

Signature:
HTML Wrap
classhdf-rm-section
HTML Wrap
classhdf-togglebox hdf-c

HTML Add Class
hdf-togglebutton-visible
hdf-togglebutton-visible
selector.hdf-togglebutton.hdf-c
HTML
<pre><code class="language-c">herr_t H5LDget_dset_elmts( hid_t dset_id, hsize_t *prev_dims, hsize_t *cur_dims, char *fields, void *buf )</code></pre>

Hdf rm anchor
AnchorNameparameters

Parameters:
HTML Wrap
classhdf-rm-section
hid_t dset_idIN: The dataset identifier
hsize_t *prev_dims   IN: The previous dimension size of the dataset
hsize_t *cur_dimsIN: The current dimension size of the dataset
char *fieldsIN: A string containing a comma-separated list of fields for a compound datatype.
void *bufOUT: Buffer for storing data retrieved from the dataset

Hdf rm anchor
AnchorNamedescription

Description:
HTML Wrap
classhdf-rm-section

This routine retrieves selected data of the dataset dset_id and stores the data in the parameter buf. The difference between the parameters prev_dims and cur_dims indicates the dimension sizes of the data to be selected from the dataset. Note that cur_dims must have at least one dimension whose size is greater than the corresponding dimension in prev_dims. Users can determine the size of buf by multipling the datatype size of the dataset by the number of selected elements.

If the parameter fields is NULL, this routine returns data for the selected elements of the dataset. If fields is not NULL and the dataset has a compound datatype, fields is a string containing a comma-separated list of fields. Each name in fields specifies a field in the compound datatype, and this routine returns data of the selected fields for the dataset's selected elements. Note that ’,’ is the separator for the fields of a compound datatype while ’.’ is the separator for a nested field. Use backslash to escape characters in field names that conflict with these two separators.

Hdf rm anchor
AnchorNamereturns

Returns:
HTML Wrap
classhdf-rm-section

If successful, returns zero; otherwise returns a negative value.

Hdf rm anchor
AnchorNameexample

Example:
HTML Wrap
classhdf-rm-section
Info

For the first example, DSET1 is a two-dimensional chunked dataset with atomic type defined below:

    DATASET "DSET1" {
	DATATYPE  H5T_STD_I32LE
	DATASPACE  SIMPLE { ( 4, 13 ) / ( 60, 100 ) }
	:
	:
    }

The following coding sample illustrates the reading of data elements appended to the dataset DSET1:

    /* open the HDF5 file */
    fid = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);

    /* open the dataset */
    did = H5Dopen2(fid, "DSET1", H5P_DEFAULT);
        :
        :
    /* define hsize_t dims[2]; */
    /* define hsize_t new_dims[2]; */
    /* get the dataset's current dimension sizes */
    H5LDget_dset_dims(did, dims);

    /* extend the dataset by 2 */
    new_dims[0] = dims[0] + 2; 
    new_dims[1] = dims[1] + 2;
    H5Dset_extent(did, new_dims) 
     
    /* write data to the extended dataset */
        :
        :
    /* get the size of the dataset's data type */
    type_size = H5LDget_dset_type_size(did, NULL);
        :
        :
    /* allocate buffer for storing selected data elements from the dataset */
    /* calculate # of selected elements from dims & new_dims */
    /* buffer size = type_size * number of selected elements */
        :
        :
    /* read the selected elements from the dataset into buf */
    H5LDget_dset_elmts(did, dims, new_dims, NULL, buf);
        :
        :
    H5Dclose(did);
    H5Fclose(fid);

The output buffer will contain data elements selected from DSET1 as follows:

    data for elements (0, 13), (0, 14) 
    data for elements (1, 13), (1, 14) 
    data for elements (2, 13), (2, 14) 
    data for elements (3, 13), (3, 14)
    data for elements (4, 0), (4, 1), (4, 2)......................(4, 13), (4, 14)
    data for elements (5, 0), (5, 1), (5, 2)......................(5, 13), (5, 14)

For the second example, DSET2 is a one-dimensional chunked dataset with compound type defined below:

    DATASET "DSET2" {
	DATATYPE  H5T_COMPOUND {
	    H5T_STD_I32LE "a";
	    H5T_STD_I32LE "b";
	    H5T_ARRAY { [4] H5T_STD_I32LE } "c";
	    H5T_STD_I32LE "d";
	    H5T_STD_I32LE "e";
	    H5T_COMPOUND {
		H5T_STD_I32LE "a";
		H5T_STD_I32LE "b";
		H5T_ARRAY {[4] H5T_STD_I32LE} "c";
		H5T_STD_I32LE "d";
		H5T_STD_I32LE "e";
	    } "s2";
	}
	DATASPACE  SIMPLE { ( 5 ) / ( 5 ) }
	:
	:
    }

The following coding sample illustrates the reading of data elements appended to the dataset DSET2 with compound datatype This example selects only 2 fields: the fourth field d and a subfield of the sixth field s2.c:

    /* open the HDF5 file */
    fid = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);

    /* open the dataset */
    did = H5Dopen2(fid, "DSET2", H5P_DEFAULT);

    /* define hsize_t dims[1]; */
    /* define hsize_t new_dims[1]; */
        :
        :
    /* get the dataset's current dimension size */
    H5LDget_dset_dims(did, dims);

    /* extend the dataset by 2 */
    new_dims[0] = dims[0] + 2;
    H5Dset_extent(did, new_dims);
        :
        :
    /* write data to the extended part of the dataset */
        :
        :
    /* #define fields "d,s2.c" */
    /* get the size of the dataset's data type for the selected fields */
    type_size = H5LDget_dset_type_size(did, fields);
        :
        :
    /* allocate buffer for storing selected data elements from the dataset */
    /* calculate # of selected elements from dims & new_dims */
    /* buffer size = type_size * number of selected elements */
        :        
        :
    /* read the selected elements from the dataset into buf */
    H5LD_get_dset_elmts(did, dims, new_dims, fields, buf);
        :
        :
    H5Dclose(did);
    H5Fclose(fid);

The output buffer will contain data for d and s2.c selected from DSET2 as follows:

    Data for element (5): integer value for "d", 4 integer values for array "s2.c"
    Data for element (6): integer value for "d", 4 integer values for array "s2.c"

Comment (Hide)
HTML Wrap
classhdf-togglebox hdf-c

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/1.10/master
projectKeyHDFFV
filepathexamples/h5_subset.c
showLineNumberstrue
lineStart32
progLangcpp
lineEnd42
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

HTML Wrap
classhdf-togglebox hdf-fortran hdf-togglebox-hidden

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/1.10/master
projectKeyHDFFV
filepathfortran/examples/compound.f90
showLineNumberstrue
lineStart25
progLangplain
lineEnd35
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

HTML Wrap
class

hdf-

togglebox hdf-cxx hdf-togglebox-hidden

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/1.10/master
projectKeyHDFFV
filepathc++/examples/create.cpp
showLineNumberstrue
lineStart33
progLangcpp
lineEnd43
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

HTML Wrap
classhdf-togglebox hdf-java hdf-togglebox-hidden

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/1.10/master
projectKeyHDFFV
filepathjava/examples/datasets/H5Ex_D_Chunk.java
showLineNumberstrue
lineStart32
progLangjava
lineEnd42
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

hdf-rm-anchor
AnchorNamehistory

History:
HTML Wrap
classhdf-rm-section
Release    Change
1.10.0C function introduced with this release.