Help us improve by taking our short survey: https://www.hdfgroup.org/website-survey/

| HDF5 Last Updated on 2026-07-28 The HDF5 Field Guide

Loading...
Searching...
No Matches
H5Spublic.h File Reference
`#include "H5public.h"`
`#include "H5Ipublic.h"`

## Macros
#define | H5S_ALL 0
#define | H5S_BLOCK 1
#define | H5S_MAX_RANK 32
#define | H5S_PLIST 2
#define | H5S_SEL_ITER_GET_SEQ_LIST_SORTED 0x0001
#define | H5S_SEL_ITER_SHARE_WITH_DATASPACE 0x0002
#define | H5S_UNLIMITED HSIZE_UNDEF

## Enumerations
enum | H5S_class_t { H5S_NO_CLASS = -1 , H5S_SCALAR = 0 , H5S_SIMPLE = 1 , H5S_NULL = 2 }
enum | H5S_sel_type { H5S_SEL_ERROR = -1 , H5S_SEL_NONE = 0 , H5S_SEL_POINTS = 1 , H5S_SEL_HYPERSLABS = 2 , H5S_SEL_ALL = 3 , H5S_SEL_N }
enum | H5S_seloper_t { H5S_SELECT_NOOP = -1 , H5S_SELECT_SET = 0 , H5S_SELECT_OR , H5S_SELECT_AND , H5S_SELECT_XOR , H5S_SELECT_NOTB , H5S_SELECT_NOTA , H5S_SELECT_APPEND , H5S_SELECT_PREPEND , H5S_SELECT_INVALID }

## Functions
herr_t | H5Sclose (hid_t space_id)
| Releases and terminates access to a dataspace.
hid_t | H5Scombine_hyperslab (hid_t space_id, H5S_seloper_t op, const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[])
| Performs an operation on a hyperslab and an existing selection and returns the resulting selection.
hid_t | H5Scombine_select (hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
| Combine two hyperslab selections with an operation, returning a dataspace with the resulting selection.
hid_t | H5Scopy (hid_t space_id)
| Creates an exact copy of a dataspace.
hid_t | H5Screate (H5S_class_t type)
| Creates a new dataspace of a specified type.
hid_t | H5Screate_simple (int rank, const hsize_t dims[], const hsize_t maxdims[])
| Creates a new simple dataspace and opens it for access.
hid_t | H5Sdecode (const void *buf)
| Decodes a binary object description of data space and returns a new object handle.
herr_t | H5Sencode1 (hid_t obj_id, void *buf, size_t *nalloc)
| Encodes a data space object description into a binary buffer.
herr_t | H5Sencode2 (hid_t obj_id, void *buf, size_t *nalloc, hid_t fapl)
| Encodes a data space object description into a binary buffer.
herr_t | H5Sextent_copy (hid_t dst_id, hid_t src_id)
| Copies the extent of a dataspace.
htri_t | H5Sextent_equal (hid_t space1_id, hid_t space2_id)
| Determines whether two dataspace extents are equal.
htri_t | H5Sget_regular_hyperslab (hid_t spaceid, hsize_t start[], hsize_t stride[], hsize_t count[], hsize_t block[])
| Retrieves a regular hyperslab selection.
herr_t | H5Sget_select_bounds (hid_t spaceid, hsize_t start[], hsize_t end[])
| Gets the bounding box containing the current selection.
hssize_t | H5Sget_select_elem_npoints (hid_t spaceid)
| Gets the number of element points in the current selection.
herr_t | H5Sget_select_elem_pointlist (hid_t spaceid, hsize_t startpoint, hsize_t numpoints, hsize_t buf[])
| Gets the list of element points currently selected.
herr_t | H5Sget_select_hyper_blocklist (hid_t spaceid, hsize_t startblock, hsize_t numblocks, hsize_t buf[])
| Gets the list of hyperslab blocks currently selected.
hssize_t | H5Sget_select_hyper_nblocks (hid_t spaceid)
| Get number of hyperslab blocks.
hssize_t | H5Sget_select_npoints (hid_t spaceid)
| Determines the number of elements in a dataspace selection.
H5S_sel_type | H5Sget_select_type (hid_t spaceid)
| Determines the type of the dataspace selection.
int | H5Sget_simple_extent_dims (hid_t space_id, hsize_t dims[], hsize_t maxdims[])
| Retrieves dataspace dimension size and maximum size.
int | H5Sget_simple_extent_ndims (hid_t space_id)
| Determines the dimensionality of a dataspace.
hssize_t | H5Sget_simple_extent_npoints (hid_t space_id)
| Determines the number of elements in a dataspace.
H5S_class_t | H5Sget_simple_extent_type (hid_t space_id)
| Determines the current class of a dataspace.
htri_t | H5Sis_regular_hyperslab (hid_t spaceid)
| Determines if a hyperslab selection is regular.
htri_t | H5Sis_simple (hid_t space_id)
| Determines whether a dataspace is a simple dataspace.
herr_t | H5Smodify_select (hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
| Refines a hyperslab selection with an operation, using a second hyperslab to modify it.
herr_t | H5Soffset_simple (hid_t space_id, const hssize_t *offset)
| Sets the offset of a simple dataspace.
herr_t | H5Ssel_iter_close (hid_t sel_iter_id)
| Closes a dataspace selection iterator.
hid_t | H5Ssel_iter_create (hid_t spaceid, size_t elmt_size, unsigned flags)
| Creates a dataspace selection iterator for a dataspace's selection.
herr_t | H5Ssel_iter_get_seq_list (hid_t sel_iter_id, size_t maxseq, size_t maxelmts, size_t *nseq, size_t *nelmts, hsize_t *off, size_t *len)
| Retrieves a list of offset / length sequences for the elements in an iterator.
herr_t | H5Ssel_iter_reset (hid_t sel_iter_id, hid_t space_id)
| Resets a dataspace selection iterator back to an initial state.
herr_t | H5Sselect_adjust (hid_t spaceid, const hssize_t *offset)
| Adjusts a selection by subtracting an offset.
herr_t | H5Sselect_all (hid_t spaceid)
| Selects an entire dataspace.
herr_t | H5Sselect_copy (hid_t dst_id, hid_t src_id)
| Copies a selection from one dataspace to another.
herr_t | H5Sselect_elements (hid_t space_id, H5S_seloper_t op, size_t num_elem, const hsize_t *coord)
| Selects array elements to be included in the selection for a dataspace.
herr_t | H5Sselect_hyperslab (hid_t space_id, H5S_seloper_t op, const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[])
| Selects a hyperslab region to add to the current selected region.
htri_t | H5Sselect_intersect_block (hid_t space_id, const hsize_t *start, const hsize_t *end)
| Checks if current selection intersects with a block.
herr_t | H5Sselect_none (hid_t spaceid)
| Resets the selection region to include no elements.
hid_t | H5Sselect_project_intersection (hid_t src_space_id, hid_t dst_space_id, hid_t src_intersect_space_id)
| Projects the intersection of two source selections to a destination selection.
htri_t | H5Sselect_shape_same (hid_t space1_id, hid_t space2_id)
| Checks if two selections are the same shape.
htri_t | H5Sselect_valid (hid_t spaceid)
| Verifies that the selection is within the extent of the dataspace.
herr_t | H5Sset_extent_none (hid_t space_id)
| Resets the extent of a dataspace back to "none".
herr_t | H5Sset_extent_simple (hid_t space_id, int rank, const hsize_t dims[], const hsize_t max[])
| Sets or resets the size of an existing dataspace.

## Macro Definition Documentation

## ◆ H5S_ALL

#define H5S_ALL 0

Used with H5Dread and H5Dwrite to indicate that the entire dataspace will be selected. In the case of a file dataspace, this means that the entire file dataspace, as defined by the dataset's dimensions, will be selected. In the case of a memory dataspace, this means that the specified file dataspace will also be used for the memory dataspace. Used in place of a file or memory dataspace hid_t value.

Since
  1.0.0

## ◆ H5S_BLOCK

#define H5S_BLOCK 1

Indicates that the buffer provided in a call to H5Dread or H5Dwrite is a single contiguous block of memory, with the same number of elements as the file dataspace. Used in place of a memory dataspace hid_t value.

Since
  1.14.0

## ◆ H5S_MAX_RANK

#define H5S_MAX_RANK 32

The maximum number of dimensions in a dataspace or array datatype

Since
  1.0.0

## ◆ H5S_PLIST

#define H5S_PLIST 2

Used with H5Dread and H5Dwrite to indicate that the file dataspace selection was set via H5Pset_dataset_io_hyperslab_selection calls. Used in place of a file dataspace hid_t value.

Since
  1.14.0

## ◆ H5S_SEL_ITER_GET_SEQ_LIST_SORTED

#define H5S_SEL_ITER_GET_SEQ_LIST_SORTED 0x0001

Retrieve elements from iterator in increasing offset order, for each call to retrieve sequences. Currently, this only applies to point selections, as hyperslab selections are always returned in increasing offset order. Note that the order is only increasing for each call to H5Sget_seq_list(), the next set of sequences could start with an earlier offset than the previous one.

Since
  1.12.0

## ◆ H5S_SEL_ITER_SHARE_WITH_DATASPACE

#define H5S_SEL_ITER_SHARE_WITH_DATASPACE 0x0002

Don't copy the dataspace selection when creating the selection iterator. This can improve performance of creating the iterator, but the dataspace MUST NOT be modified or closed until the selection iterator is closed or the iterator's behavior will be undefined.

Since
  1.12.0

## ◆ H5S_UNLIMITED

#define H5S_UNLIMITED HSIZE_UNDEF

Value for 'unlimited' dimensions

Since
  1.0.0

## Enumeration Type Documentation

## ◆ H5S_class_t

enum H5S_class_t

Types of dataspaces

Enumerator
H5S_NO_CLASS | Error Since 1.0.0
H5S_SCALAR | Singleton (scalar) Since 1.0.0
H5S_SIMPLE | Regular grid Since 1.0.0
H5S_NULL | Empty set Since 1.8.0

## ◆ H5S_sel_type

enum H5S_sel_type

Selection type

Enumerator
H5S_SEL_ERROR | Error Since 1.0.0
H5S_SEL_NONE | Empty selection Since 1.0.0
H5S_SEL_POINTS | Set of points Since 1.0.0
H5S_SEL_HYPERSLABS | Hyperslab Since 1.0.0
H5S_SEL_ALL | Everything Since 1.0.0
H5S_SEL_N | Sentinel

## ◆ H5S_seloper_t

enum H5S_seloper_t

Different ways of combining selections

Enumerator
H5S_SELECT_NOOP | Error Since 1.0.0
H5S_SELECT_SET | Select "set" operation Since 1.0.0
H5S_SELECT_OR | Binary "or" operation for hyperslabs (add new selection to existing selection) Original region: AAAAAAAAAA New region: BBBBBBBBBB A or B: CCCCCCCCCCCCCCCC Since 1.0.0
H5S_SELECT_AND | Binary "and" operation for hyperslabs (only leave overlapped regions in selection) Original region: AAAAAAAAAA New region: BBBBBBBBBB A and B: CCCC Since 1.6.0
H5S_SELECT_XOR | Binary "xor" operation for hyperslabs (only leave non-overlapped regions in selection) Original region: AAAAAAAAAA New region: BBBBBBBBBB A xor B: CCCCCC CCCCCC Since 1.6.0
H5S_SELECT_NOTB | Binary "not" operation for hyperslabs (only leave non-overlapped regions in original selection) Original region: AAAAAAAAAA New region: BBBBBBBBBB A not B: CCCCCC Since 1.6.0
H5S_SELECT_NOTA | Binary "not" operation for hyperslabs (only leave non-overlapped regions in new selection) Original region: AAAAAAAAAA New region: BBBBBBBBBB B not A: CCCCCC Since 1.6.0
H5S_SELECT_APPEND | Append elements to end of point selection Since 1.4.0
H5S_SELECT_PREPEND | Prepend elements to beginning of point selection Since 1.4.0
H5S_SELECT_INVALID | Invalid upper bound on selection operations Since 1.0.0