H5Spublic.h 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392
  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2. * Copyright by The HDF Group. *
  3. * Copyright by the Board of Trustees of the University of Illinois. *
  4. * All rights reserved. *
  5. * *
  6. * This file is part of HDF5. The full HDF5 copyright notice, including *
  7. * terms governing use, modification, and redistribution, is contained in *
  8. * the COPYING file, which can be found at the root of the source code *
  9. * distribution tree, or in https://www.hdfgroup.org/licenses. *
  10. * If you do not have access to either file, you may request a copy from *
  11. * help@hdfgroup.org. *
  12. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  13. /*
  14. * This file contains public declarations for the H5S module.
  15. */
  16. #ifndef H5Spublic_H
  17. #define H5Spublic_H
  18. /* Public headers needed by this file */
  19. #include "H5public.h"
  20. #include "H5Ipublic.h"
  21. /* Define special dataspaces for dataset I/O operations */
  22. #define H5S_ALL 0 /* (hid_t) */
  23. #define H5S_BLOCK 1 /* (hid_t) */
  24. #define H5S_PLIST 2 /* (hid_t) */
  25. #define H5S_UNLIMITED HSIZE_UNDEF /**< Value for 'unlimited' dimensions */
  26. /**
  27. * The maximum dataspace rank or number of dimensions
  28. */
  29. #define H5S_MAX_RANK 32
  30. /* Flags for selection iterators */
  31. #define H5S_SEL_ITER_GET_SEQ_LIST_SORTED \
  32. 0x0001 /**< Retrieve elements from iterator in increasing offset order, for \
  33. * each call to retrieve sequences. Currently, this only applies to \
  34. * point selections, as hyperslab selections are always returned in \
  35. * increasing offset order. Note that the order is only increasing \
  36. * for each call to H5Sget_seq_list(), the next set of sequences \
  37. * could start with an earlier offset than the previous one. \
  38. */
  39. #define H5S_SEL_ITER_SHARE_WITH_DATASPACE \
  40. 0x0002 /**< Don't copy the dataspace selection when creating the selection \
  41. * iterator. This can improve performance of creating the iterator, \
  42. * but the dataspace \Bold{MUST NOT} be modified or closed until the \
  43. * selection iterator is closed or the iterator's behavior will be \
  44. * undefined. \
  45. */
  46. /**
  47. * Types of dataspaces
  48. */
  49. typedef enum H5S_class_t {
  50. H5S_NO_CLASS = -1, /**< Error */
  51. H5S_SCALAR = 0, /**< Singleton (scalar) */
  52. H5S_SIMPLE = 1, /**< Regular grid */
  53. H5S_NULL = 2 /**< Empty set */
  54. } H5S_class_t;
  55. /**
  56. * Different ways of combining selections
  57. */
  58. typedef enum H5S_seloper_t {
  59. H5S_SELECT_NOOP = -1, /**< Error */
  60. H5S_SELECT_SET = 0, /**< Select "set" operation */
  61. H5S_SELECT_OR, /**< Binary "or" operation for hyperslabs
  62. * (add new selection to existing selection)
  63. * \code
  64. * Original region: AAAAAAAAAA
  65. * New region: BBBBBBBBBB
  66. * A or B: CCCCCCCCCCCCCCCC
  67. * \endcode
  68. */
  69. H5S_SELECT_AND, /**< Binary "and" operation for hyperslabs
  70. * (only leave overlapped regions in selection)
  71. * \code
  72. * Original region: AAAAAAAAAA
  73. * New region: BBBBBBBBBB
  74. * A and B: CCCC
  75. * \endcode
  76. */
  77. H5S_SELECT_XOR, /**< Binary "xor" operation for hyperslabs
  78. * (only leave non-overlapped regions in selection)
  79. * \code
  80. * Original region: AAAAAAAAAA
  81. * New region: BBBBBBBBBB
  82. * A xor B: CCCCCC CCCCCC
  83. * \endcode
  84. */
  85. H5S_SELECT_NOTB, /**< Binary "not" operation for hyperslabs
  86. * (only leave non-overlapped regions in original selection)
  87. * \code
  88. * Original region: AAAAAAAAAA
  89. * New region: BBBBBBBBBB
  90. * A not B: CCCCCC
  91. * \endcode
  92. */
  93. H5S_SELECT_NOTA, /**< Binary "not" operation for hyperslabs
  94. * (only leave non-overlapped regions in new selection)
  95. * \code
  96. * Original region: AAAAAAAAAA
  97. * New region: BBBBBBBBBB
  98. * B not A: CCCCCC
  99. * \endcode
  100. */
  101. H5S_SELECT_APPEND, /**< Append elements to end of point selection */
  102. H5S_SELECT_PREPEND, /**< Prepend elements to beginning of point selection */
  103. H5S_SELECT_INVALID /**< Invalid upper bound on selection operations */
  104. } H5S_seloper_t;
  105. /**
  106. * Selection type
  107. */
  108. typedef enum {
  109. H5S_SEL_ERROR = -1, /**< Error */
  110. H5S_SEL_NONE = 0, /**< Empty selection */
  111. H5S_SEL_POINTS = 1, /**< Set of points */
  112. H5S_SEL_HYPERSLABS = 2, /**< Hyperslab */
  113. H5S_SEL_ALL = 3, /**< Everything */
  114. H5S_SEL_N /**< Sentinel \internal THIS MUST BE LAST */
  115. } H5S_sel_type;
  116. #ifdef __cplusplus
  117. extern "C" {
  118. #endif
  119. /* Operations on dataspaces, dataspace selections and selection iterators */
  120. /**
  121. * \ingroup H5S
  122. *
  123. * \brief Releases and terminates access to a dataspace
  124. *
  125. * \space_id
  126. *
  127. * \return \herr_t
  128. *
  129. * \details H5Sclose() releases a dataspace. Further access through the
  130. * dataspace identifier is illegal. Failure to release a dataspace with this
  131. * call will result in resource leaks.
  132. *
  133. * \version 1.4.0 Fortran subroutine introduced in this release.
  134. * \since 1.0.0
  135. *
  136. */
  137. H5_DLL herr_t H5Sclose(hid_t space_id);
  138. /**
  139. * \ingroup H5S
  140. *
  141. * \brief Performs an operation on a hyperslab and an existing selection and
  142. * returns the resulting selection
  143. *
  144. * \space_id
  145. * \param[in] op Operation to perform on the current selection
  146. * \param[in] start Offset of the start of of the hyperslab
  147. * \param[in] stride Hyperslab stride
  148. * \param[in] count Number of blocks included in the hyperslab
  149. * \param[in] block Size of a block in the hyperslab
  150. *
  151. * \return \hid_tv{dataspace}
  152. *
  153. * \details H5Scombine_hyperslab() combines a hyperslab selection specified
  154. * by \p start, \p stride, \p count and \p block with the current
  155. * selection for the dataspace \p space_id, creating a new dataspace
  156. * to return the generated selection. If the current selection is
  157. * not a hyperslab, it is freed and the hyperslab parameters passed
  158. * in are combined with the #H5S_SEL_ALL hyperslab (ie. a selection
  159. * composing the entire current extent). If either \p stride or
  160. * \p block is NULL, then it will be set to \p 1.
  161. *
  162. * \since 1.12.0
  163. *
  164. */
  165. H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
  166. const hsize_t stride[], const hsize_t count[], const hsize_t block[]);
  167. /**
  168. * \ingroup H5S
  169. *
  170. * \brief Combine two hyperslab selections with an operation, returning a
  171. * dataspace with the resulting selection
  172. *
  173. * \space_id{space1_id}
  174. * \param[in] op Selection operator
  175. * \space_id{space2_id}
  176. *
  177. * \return \hid_t{dataspace}
  178. *
  179. * \details H5Scombine_select() combines two hyperslab selections
  180. * \p space1_id and \p space2_id with an operation, returning a
  181. * new dataspace with the resulting selection. The dataspace extent
  182. * from \p space1_id is copied for the dataspace extent of the
  183. * newly created dataspace.
  184. *
  185. * \since 1.12.0
  186. *
  187. */
  188. H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id);
  189. /**
  190. * \ingroup H5S
  191. *
  192. * \brief Creates an exact copy of a dataspace
  193. *
  194. * \space_id
  195. *
  196. * \return \hid_tv{dataspace}
  197. *
  198. * \details H5Scopy() creates a new dataspace which is an exact copy of the
  199. * dataspace identified by \p space_id. The dataspace identifier
  200. * returned from this function should be released with H5Sclose()
  201. * or resource leaks will occur.
  202. *
  203. * \version 1.4.0 Fortran subroutine introduced.
  204. * \since 1.0.0
  205. *
  206. */
  207. H5_DLL hid_t H5Scopy(hid_t space_id);
  208. /**
  209. * \ingroup H5S
  210. *
  211. * \brief Creates a new dataspace of a specified type
  212. *
  213. * \param[in] type Type of dataspace to be created
  214. *
  215. * \return \hid_t{dataspace}
  216. *
  217. * \details H5Screate() creates a new dataspace of a particular type. Currently
  218. * supported types are #H5S_SCALAR, #H5S_SIMPLE, and #H5S_NULL.
  219. *
  220. * Further dataspace types may be added later.
  221. *
  222. * A scalar dataspace, #H5S_SCALAR, has a single element, though that
  223. * element may be of a complex datatype, such as a compound or array
  224. * datatype. By convention, the rank of a scalar dataspace is always \p 0
  225. * (zero); think of it geometrically as a single, dimensionless point,
  226. * though that point can be complex.
  227. *
  228. * A simple dataspace, #H5S_SIMPLE, consists of a regular array of elements.
  229. *
  230. * A null dataspace, #H5S_NULL, has no data elements.
  231. *
  232. * The dataspace identifier returned by this function can be released with
  233. * H5Sclose() so that resource leaks will not occur.
  234. *
  235. * \version 1.4.0 Fortran subroutine introduced.
  236. * \since 1.0.0
  237. *
  238. */
  239. H5_DLL hid_t H5Screate(H5S_class_t type);
  240. /**
  241. * \ingroup H5S
  242. * \brief Creates a new simple dataspace and opens it for access
  243. *
  244. * \param[in] rank Number of dimensions of dataspace
  245. * \param[in] dims Array specifying the size of each dimension
  246. * \param[in] maxdims Array specifying the maximum size of each dimension
  247. *
  248. * \return \hid_t{dataspace}
  249. *
  250. * \details H5Screate_simple() creates a new simple dataspace and opens it
  251. * for access, returning a dataspace identifier.
  252. *
  253. * \p rank is the number of dimensions used in the dataspace.
  254. *
  255. * \p dims is a one-dimensional array of size rank specifying the
  256. * size of each dimension of the dataset. \p maxdims is an array of
  257. * the same size specifying the upper limit on the size of each
  258. * dimension.
  259. *
  260. * Any element of \p dims can be \p 0 (zero). Note that no data can
  261. * be written to a dataset if the size of any dimension of its current
  262. * dataspace is \p 0. This is sometimes a useful initial state for
  263. * a dataset.
  264. *
  265. * \p maxdims may be the null pointer, in which case the upper limit
  266. * is the same as \p dims. Otherwise, no element of \p maxdims
  267. * should be smaller than the corresponding element of \p dims.
  268. *
  269. * If an element of \p maxdims is #H5S_UNLIMITED, the maximum size of
  270. * the corresponding dimension is unlimited.
  271. *
  272. * Any dataset with an unlimited dimension must also be chunked; see
  273. * H5Pset_chunk(). Similarly, a dataset must be chunked if \p dims
  274. * does not equal \p maxdims.
  275. *
  276. * The dataspace identifier returned from this function must be
  277. * released with H5Sclose() or resource leaks will occur.
  278. *
  279. * \note Once a dataspace has been created, specific regions or elements in
  280. * the dataspace can be selected and selections can be removed, as well.
  281. * For example, H5Sselect_hyperslab() selects a region in a dataspace and
  282. * H5Sselect_elements() selects array elements in a dataspace. These
  283. * functions are used for subsetting. H5Sselect_none() removes all
  284. * selections from a dataspace and is used in Parallel HDF5 when a process
  285. * does not have or need to write data.
  286. *
  287. * \version 1.4.0 Fortran subroutine introduced.
  288. *
  289. * \since 1.0.0
  290. *
  291. */
  292. H5_DLL hid_t H5Screate_simple(int rank, const hsize_t dims[], const hsize_t maxdims[]);
  293. /**
  294. * \ingroup H5S
  295. *
  296. * \brief Decodes a binary object description of data space and returns a
  297. * new object handle
  298. *
  299. * \param[in] buf Buffer for the data space object to be decoded
  300. *
  301. * \return \hid_t{dataspace}
  302. *
  303. * \details Given an object description of a dataspace in binary in a
  304. * buffer, H5Sdecode() reconstructs the HDF5 data type object and
  305. * returns a new object handle for it. The binary description of the
  306. * object is encoded by H5Sencode(). The user is responsible for
  307. * passing in the right buffer. The types of dataspace addressed
  308. * in this function are null, scalar, and simple space. For a
  309. * simple dataspace, the selection information (for example,
  310. * hyperslab selection) is also encoded and decoded. A complex
  311. * dataspace has not been implemented in the library.
  312. *
  313. * \since 1.8.0
  314. *
  315. */
  316. H5_DLL hid_t H5Sdecode(const void *buf);
  317. /**
  318. * \ingroup H5S
  319. *
  320. * \brief Encodes a data space object description into a binary buffer
  321. *
  322. * \space_id{obj_id}
  323. * \param[in,out] buf Buffer for the object to be encoded into;
  324. * If the provided buffer is NULL, only the size
  325. * of buffer needed is returned through \p nalloc.
  326. * \param[in,out] nalloc The size of the allocated buffer
  327. * \fapl_id{fapl}
  328. *
  329. * \return \herr_t
  330. *
  331. * \details Given the data space identifier \p obj_id, H5Sencode2() converts
  332. * a data space description into binary form in a buffer. Using this
  333. * binary form in the buffer, a data space object can be
  334. * reconstructed with H5Sdecode() to return a new object handle
  335. * (#hid_t) for this data space.
  336. *
  337. * A preliminary H5Sencode2() call can be made to determine the
  338. * size of the buffer needed. This value is returned in \p nalloc.
  339. * That value can then be assigned to \p nalloc for a second
  340. * H5Sencode2() call, which will retrieve the actual encoded object.
  341. *
  342. * If the library determines that \p nalloc is not big enough for the
  343. * object, it simply returns the size of the buffer needed through
  344. * \p nalloc without encoding the provided buffer.
  345. *
  346. * The file access property list \p fapl_id is used to control the
  347. * encoding via the \a libver_bounds property (see
  348. * H5Pset_libver_bounds()). If the \a libver_bounds property is missing,
  349. * H5Sencode2() proceeds as if the \a libver_bounds property were set to
  350. * (#H5F_LIBVER_EARLIEST, #H5F_LIBVER_LATEST). (Functionally,
  351. * H5Sencode1() is identical to H5Sencode2() with \a libver_bounds set to
  352. * (#H5F_LIBVER_EARLIEST, #H5F_LIBVER_LATEST).)
  353. *
  354. * The types of data space that are addressed in this function are
  355. * null, scalar, and simple space. For a simple data space, the
  356. * information on the selection, for example, hyperslab selection,
  357. * is also encoded and decoded. A complex data space has not been
  358. * implemented in the library.
  359. *
  360. * \note Motivation: This function was introduced in HDF5-1.12 as part of the
  361. * H5Sencode() format change to enable 64-bit selection encodings and
  362. * a dataspace selection that is tied to a file. See the \ref_news_112
  363. * as well as the \ref_sencode_fmt_change.
  364. *
  365. * \since 1.12.0
  366. *
  367. */
  368. H5_DLL herr_t H5Sencode2(hid_t obj_id, void *buf, size_t *nalloc, hid_t fapl);
  369. /**
  370. * \ingroup H5S
  371. *
  372. * \brief Copies the extent of a dataspace
  373. *
  374. * \space_id{dst_id}
  375. * \space_id{src_id}
  376. *
  377. * \return \herr_t
  378. *
  379. * \details H5Sextent_copy() copies the extent from \p src_id to \p dst_id.
  380. * This action may change the type of the dataspace.
  381. *
  382. * \version 1.4.0 Fortran subroutine was introduced.
  383. * \since 1.0.0
  384. *
  385. */
  386. H5_DLL herr_t H5Sextent_copy(hid_t dst_id, hid_t src_id);
  387. /**
  388. * \ingroup H5S
  389. *
  390. * \brief Determines whether two dataspace extents are equal
  391. *
  392. * \space_id{space1_id}
  393. * \space_id{space2_id}
  394. *
  395. * \return \htri_t
  396. *
  397. * \details H5Sextent_equal() determines whether the dataspace extents of
  398. * two dataspaces, \p space1_id and \p space2_id, are equal.
  399. *
  400. * \since 1.8.0
  401. *
  402. */
  403. H5_DLL htri_t H5Sextent_equal(hid_t space1_id, hid_t space2_id);
  404. /**
  405. * \ingroup H5S
  406. *
  407. * \brief Retrieves a regular hyperslab selection
  408. *
  409. * \space_id{spaceid}
  410. * \param[out] start Offset of the start of the regular hyperslab
  411. * \param[out] stride Stride of the regular hyperslab
  412. * \param[out] count Number of blocks in the regular hyperslab
  413. * \param[out] block Size of a block in the regular hyperslab
  414. *
  415. * \return \herr_t
  416. *
  417. * \details H5Sget_regular_hyperslab() takes the dataspace identifier,
  418. * \p spaceid, and retrieves the values of \p start, \p stride,
  419. * \p count, and \p block for the regular hyperslab selection.
  420. *
  421. * A regular hyperslab selection is a hyperslab selection
  422. * described by setting the \p offset, \p stride, \p count, and
  423. * \p block parameters to the H5Sselect_hyperslab() call. If
  424. * several calls to H5Sselect_hyperslab() are needed, the
  425. * hyperslab selection is irregular.
  426. *
  427. * See H5Sselect_hyperslab() for descriptions of \p offset,
  428. * \p stride, \p count, and \p block.
  429. *
  430. * \note If a hyperslab selection is originally regular, then becomes
  431. * irregular through selection operations, and then becomes regular
  432. * again, the final regular selection may be equivalent but not
  433. * identical to the original regular selection.
  434. *
  435. * \since 1.10.0
  436. *
  437. */
  438. H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[], hsize_t count[],
  439. hsize_t block[]);
  440. /**
  441. * \ingroup H5S
  442. *
  443. * \brief Gets the bounding box containing the current selection
  444. *
  445. * \space_id{spaceid}
  446. * \param[out] start Starting coordinates of the bounding box
  447. * \param[out] end Ending coordinates of the bounding box, i.e., the
  448. * coordinates of the diagonally opposite corner
  449. *
  450. * \return \herr_t
  451. *
  452. * \details H5Sget_select_bounds() retrieves the coordinates of the bounding
  453. * box containing the current selection and places them into
  454. * user-supplied buffers.
  455. *
  456. * The \p start and \p end buffers must be large enough to hold
  457. * the dataspace rank number of coordinates.
  458. *
  459. * The bounding box exactly contains the selection. I.e., if a
  460. * 2-dimensional element selection is currently defined as containing
  461. * the points (4,5), (6,8), and (10,7), then the bounding box
  462. * will be (4, 5), (10, 8).
  463. *
  464. * The bounding box calculation includes the current offset of the
  465. * selection within the dataspace extent.
  466. *
  467. * Calling this function on a \a none selection will fail.
  468. *
  469. * \version 1.6.0 The \p start and \p end parameters have changed from type
  470. * \p hsize_t * to \p hssize_t *.
  471. * \version 1.4.0 Fortran subroutine was introduced.
  472. * \since 1.2.0
  473. *
  474. */
  475. H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[]);
  476. /**
  477. * \ingroup H5S
  478. *
  479. * \brief Gets the number of element points in the current selection
  480. *
  481. * \space_id{spaceid}
  482. *
  483. * \return Returns the number of element points in the current dataspace
  484. * selection if successful. Otherwise returns a negative value.
  485. *
  486. * \details H5Sget_select_elem_npoints() returns the number of element
  487. * points in the current dataspace selection, so that the element
  488. * points can be retrieved with H5Sget_select_elem_pointlist().
  489. * (This is similar to the way that H5Sget_select_hyper_nblocks()
  490. * and H5Sget_select_hyper_blocklist() work with hyperslab
  491. * selections.)
  492. *
  493. * Coincidentally, H5Sget_select_npoints() and
  494. * H5Sget_select_elem_npoints() will always return the same value
  495. * when an element selection is queried, but
  496. * H5Sget_select_elem_npoints() does not work with other selection
  497. * types.
  498. *
  499. * \since 1.2.0
  500. *
  501. */
  502. H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
  503. /**
  504. * \ingroup H5S
  505. *
  506. * \brief Gets the list of element points currently selected
  507. *
  508. * \space_id{spaceid}
  509. * \param[in] startpoint Element point to start with
  510. * \param[in] numpoints Number of element points to get
  511. * \param[out] buf List of element points selected
  512. *
  513. * \details H5Sget_select_elem_pointlist() returns the list of element
  514. * points in the current dataspace selection \p space_id. Starting
  515. * with the \p startpoint in the list of points, \p numpoints
  516. * points are put into the user's buffer. If the user's buffer
  517. * fills up before \p numpoints points are inserted, the buffer
  518. * will contain only as many points as fit.
  519. *
  520. * The element point coordinates have the same dimensionality
  521. * (rank) as the dataspace they are located within. The list of
  522. * element points is formatted as follows:\n
  523. * \<coordinate\>, followed by\n
  524. * the next coordinate,\n
  525. * etc.\n
  526. * until all of the selected element points have been listed.
  527. *
  528. * The points are returned in the order they will be iterated
  529. * through when the selection is read/written from/to disk.
  530. *
  531. * \since 1.2.0
  532. *
  533. */
  534. H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoints,
  535. hsize_t buf[/*numpoints*/]);
  536. /**
  537. * \ingroup H5S
  538. *
  539. * \brief Gets the list of hyperslab blocks currently selected
  540. *
  541. * \space_id{spaceid}
  542. * \param[in] startblock Hyperslab block to start with
  543. * \param[in] numblocks Number of hyperslab blocks to get
  544. * \param[out] buf List of hyperslab blocks selected
  545. *
  546. * \return \herr_t
  547. *
  548. * \details H5Sget_select_hyper_blocklist() returns a list of the hyperslab
  549. * blocks currently selected. Starting with the \p startblock-th block
  550. * in the list of blocks, \p numblocks blocks are put into the
  551. * user's buffer. If the user's buffer fills up before \p numblocks
  552. * blocks are inserted, the buffer will contain only as many blocks
  553. * as fit.
  554. *
  555. * The block coordinates have the same dimensionality (rank) as the
  556. * dataspace they are located within. The list of blocks is
  557. * formatted as follows:\n
  558. * \<"start" coordinate\>, immediately followed by\n
  559. * \<"opposite" corner coordinate\>, followed by\n
  560. * the next "start" and "opposite" coordinates,\n
  561. * etc. until all of the selected blocks have been listed.\n
  562. * No guarantee of any order of the blocks is implied.
  563. *
  564. * \since 1.2.0
  565. *
  566. */
  567. H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numblocks,
  568. hsize_t buf[/*numblocks*/]);
  569. /**
  570. * \ingroup H5S
  571. *
  572. * \brief Get number of hyperslab blocks
  573. *
  574. * \space_id{spaceid}
  575. *
  576. * \return Returns the number of hyperslab blocks in the current dataspace
  577. * selection if successful. Otherwise returns a negative value.
  578. *
  579. * \details H5Sget_select_hyper_nblocks() returns the number of hyperslab
  580. * blocks in the current dataspace selection.
  581. *
  582. * \since 1.2.0
  583. *
  584. */
  585. H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
  586. /**
  587. * \ingroup H5S
  588. *
  589. * \brief Determines the number of elements in a dataspace selection
  590. *
  591. * \space_id{spaceid}
  592. *
  593. * \return Returns the number of elements in the selection if successful;
  594. * otherwise returns a negative value.
  595. *
  596. * \details H5Sget_select_npoints() determines the number of elements in
  597. * the current selection of a dataspace. It works with any
  598. * selection type, and is the correct way to retrieve the number
  599. * of elements in a selection.
  600. *
  601. * \version 1.4.0 Fortran subroutine introduced in this release.
  602. * \since 1.0.0
  603. *
  604. */
  605. H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid);
  606. /**
  607. * \ingroup H5S
  608. *
  609. * \brief Determines the type of the dataspace selection
  610. *
  611. * \space_id{spaceid}
  612. *
  613. * \return Returns the dataspace selection type, a value of the enumerated
  614. * datatype #H5S_sel_type, if successful.
  615. *
  616. * \details H5Sget_select_type() retrieves the type of dataspace selection
  617. * currently defined for the dataspace \p space_id. Valid values
  618. * for the dataspace selection type are:
  619. *
  620. * <table>
  621. * <tr>
  622. * <td>#H5S_SEL_NONE</td>
  623. * <td>No selection is defined</td>
  624. * </tr>
  625. * <tr>
  626. * <td>#H5S_SEL_POINTS</td>
  627. * <td>A sequence of points is selected</td>
  628. * </tr>
  629. * <tr>
  630. * <td>#H5S_SEL_HYPERSLABS</td>
  631. * <td>A hyperslab or compound hyperslab is selected</td>
  632. * </tr>
  633. * <tr>
  634. * <td>#H5S_SEL_ALL</td>
  635. * <td>The entire dataset is selected</td>
  636. * </tr>
  637. * </table>
  638. *
  639. * Otherwise returns a negative value.
  640. *
  641. * \since 1.6.0
  642. *
  643. */
  644. H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
  645. /**
  646. * \ingroup H5S
  647. *
  648. * \brief Retrieves dataspace dimension size and maximum size
  649. *
  650. * \space_id
  651. * \param[out] dims Pointer to array to store the size of each dimension
  652. * \param[out] maxdims Pointer to array to store the maximum size of each
  653. * dimension
  654. *
  655. * \return Returns the number of dimensions in the dataspace if successful;
  656. * otherwise returns a negative value.
  657. *
  658. * \details H5Sget_simple_extent_dims() returns the size and maximum sizes
  659. * of each dimension of a dataspace \p space_id through the \p dims
  660. * and \p maxdims parameters.
  661. *
  662. * Either or both of \p dims and \p maxdims may be NULL.
  663. *
  664. * If a value in the returned array \p maxdims is #H5S_UNLIMITED (-1),
  665. * the maximum size of that dimension is unlimited.
  666. *
  667. * \version 1.4.0 Fortran subroutine introduced.
  668. * \since 1.0.0
  669. *
  670. */
  671. H5_DLL int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[], hsize_t maxdims[]);
  672. /**
  673. * \ingroup H5S
  674. *
  675. * \brief Determines the dimensionality of a dataspace
  676. *
  677. * \space_id
  678. *
  679. * \return Returns the number of dimensions in the dataspace if successful;
  680. * otherwise returns a negative value.
  681. *
  682. * \details H5Sget_simple_extent_ndims() determines the dimensionality (or
  683. * rank) of a dataspace.
  684. *
  685. * \version 1.4.0 Fortran subroutine introduced.
  686. * \since 1.0.0
  687. *
  688. */
  689. H5_DLL int H5Sget_simple_extent_ndims(hid_t space_id);
  690. /**
  691. * \ingroup H5S
  692. *
  693. * \brief Determines the number of elements in a dataspace
  694. *
  695. * \space_id
  696. *
  697. * \return Returns the number of elements in the dataspace if successful;
  698. * otherwise returns a negative value.
  699. *
  700. * \details H5Sget_simple_extent_npoints() determines the number of elements
  701. * in a dataspace \p space_id. For example, a simple 3-dimensional
  702. * dataspace with dimensions 2, 3, and 4 would have 24 elements.
  703. *
  704. * \version 1.4.0 Fortran subroutine introduced.
  705. * \since 1.0.0
  706. *
  707. */
  708. H5_DLL hssize_t H5Sget_simple_extent_npoints(hid_t space_id);
  709. /**
  710. * \ingroup H5S
  711. *
  712. * \brief Determines the current class of a dataspace
  713. *
  714. * \space_id
  715. *
  716. * \return Returns a dataspace class name if successful;
  717. * otherwise #H5S_NO_CLASS (-1).
  718. *
  719. * \details H5Sget_simple_extent_type() determines the current class of a
  720. * dataspace \p space_id.
  721. *
  722. * \version 1.4.0 Fortran subroutine was introduced.
  723. * \since 1.0.0
  724. *
  725. */
  726. H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id);
  727. /**
  728. * \ingroup H5S
  729. *
  730. * \brief Determines if a hyperslab selection is regular
  731. *
  732. * \space_id{spaceid}
  733. *
  734. * \return \htri_t
  735. *
  736. * \details H5Sis_regular_hyperslab() takes the dataspace identifier,
  737. * \p spaceid, and queries the type of the hyperslab selection.
  738. *
  739. * A regular hyperslab selection is a hyperslab selection described
  740. * by setting the offset, stride, count, and block parameters for
  741. * a single H5Sselect_hyperslab() call. If several calls to
  742. * H5Sselect_hyperslab() are needed, then the hyperslab selection
  743. * is irregular.
  744. *
  745. * \since 1.10.0
  746. *
  747. */
  748. H5_DLL htri_t H5Sis_regular_hyperslab(hid_t spaceid);
  749. /**
  750. * \ingroup H5S
  751. *
  752. * \brief Determines whether a dataspace is a simple dataspace
  753. *
  754. * \space_id
  755. *
  756. * \return \htri_t
  757. *
  758. * \details H5Sis_simple() determines whether or not a dataspace is a simple
  759. * dataspace.
  760. *
  761. * \note Currently, all dataspace objects are simple dataspaces; complex
  762. * dataspace support will be added in the future.
  763. *
  764. * \version 1.4.0 Fortran subroutine was introduced.
  765. * \since 1.0.0
  766. *
  767. */
  768. H5_DLL htri_t H5Sis_simple(hid_t space_id);
  769. /**
  770. * \ingroup H5S
  771. *
  772. * \brief Refines a hyperslab selection with an operation, using a second
  773. * hyperslab to modify it
  774. *
  775. * \space_id{space1_id}
  776. * \param[in] op Selection operator
  777. * \space_id{space2_id}
  778. *
  779. * \return \herr_t
  780. *
  781. * \details H5Smodify_select() refines an existing hyperslab selection
  782. * \p space1_id with an operation \p op, using a second hyperslab
  783. * \p space2_id. The first selection is modified to contain the
  784. * result of \p space1_id operated on by \p space2_id.
  785. *
  786. * \since 1.12.0
  787. *
  788. */
  789. H5_DLL herr_t H5Smodify_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id);
  790. /**
  791. * \ingroup H5S
  792. *
  793. * \brief Sets the offset of a simple dataspace
  794. *
  795. * \space_id
  796. * \param[in] offset The offset at which to position the selection
  797. *
  798. * \return \herr_t
  799. *
  800. * \details H5Soffset_simple() sets the offset of a simple dataspace
  801. * \p space_id. The offset array must be the same number of
  802. * elements as the number of dimensions for the dataspace. If the
  803. * \p offset array is set to NULL, the offset for the dataspace is
  804. * reset to 0.
  805. *
  806. * This function allows the same shaped selection to be moved to
  807. * different locations within a dataspace without requiring it to
  808. * be redefined.
  809. *
  810. * \version 1.4.0 Fortran subroutine was introduced.
  811. * \since 1.0.0
  812. *
  813. */
  814. H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
  815. /**
  816. * \ingroup H5S
  817. *
  818. * \brief Closes a dataspace selection iterator
  819. *
  820. * \space_id{sel_iter_id}
  821. *
  822. * \return \herr_t
  823. *
  824. * \details H5Ssel_iter_close() closes a dataspace selection iterator
  825. * specified by \p sel_iter_id, releasing its state.
  826. *
  827. * \since 1.12.0
  828. *
  829. */
  830. H5_DLL herr_t H5Ssel_iter_close(hid_t sel_iter_id);
  831. /**\ingroup H5S
  832. *
  833. * \brief Creates a dataspace selection iterator for a dataspace's selection
  834. *
  835. * \space_id{spaceid}
  836. * \param[in] elmt_size Size of element in the selection
  837. * \param[in] flags Selection iterator flag
  838. *
  839. * \return \hid_t{valid dataspace selection iterator}
  840. *
  841. * \details H5Ssel_iter_create() creates a selection iterator and initializes
  842. * it to start at the first element selected in the dataspace.
  843. *
  844. * \since 1.12.0
  845. *
  846. */
  847. H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags);
  848. /**
  849. * \ingroup H5S
  850. *
  851. * \brief Retrieves a list of offset / length sequences for the elements in
  852. * an iterator
  853. *
  854. * \space_id{sel_iter_id}
  855. * \param[in] maxseq Maximum number of sequences to retrieve
  856. * \param[in] maxbytes Maximum number of bytes to retrieve in sequences
  857. * \param[out] nseq Number of sequences retrieved
  858. * \param[out] nbytes Number of bytes retrieved, in all sequences
  859. * \param[out] off Array of sequence offsets
  860. * \param[out] len Array of sequence lengths
  861. *
  862. * \return \herr_t
  863. *
  864. * \details H5Ssel_iter_get_seq_list() retrieves a list of offset / length
  865. * pairs (a list of "sequences") matching the selected elements for
  866. * an iterator \p sel_iter_id, according to the iteration order for
  867. * the iterator. The lengths returned are in bytes, not elements.
  868. *
  869. * Note that the iteration order for "all" and "hyperslab"
  870. * selections is row-major (i.e. "C-ordered"), but the iteration
  871. * order for "point" selections is "in order selected", unless the
  872. * #H5S_SEL_ITER_GET_SEQ_LIST_SORTED flag is passed to
  873. * H5Ssel_iter_create() for a point selection.
  874. *
  875. * \p maxseq and \p maxbytes specify the most sequences or bytes
  876. * possible to place into the \p off and \p len arrays. \p nseq and
  877. * \p nbytes return the actual number of sequences and bytes put
  878. * into the arrays.
  879. *
  880. * Each call to H5Ssel_iter_get_seq_list() will retrieve the next
  881. * set of sequences for the selection being iterated over.
  882. *
  883. * The total number of bytes possible to retrieve from a selection
  884. * iterator is the \p elmt_size passed to H5Ssel_iter_create()
  885. * multiplied by the number of elements selected in the dataspace
  886. * the iterator was created from (which can be retrieved with
  887. * H5Sget_select_npoints(). When there are no further sequences of
  888. * elements to retrieve, calls to this routine will set \p nseq
  889. * and \p nbytes to zero.
  890. *
  891. * \since 1.12.0
  892. *
  893. */
  894. H5_DLL herr_t H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxbytes, size_t *nseq,
  895. size_t *nbytes, hsize_t *off, size_t *len);
  896. /**
  897. * \ingroup H5S
  898. *
  899. * \brief Resets a dataspace selection iterator back to an initial state
  900. *
  901. * \param[in] sel_iter_id Identifier of the dataspace selection iterator
  902. * to reset
  903. * \param[in] space_id Identifier of the dataspace with selection to
  904. * iterate over
  905. *
  906. * \return \herr_t
  907. *
  908. * \details H5Ssel_iter_reset() resets a dataspace selection iterator back to
  909. * an initial state so that the iterator may be used for iteration
  910. * once again.
  911. *
  912. * \since 1.12.1
  913. *
  914. */
  915. H5_DLL herr_t H5Ssel_iter_reset(hid_t sel_iter_id, hid_t space_id);
  916. /**
  917. * \ingroup H5S
  918. *
  919. * \brief Adjusts a selection by subtracting an offset
  920. *
  921. * \space_id{spaceid}
  922. * \param[in] offset Offset to subtract
  923. *
  924. * \return \herr_t
  925. *
  926. * \details H5Sselect_adjust() shifts a dataspace selection by a specified
  927. * logical offset within the dataspace extent.
  928. *
  929. * \note This can be useful for VOL developers to implement chunked datasets.
  930. *
  931. * \since 1.12.0
  932. */
  933. H5_DLL herr_t H5Sselect_adjust(hid_t spaceid, const hssize_t *offset);
  934. /**
  935. * \ingroup H5S
  936. *
  937. * \brief Selects an entire dataspace
  938. *
  939. * \space_id{spaceid}
  940. *
  941. * \return \herr_t
  942. *
  943. * \details H5Sselect_all() selects the entire extent of the dataspace
  944. * \p dspace_id.
  945. *
  946. * More specifically, H5Sselect_all() sets the selection type to
  947. * #H5S_SEL_ALL, which specifies the entire dataspace anywhere it
  948. * is applied.
  949. *
  950. * \since 1.0.0
  951. *
  952. */
  953. H5_DLL herr_t H5Sselect_all(hid_t spaceid);
  954. /**
  955. * \ingroup H5S
  956. *
  957. * \brief Copies a selection from one dataspace to another
  958. *
  959. * \space_id{dst_id}
  960. * \space_id{src_id}
  961. *
  962. * \return \herr_t
  963. *
  964. * \details H5Sselect_copy() copies all selection information (including
  965. * offset) from the source dataspace \p src_id to the destination
  966. * dataspace \p dst_id.
  967. *
  968. * \since 1.12.0
  969. *
  970. */
  971. H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id);
  972. /**
  973. * \ingroup H5S
  974. *
  975. * \brief Selects array elements to be included in the selection for a
  976. * dataspace
  977. *
  978. * \space_id
  979. * \param[in] op Operator specifying how the new selection is to be
  980. * combined with the existing selection for the dataspace
  981. * \param[in] num_elem Number of elements to be selected
  982. * \param[in] coord A pointer to a buffer containing a serialized copy of
  983. * a 2-dimensional array of zero-based values specifying
  984. * the coordinates of the elements in the point selection
  985. *
  986. * \return \herr_t
  987. *
  988. * \details H5Sselect_elements() selects array elements to be included in
  989. * the selection for the \p space_id dataspace. This is referred
  990. * to as a point selection.
  991. *
  992. * The number of elements selected is set in the \p num_elements
  993. * parameter.
  994. *
  995. * The \p coord parameter is a pointer to a buffer containing a
  996. * serialized 2-dimensional array of size \p num_elements by the
  997. * rank of the dataspace. The array lists dataset elements in the
  998. * point selection; that is, it’s a list of of zero-based values
  999. * specifying the coordinates in the dataset of the selected
  1000. * elements. The order of the element coordinates in the \p coord
  1001. * array specifies the order in which the array elements are
  1002. * iterated through when I/O is performed. Duplicate coordinate
  1003. * locations are not checked for. See below for examples of the
  1004. * mapping between the serialized contents of the buffer and the
  1005. * point selection array that it represents.
  1006. *
  1007. * The selection operator \p op determines how the new selection
  1008. * is to be combined with the previously existing selection for
  1009. * the dataspace. The following operators are supported:
  1010. *
  1011. * <table>
  1012. * <tr>
  1013. * <td>#H5S_SELECT_SET</td>
  1014. * <td>Replaces the existing selection with the parameters from
  1015. * this call. Overlapping blocks are not supported with this
  1016. * operator. Adds the new selection to the existing selection.
  1017. * </td>
  1018. * </tr>
  1019. * <tr>
  1020. * <td>#H5S_SELECT_APPEND</td>
  1021. * <td>Adds the new selection following the last element of the
  1022. * existing selection.</td>
  1023. * </tr>
  1024. * <tr>
  1025. * <td>#H5S_SELECT_PREPEND</td>
  1026. * <td>Adds the new selection preceding the first element of the
  1027. * existing selection.</td>
  1028. * </tr>
  1029. * </table>
  1030. *
  1031. * <b>Mapping the serialized \p coord buffer to a 2-dimensional
  1032. * point selection array:</b>
  1033. * To illustrate the construction of the contents of the \p coord
  1034. * buffer, consider two simple examples: a selection of 5 points in
  1035. * a 1-dimensional array and a selection of 3 points in a
  1036. * 4-dimensional array.
  1037. *
  1038. * In the 1D case, we will be selecting five points and a 1D
  1039. * dataspace has rank 1, so the selection will be described in a
  1040. * 5-by-1 array. To select the 1st, 14th, 17th, 23rd, 8th elements
  1041. * of the dataset, the selection array would be as follows
  1042. * (remembering that point coordinates are zero-based):
  1043. * \n 0
  1044. * \n 13
  1045. * \n 16
  1046. * \n 22
  1047. * \n 7
  1048. *
  1049. * This point selection array will be serialized in the \p coord
  1050. * buffer as:
  1051. * \n 0 13 16 22 7
  1052. *
  1053. * In the 4D case, we will be selecting three points and a 4D
  1054. * dataspace has rank 4, so the selection will be described in a
  1055. * 3-by-4 array. To select the points (1,1,1,1), (14,6,12,18), and
  1056. * (8,22,30,22), the point selection array would be as follows:
  1057. * \n 0 0 0 0
  1058. * \n 13 5 11 17
  1059. * \n 7 21 29 21
  1060. *
  1061. * This point selection array will be serialized in the \p coord
  1062. * buffer as:
  1063. * \n 0 0 0 0 13 5 11 17 7 21 29 21
  1064. *
  1065. * \version 1.6.4 C coord parameter type changed to \p const hsize_t.
  1066. * \version 1.6.4 Fortran \p coord parameter type changed to \p INTEGER(HSIZE_T).
  1067. * \since 1.0.0
  1068. *
  1069. */
  1070. H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op, size_t num_elem, const hsize_t *coord);
  1071. /**
  1072. * \ingroup H5S
  1073. *
  1074. * \brief Selects a hyperslab region to add to the current selected region
  1075. *
  1076. * \space_id
  1077. * \param[in] op Operation to perform on current selection
  1078. * \param[in] start Offset of start of hyperslab
  1079. * \param[in] stride Hyperslab stride
  1080. * \param[in] count Number of blocks included in hyperslab
  1081. * \param[in] block Size of block in hyperslab
  1082. *
  1083. * \return \herr_t
  1084. *
  1085. * \details H5Sselect_hyperslab() selects a hyperslab region to add to the
  1086. * current selected region for the dataspace specified by
  1087. * \p space_id.
  1088. *
  1089. * The \p start, \p stride, \p count, and \p block arrays must be the
  1090. * same size as the rank of the dataspace. For example, if the
  1091. * dataspace is 4-dimensional, each of these parameters must be a
  1092. * 1-dimensional array of size 4.
  1093. *
  1094. * The selection operator \p op determines how the new selection
  1095. * is to be combined with the already existing selection for the
  1096. * dataspace. The following operators are supported:
  1097. *
  1098. * <table>
  1099. * <tr>
  1100. * <td>#H5S_SELECT_SET</td>
  1101. * <td>Replaces the existing selection with the
  1102. * parameters from this call. Overlapping blocks
  1103. * are not supported with this operator.</td>
  1104. * </tr>
  1105. * <tr>
  1106. * <td>#H5S_SELECT_OR</td>
  1107. * <td>Adds the new selection to the existing selection.
  1108. * (Binary OR)</td>
  1109. * </tr>
  1110. * <tr>
  1111. * <td>#H5S_SELECT_AND</td>
  1112. * <td>Retains only the overlapping portions of the
  1113. * new selection and the existing selection.
  1114. * (Binary AND)</td>
  1115. * </tr>
  1116. * <tr>
  1117. * <td>#H5S_SELECT_XOR</td>
  1118. * <td>Retains only the elements that are members of
  1119. * the new selection or the existing selection,
  1120. * excluding elements that are members of both
  1121. * selections. (Binary exclusive-OR, XOR)
  1122. * </td>
  1123. * </tr>
  1124. * <tr>
  1125. * <td>#H5S_SELECT_NOTB</td>
  1126. * <td>Retains only elements of the existing selection
  1127. * that are not in the new selection.</td>
  1128. * </tr>
  1129. * <tr>
  1130. * <td>#H5S_SELECT_NOTA</td>
  1131. * <td>Retains only elements of the new selection that
  1132. * are not in the existing selection.</td>
  1133. * </tr>
  1134. * </table>
  1135. *
  1136. * The \p start array specifies the offset of the starting element
  1137. * of the specified hyperslab.
  1138. *
  1139. * The \p stride array chooses array locations from the dataspace with
  1140. * each value in the \p stride array determining how many elements to
  1141. * move in each dimension. Setting a value in the \p stride array to
  1142. * \p 1 moves to each element in that dimension of the dataspace;
  1143. * setting a value of \p 2 in allocation in the \p stride array moves
  1144. * to every other element in that dimension of the dataspace. In
  1145. * other words, the \p stride determines the number of elements to
  1146. * move from the \p start location in each dimension. Stride values
  1147. * of \p 0 are not allowed. If the \p stride parameter is NULL, a
  1148. * contiguous hyperslab is selected (as if each value in the \p stride
  1149. * array were set to \p 1).
  1150. *
  1151. * The \p count array determines how many blocks to select from the
  1152. * dataspace, in each dimension.
  1153. *
  1154. * The \p block array determines the size of the element block
  1155. * selected from the dataspace. If the \p block parameter is set to
  1156. * NULL, the block size defaults to a single element in each dimension
  1157. * (as if each value in the \p block array were set to \p 1).
  1158. *
  1159. * For example, consider a 2-dimensional dataspace with hyperslab
  1160. * selection settings as follows: the \p start offset is specified as
  1161. * [1,1], \p stride is [4,4], \p count is [3,7], and \p block is [2,2].
  1162. * In C, these settings will specify a hyperslab consisting of 21
  1163. * 2x2 blocks of array elements starting with location (1,1) with the
  1164. * selected blocks at locations (1,1), (5,1), (9,1), (1,5), (5,5), etc.;
  1165. * in Fortran, they will specify a hyperslab consisting of 21 2x2
  1166. * blocks of array elements starting with location (2,2) with the
  1167. * selected blocks at locations (2,2), (6,2), (10,2), (2,6), (6,6), etc.
  1168. *
  1169. * Regions selected with this function call default to C order
  1170. * iteration when I/O is performed.
  1171. *
  1172. * \version 1.4.0 Fortran subroutine introduced in this release.
  1173. * \since 1.0.0
  1174. *
  1175. */
  1176. H5_DLL herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
  1177. const hsize_t stride[], const hsize_t count[], const hsize_t block[]);
  1178. /*--------------------------------------------------------------------------*/
  1179. /**\ingroup H5S
  1180. *
  1181. * \brief Checks if current selection intersects with a block
  1182. *
  1183. * \space_id
  1184. * \param[in] start Starting coordinate of block
  1185. * \param[in] end Opposite ("ending") coordinate of block
  1186. *
  1187. * \return \htri_t
  1188. *
  1189. * \details H5Sselect_intersect_block() checks to see if the current
  1190. * selection \p space_id in the dataspace intersects with the block
  1191. * specified by \p start and \p end.
  1192. *
  1193. * \note Assumes that \p start & \p end block bounds are inclusive, so
  1194. * \p start == \p end value is OK.
  1195. *
  1196. * \since 1.12.0
  1197. *
  1198. */
  1199. H5_DLL htri_t H5Sselect_intersect_block(hid_t space_id, const hsize_t *start, const hsize_t *end);
  1200. /*--------------------------------------------------------------------------*/
  1201. /**\ingroup H5S
  1202. *
  1203. * \brief Resets the selection region to include no elements
  1204. *
  1205. * \space_id{spaceid}
  1206. *
  1207. * \return \herr_t
  1208. *
  1209. * \details H5Sselect_none() resets the selection region for the dataspace
  1210. * \p space_id to include no elements.
  1211. *
  1212. * \since 1.0.0
  1213. *
  1214. */
  1215. H5_DLL herr_t H5Sselect_none(hid_t spaceid);
  1216. /*--------------------------------------------------------------------------*/
  1217. /**\ingroup H5S
  1218. *
  1219. * \brief Projects the intersection of two source selections to a
  1220. * destination selection
  1221. *
  1222. * \space_id{src_space_id}
  1223. * \space_id{dst_space_id}
  1224. * \space_id{src_intersect_space_id}
  1225. *
  1226. * \return Returns a dataspace with a selection equal to the intersection of
  1227. * \p src_intersect_space_id and \p src_space_id projected from
  1228. * \p src_space to \p dst_space on success, negative on failure.
  1229. *
  1230. * \details H5Sselect_project_intersection() computes the intersection
  1231. * between two dataspace selections and projects that intersection
  1232. * into a third selection.This can be useful for VOL developers to
  1233. * implement chunked or virtual datasets.
  1234. *
  1235. * \since 1.12.0
  1236. *
  1237. */
  1238. H5_DLL hid_t H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id,
  1239. hid_t src_intersect_space_id);
  1240. /*--------------------------------------------------------------------------*/
  1241. /**\ingroup H5S
  1242. *
  1243. * \brief Checks if two selections are the same shape
  1244. *
  1245. * \space_id{space1_id}
  1246. * \space_id{space2_id}
  1247. *
  1248. * \return \htri_t
  1249. *
  1250. * \details H5Sselect_shape_same() checks to see if the current selection
  1251. * in the dataspaces are the same dimensionality and shape.
  1252. *
  1253. * This is primarily used for reading the entire selection in
  1254. * one swoop.
  1255. *
  1256. * \since 1.12.0
  1257. *
  1258. */
  1259. H5_DLL htri_t H5Sselect_shape_same(hid_t space1_id, hid_t space2_id);
  1260. /*--------------------------------------------------------------------------*/
  1261. /**\ingroup H5S
  1262. *
  1263. * \brief Verifies that the selection is within the extent of the dataspace
  1264. *
  1265. * \space_id{spaceid}
  1266. *
  1267. * \return \htri_t
  1268. *
  1269. * \details H5Sselect_valid() verifies that the selection for the dataspace
  1270. * \p space_id is within the extent of the dataspace if the current
  1271. * offset for the dataspace is used.
  1272. *
  1273. * \version 1.4.0 Fortran subroutine introduced in this release.
  1274. * \since 1.0.0
  1275. *
  1276. */
  1277. H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
  1278. /*--------------------------------------------------------------------------*/
  1279. /**\ingroup H5S
  1280. *
  1281. * \brief Resets the extent of a dataspace back to "none"
  1282. *
  1283. * \space_id
  1284. *
  1285. * \return \herr_t
  1286. *
  1287. * \details H5Sset_extent_none() resets the type of a dataspace to
  1288. * #H5S_NULL with no extent information stored for the dataspace.
  1289. *
  1290. * \version 1.10.7, 1.12.1 The function behavior changed. The previous
  1291. * behavior was to set the class to #H5S_NO_CLASS.
  1292. * \version 1.4.0 Fortran subroutine was introduced.
  1293. * \since 1.0.0
  1294. *
  1295. */
  1296. H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
  1297. /*--------------------------------------------------------------------------*/
  1298. /**\ingroup H5S
  1299. *
  1300. * \brief Sets or resets the size of an existing dataspace
  1301. *
  1302. * \space_id
  1303. * \param[in] rank Rank, or dimensionality, of the dataspace
  1304. * \param[in] dims Array containing current size of dataspace
  1305. * \param[in] max Array containing maximum size of dataspace
  1306. *
  1307. * \return \herr_t
  1308. *
  1309. * \details H5Sset_extent_simple() sets or resets the size of an existing
  1310. * dataspace.
  1311. *
  1312. * \p dims is an array of size \p rank which contains the new size
  1313. * of each dimension in the dataspace. \p max is an array of size
  1314. * \p rank which contains the maximum size of each dimension in
  1315. * the dataspace.
  1316. *
  1317. * Any previous extent is removed from the dataspace, the dataspace
  1318. * type is set to #H5S_SIMPLE, and the extent is set as specified.
  1319. *
  1320. * \version 1.4.0 Fortran subroutine was introduced.
  1321. * \since 1.0.0
  1322. *
  1323. */
  1324. H5_DLL herr_t H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[], const hsize_t max[]);
  1325. /* Symbols defined for compatibility with previous versions of the HDF5 API.
  1326. *
  1327. * Use of these symbols is deprecated.
  1328. */
  1329. #ifndef H5_NO_DEPRECATED_SYMBOLS
  1330. /* Function prototypes */
  1331. /* --------------------------------------------------------------------------*/
  1332. /**\ingroup H5S
  1333. *
  1334. * \brief Encodes a data space object description into a binary buffer
  1335. *
  1336. * \space_id{obj_id}
  1337. * \param[in,out] buf Buffer for the object to be encoded into;
  1338. * If the provided buffer is NULL, only the size of
  1339. * buffer needed is returned through \p nalloc.
  1340. * \param[in,out] nalloc The size of the allocated buffer
  1341. *
  1342. * \return \herr_t
  1343. *
  1344. * \deprecated Deprecated in favor of H5Sencode2()
  1345. *
  1346. * \details Given the data space identifier \p obj_id, H5Sencode1() converts
  1347. * a data space description into binary form in a buffer. Using
  1348. * this binary form in the buffer, a data space object can be
  1349. * reconstructed using H5Sdecode() to return a new object handle
  1350. * (\p hid_t) for this data space.
  1351. *
  1352. * A preliminary H5Sencode1() call can be made to find out the size
  1353. * of the buffer needed. This value is returned as \p nalloc. That
  1354. * value can then be assigned to \p nalloc for a second H5Sencode1()
  1355. * call, which will retrieve the actual encoded object.
  1356. *
  1357. * If the library finds out \p nalloc is not big enough for the
  1358. * object, it simply returns the size of the buffer needed through
  1359. * \p nalloc without encoding the provided buffer.
  1360. *
  1361. * The types of data space addressed in this function are null,
  1362. * scalar, and simple space. For a simple data space, the information
  1363. * on the selection, for example, hyperslab selection, is also
  1364. * encoded and decoded. A complex data space has not been
  1365. * implemented in the library.
  1366. *
  1367. * \version 1.12.0 The function H5Sencode() was renamed H5Sencode1() and
  1368. * deprecated.
  1369. * \since 1.8.0
  1370. *
  1371. */
  1372. H5_DLL herr_t H5Sencode1(hid_t obj_id, void *buf, size_t *nalloc);
  1373. #endif /* H5_NO_DEPRECATED_SYMBOLS */
  1374. #ifdef __cplusplus
  1375. }
  1376. #endif
  1377. #endif /* H5Spublic_H */