MISR Toolkit  1.5.1
H5Spkg.h
Go to the documentation of this file.
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://support.hdfgroup.org/ftp/HDF5/releases. *
10  * If you do not have access to either file, you may request a copy from *
11  * help@hdfgroup.org. *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /*
15  * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
16  * Thursday, September 28, 2000
17  *
18  * Purpose: This file contains declarations which are visible only within
19  * the H5S package. Source files outside the H5S package should
20  * include H5Sprivate.h instead.
21  */
22 #ifndef H5S_PACKAGE
23 #error "Do not include this file outside the H5S package!"
24 #endif
25 
26 #ifndef _H5Spkg_H
27 #define _H5Spkg_H
28 
29 #include "H5Sprivate.h"
30 
31 /* Flags to indicate special dataspace features are active */
32 #define H5S_VALID_MAX 0x01
33 #define H5S_VALID_PERM 0x02
34 
35 
36 /* Initial version of the dataspace information */
37 #define H5O_SDSPACE_VERSION_1 1
38 
39 /* This version adds support for "null" dataspaces, encodes the type of the
40  * dataspace in the message and eliminated the rest of the "reserved"
41  * bytes.
42  */
43 #define H5O_SDSPACE_VERSION_2 2
44 
45 /* The latest version of the format. Look through the 'encode'
46  * and 'size' callbacks for places to change when updating this. */
47 #define H5O_SDSPACE_VERSION_LATEST H5O_SDSPACE_VERSION_2
48 
49 /* Maximum values for uint16_t and uint32_t */
50 #define H5S_UINT16_MAX 65535 /* 2^16 - 1 */
51 #define H5S_UINT32_MAX 4294967295 /* 2^32 - 1 */
52 
53 /*
54  * Dataspace extent information
55  */
56 /* Extent container */
57 struct H5S_extent_t {
58  H5O_shared_t sh_loc; /* Shared message info (must be first) */
59 
60  H5S_class_t type; /* Type of extent */
61  unsigned version; /* Version of object header message to encode this object with */
62  hsize_t nelem; /* Number of elements in extent */
63 
64  unsigned rank; /* Number of dimensions */
65  hsize_t *size; /* Current size of the dimensions */
66  hsize_t *max; /* Maximum size of the dimensions */
67 };
68 
69 /*
70  * Dataspace selection information
71  */
72 /* Node in point selection list (typedef'd in H5Sprivate.h) */
74  hsize_t *pnt; /* Pointer to a selected point */
75  struct H5S_pnt_node_t *next; /* pointer to next point in list */
76 };
77 
78 /* Information about point selection list */
79 typedef struct {
80  H5S_pnt_node_t *head; /* Pointer to head of point list */
82 
83 /* Information about new-style hyperslab spans */
84 
85 /* Information a particular hyperslab span */
87  hsize_t low, high; /* Low & high bounds of span */
88  hsize_t nelem; /* Number of elements in span (only needed during I/O) */
89  hsize_t pstride; /* Pseudo-stride from start of previous span (only used during I/O) */
90  struct H5S_hyper_span_info_t *down; /* Pointer to list of spans in next dimension down */
91  struct H5S_hyper_span_t *next; /* Pointer to next span in list */
92 };
93 
94 /* Information about a list of hyperslab spans */
96  unsigned count; /* Ref. count of number of spans which share this span */
97  struct H5S_hyper_span_info_t *scratch; /* Scratch pointer
98  * (used during copies, as mark
99  * during precomputes for I/O &
100  * to point to the last span in a
101  * list during single element adds)
102  */
103  struct H5S_hyper_span_t *head; /* Pointer to list of spans in next dimension down */
104 };
105 
106 /* Information about new-style hyperslab selection */
107 typedef struct {
108  hbool_t diminfo_valid; /* Whether the dataset has valid diminfo */
109  H5S_hyper_dim_t opt_diminfo[H5S_MAX_RANK]; /* per-dim selection info */
110  H5S_hyper_dim_t app_diminfo[H5S_MAX_RANK]; /* per-dim selection info */
111  /* 'opt_diminfo' points to a [potentially] optimized version of the user's
112  * hyperslab information. 'app_diminfo' points to the actual parameters
113  * that the application used for setting the hyperslab selection. These
114  * are only used for re-gurgitating the original values used to set the
115  * hyperslab to the application when it queries the hyperslab selection
116  * information. */
117  H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information */
119 
120 /* Selection information methods */
121 /* Method to copy a selection */
122 typedef herr_t (*H5S_sel_copy_func_t)(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
123 /* Method to retrieve a list of offset/length sequences for selection */
124 typedef herr_t (*H5S_sel_get_seq_list_func_t)(const H5S_t *space, unsigned flags,
125  H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
126  size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
127 /* Method to release current selection */
129 /* Method to determine if current selection is valid for dataspace */
130 typedef htri_t (*H5S_sel_is_valid_func_t)(const H5S_t *space);
131 /* Method to determine number of bytes required to store current selection */
132 typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space);
133 /* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */
134 typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t *buf);
135 /* Method to store create selection from "serialized" form (a byte sequence suitable for storing on disk) */
136 typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t *space, const uint8_t *buf);
137 /* Method to determine smallest n-D bounding box containing the current selection */
138 typedef herr_t (*H5S_sel_bounds_func_t)(const H5S_t *space, hsize_t *start, hsize_t *end);
139 /* Method to determine linear offset of initial element in selection within dataspace */
140 typedef herr_t (*H5S_sel_offset_func_t)(const H5S_t *space, hsize_t *offset);
141 /* Method to determine if current selection is contiguous */
142 typedef htri_t (*H5S_sel_is_contiguous_func_t)(const H5S_t *space);
143 /* Method to determine if current selection is a single block */
144 typedef htri_t (*H5S_sel_is_single_func_t)(const H5S_t *space);
145 /* Method to determine if current selection is "regular" */
146 typedef htri_t (*H5S_sel_is_regular_func_t)(const H5S_t *space);
147 /* Method to adjust a selection by an offset */
148 typedef herr_t (*H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset);
149 /* Method to construct single element projection onto scalar dataspace */
150 typedef herr_t (*H5S_sel_project_scalar)(const H5S_t *space, hsize_t *offset);
151 /* Method to construct selection projection onto/into simple dataspace */
152 typedef herr_t (*H5S_sel_project_simple)(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
153 /* Method to initialize iterator for current selection */
154 typedef herr_t (*H5S_sel_iter_init_func_t)(H5S_sel_iter_t *sel_iter, const H5S_t *space);
155 
156 /* Selection class information */
157 typedef struct {
158  H5S_sel_type type; /* Type of selection (all, none, points or hyperslab) */
159 
160  /* Methods */
161  H5S_sel_copy_func_t copy; /* Method to make a copy of a selection */
162  H5S_sel_get_seq_list_func_t get_seq_list; /* Method to retrieve a list of offset/length sequences for selection */
163  H5S_sel_release_func_t release; /* Method to release current selection */
164  H5S_sel_is_valid_func_t is_valid; /* Method to determine if current selection is valid for dataspace */
165  H5S_sel_serial_size_func_t serial_size; /* Method to determine number of bytes required to store current selection */
166  H5S_sel_serialize_func_t serialize; /* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */
167  H5S_sel_deserialize_func_t deserialize; /* Method to store create selection from "serialized" form (a byte sequence suitable for storing on disk) */
168  H5S_sel_bounds_func_t bounds; /* Method to determine to smallest n-D bounding box containing the current selection */
169  H5S_sel_offset_func_t offset; /* Method to determine linear offset of initial element in selection within dataspace */
170  H5S_sel_is_contiguous_func_t is_contiguous; /* Method to determine if current selection is contiguous */
171  H5S_sel_is_single_func_t is_single; /* Method to determine if current selection is a single block */
172  H5S_sel_is_regular_func_t is_regular; /* Method to determine if current selection is "regular" */
173  H5S_sel_adjust_u_func_t adjust_u; /* Method to adjust a selection by an offset */
174  H5S_sel_project_scalar project_scalar; /* Method to construct scalar dataspace projection */
175  H5S_sel_project_simple project_simple; /* Method to construct simple dataspace projection */
176  H5S_sel_iter_init_func_t iter_init; /* Method to initialize iterator for current selection */
178 
179 /* Selection information object */
180 typedef struct {
181  const H5S_select_class_t *type; /* Pointer to selection's class info */
182  hbool_t offset_changed; /* Indicate that the offset for the selection has been changed */
183  hssize_t offset[H5S_MAX_RANK]; /* Offset within the extent */
184  hsize_t num_elem; /* Number of elements in selection */
185  union {
186  H5S_pnt_list_t *pnt_lst; /* List of selected points (order is important) */
187  H5S_hyper_sel_t *hslab; /* Info about hyperslab selections */
188  } sel_info;
189 } H5S_select_t;
190 
191 /* Main dataspace structure (typedef'd in H5Sprivate.h) */
192 struct H5S_t {
193  H5S_extent_t extent; /* Dataspace extent (must stay first) */
194  H5S_select_t select; /* Dataspace selection */
195 };
196 
197 /* Selection iteration methods */
198 /* Method to retrieve the current coordinates of iterator for current selection */
199 typedef herr_t (*H5S_sel_iter_coords_func_t)(const H5S_sel_iter_t *iter, hsize_t *coords);
200 /* Method to retrieve the current block of iterator for current selection */
201 typedef herr_t (*H5S_sel_iter_block_func_t)(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
202 /* Method to determine number of elements left in iterator for current selection */
203 typedef hsize_t (*H5S_sel_iter_nelmts_func_t)(const H5S_sel_iter_t *iter);
204 /* Method to determine if there are more blocks left in the current selection */
205 typedef htri_t (*H5S_sel_iter_has_next_block_func_t)(const H5S_sel_iter_t *iter);
206 /* Method to move selection iterator to the next element in the selection */
207 typedef herr_t (*H5S_sel_iter_next_func_t)(H5S_sel_iter_t *iter, size_t nelem);
208 /* Method to move selection iterator to the next block in the selection */
209 typedef herr_t (*H5S_sel_iter_next_block_func_t)(H5S_sel_iter_t *iter);
210 /* Method to release iterator for current selection */
211 typedef herr_t (*H5S_sel_iter_release_func_t)(H5S_sel_iter_t *iter);
212 
213 /* Selection iteration class */
214 typedef struct H5S_sel_iter_class_t {
215  H5S_sel_type type; /* Type of selection (all, none, points or hyperslab) */
216 
217  /* Methods on selections */
218  H5S_sel_iter_coords_func_t iter_coords; /* Method to retrieve the current coordinates of iterator for current selection */
219  H5S_sel_iter_block_func_t iter_block; /* Method to retrieve the current block of iterator for current selection */
220  H5S_sel_iter_nelmts_func_t iter_nelmts; /* Method to determine number of elements left in iterator for current selection */
221  H5S_sel_iter_has_next_block_func_t iter_has_next_block; /* Method to query if there is another block left in the selection */
222  H5S_sel_iter_next_func_t iter_next; /* Method to move selection iterator to the next element in the selection */
223  H5S_sel_iter_next_block_func_t iter_next_block; /* Method to move selection iterator to the next block in the selection */
224  H5S_sel_iter_release_func_t iter_release; /* Method to release iterator for current selection */
226 
227 /*
228  * All selection class methods.
229  */
231 
232 /*
233  * Hyperslab selection class methods.
234  */
236 
237 /*
238  * None selection class methods.
239  */
241 
242 /*
243  * Pointer selection class methods.
244  */
246 
247 /* Extent functions */
250  hbool_t copy_max);
251 
252 /* Operations on selections */
253 
254 /* Testing functions */
255 #ifdef H5S_TESTING
256 H5_DLL htri_t H5S_select_shape_same_test(hid_t sid1, hid_t sid2);
257 H5_DLL htri_t H5S_get_rebuild_status_test(hid_t space_id);
258 #endif /* H5S_TESTING */
259 
260 #endif /*_H5Spkg_H*/
261 
struct H5S_hyper_span_info_t * down
Definition: H5Spkg.h:90
HDFFCLIBAPI intf * len
H5S_sel_get_seq_list_func_t get_seq_list
Definition: H5Spkg.h:162
herr_t(* H5S_sel_copy_func_t)(H5S_t *dst, const H5S_t *src, hbool_t share_selection)
Definition: H5Spkg.h:122
H5S_sel_type type
Definition: H5Spkg.h:215
unsigned int hbool_t
Definition: H5public.h:142
unsigned count
Definition: H5Spkg.h:96
H5S_sel_type type
Definition: H5Spkg.h:158
htri_t(* H5S_sel_is_regular_func_t)(const H5S_t *space)
Definition: H5Spkg.h:146
H5S_pnt_list_t * pnt_lst
Definition: H5Spkg.h:186
htri_t(* H5S_sel_is_valid_func_t)(const H5S_t *space)
Definition: H5Spkg.h:130
H5S_sel_is_regular_func_t is_regular
Definition: H5Spkg.h:172
herr_t(* H5S_sel_iter_init_func_t)(H5S_sel_iter_t *sel_iter, const H5S_t *space)
Definition: H5Spkg.h:154
H5S_sel_copy_func_t copy
Definition: H5Spkg.h:161
H5S_sel_project_scalar project_scalar
Definition: H5Spkg.h:174
struct H5S_hyper_span_info_t * scratch
Definition: H5Spkg.h:97
#define H5_DLL
Definition: H5api_adpt.h:256
H5S_sel_is_valid_func_t is_valid
Definition: H5Spkg.h:164
H5S_sel_type
Definition: H5Spublic.h:79
int herr_t
Definition: H5public.h:124
hsize_t * size
Definition: H5Spkg.h:65
H5S_sel_is_contiguous_func_t is_contiguous
Definition: H5Spkg.h:170
herr_t(* H5S_sel_project_simple)(const H5S_t *space, H5S_t *new_space, hsize_t *offset)
Definition: H5Spkg.h:152
unsigned long long hsize_t
Definition: H5public.h:169
herr_t(* H5S_sel_get_seq_list_func_t)(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len)
Definition: H5Spkg.h:124
herr_t(* H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t *buf)
Definition: H5Spkg.h:134
htri_t(* H5S_sel_iter_has_next_block_func_t)(const H5S_sel_iter_t *iter)
Definition: H5Spkg.h:205
herr_t(* H5S_sel_release_func_t)(H5S_t *space)
Definition: H5Spkg.h:128
H5S_sel_iter_block_func_t iter_block
Definition: H5Spkg.h:219
struct H5S_hyper_span_t * head
Definition: H5Spkg.h:103
H5_DLLVAR const H5S_select_class_t H5S_sel_all[1]
Definition: H5Spkg.h:230
hsize_t num_elem
Definition: H5Spkg.h:184
H5_DLLVAR const H5S_select_class_t H5S_sel_none[1]
Definition: H5Spkg.h:240
herr_t(* H5S_sel_iter_coords_func_t)(const H5S_sel_iter_t *iter, hsize_t *coords)
Definition: H5Spkg.h:199
hbool_t offset_changed
Definition: H5Spkg.h:182
hssize_t(* H5S_sel_serial_size_func_t)(const H5S_t *space)
Definition: H5Spkg.h:132
herr_t(* H5S_sel_deserialize_func_t)(H5S_t *space, const uint8_t *buf)
Definition: H5Spkg.h:136
Definition: H5Spkg.h:192
herr_t(* H5S_sel_offset_func_t)(const H5S_t *space, hsize_t *offset)
Definition: H5Spkg.h:140
H5S_sel_iter_has_next_block_func_t iter_has_next_block
Definition: H5Spkg.h:221
herr_t(* H5S_sel_project_scalar)(const H5S_t *space, hsize_t *offset)
Definition: H5Spkg.h:150
htri_t(* H5S_sel_is_single_func_t)(const H5S_t *space)
Definition: H5Spkg.h:144
hsize_t * pnt
Definition: H5Spkg.h:74
hsize_t nelem
Definition: H5Spkg.h:88
herr_t(* H5S_sel_iter_next_func_t)(H5S_sel_iter_t *iter, size_t nelem)
Definition: H5Spkg.h:207
H5S_sel_iter_next_func_t iter_next
Definition: H5Spkg.h:222
H5O_shared_t sh_loc
Definition: H5Spkg.h:58
hsize_t * max
Definition: H5Spkg.h:66
H5S_sel_iter_init_func_t iter_init
Definition: H5Spkg.h:176
H5S_sel_adjust_u_func_t adjust_u
Definition: H5Spkg.h:173
int hid_t
Definition: H5Ipublic.h:54
H5S_sel_iter_next_block_func_t iter_next_block
Definition: H5Spkg.h:223
H5S_sel_iter_nelmts_func_t iter_nelmts
Definition: H5Spkg.h:220
struct H5S_hyper_span_t * next
Definition: H5Spkg.h:91
H5_DLLVAR const H5S_select_class_t H5S_sel_point[1]
Definition: H5Spkg.h:245
H5S_pnt_node_t * head
Definition: H5Spkg.h:80
H5S_extent_t extent
Definition: H5Spkg.h:193
herr_t(* H5S_sel_iter_release_func_t)(H5S_sel_iter_t *iter)
Definition: H5Spkg.h:211
H5S_sel_iter_coords_func_t iter_coords
Definition: H5Spkg.h:218
H5S_sel_offset_func_t offset
Definition: H5Spkg.h:169
H5S_hyper_sel_t * hslab
Definition: H5Spkg.h:187
const H5S_select_class_t * type
Definition: H5Spkg.h:181
hsize_t(* H5S_sel_iter_nelmts_func_t)(const H5S_sel_iter_t *iter)
Definition: H5Spkg.h:203
H5_DLLVAR const H5S_select_class_t H5S_sel_hyper[1]
Definition: H5Spkg.h:235
hsize_t nelem
Definition: H5Spkg.h:62
H5S_select_t select
Definition: H5Spkg.h:194
H5S_sel_release_func_t release
Definition: H5Spkg.h:163
herr_t(* H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset)
Definition: H5Spkg.h:148
HDFFCLIBAPI intf intf start[]
H5_DLL herr_t H5S_extent_release(H5S_extent_t *extent)
hbool_t diminfo_valid
Definition: H5Spkg.h:108
herr_t(* H5S_sel_bounds_func_t)(const H5S_t *space, hsize_t *start, hsize_t *end)
Definition: H5Spkg.h:138
H5S_sel_serial_size_func_t serial_size
Definition: H5Spkg.h:165
signed long long hssize_t
Definition: H5public.h:170
herr_t(* H5S_sel_iter_block_func_t)(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
Definition: H5Spkg.h:201
H5S_sel_deserialize_func_t deserialize
Definition: H5Spkg.h:167
hsize_t pstride
Definition: H5Spkg.h:89
HDFFCLIBAPI intf intf * flags
htri_t(* H5S_sel_is_contiguous_func_t)(const H5S_t *space)
Definition: H5Spkg.h:142
H5S_class_t type
Definition: H5Spkg.h:60
H5S_sel_iter_release_func_t iter_release
Definition: H5Spkg.h:224
#define H5S_MAX_RANK
Definition: H5Spublic.h:29
#define H5_DLLVAR
Definition: H5api_adpt.h:257
H5S_hyper_span_info_t * span_lst
Definition: H5Spkg.h:117
unsigned rank
Definition: H5Spkg.h:64
H5S_sel_serialize_func_t serialize
Definition: H5Spkg.h:166
H5S_sel_project_simple project_simple
Definition: H5Spkg.h:175
herr_t(* H5S_sel_iter_next_block_func_t)(H5S_sel_iter_t *iter)
Definition: H5Spkg.h:209
struct H5S_pnt_node_t * next
Definition: H5Spkg.h:75
HDFFCLIBAPI intf * offset
unsigned version
Definition: H5Spkg.h:61
int htri_t
Definition: H5public.h:143
H5_DLL herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max)
struct H5S_sel_iter_class_t H5S_sel_iter_class_t
H5S_class_t
Definition: H5Spublic.h:32
hsize_t low
Definition: H5Spkg.h:87
HDFFCLIBAPI intf * buf
H5S_sel_is_single_func_t is_single
Definition: H5Spkg.h:171
H5S_sel_bounds_func_t bounds
Definition: H5Spkg.h:168

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:53