| kspaceFirstOrder3D-CUDA 1.1 The CUDA/C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HDF5_File.h
Go to the documentation of this file.
1 /**
2 * @file HDF5_File.h
3 *
4 * @author Jiri Jaros \n
5 * Faculty of Information Technology \n
6 * Brno University of Technology \n
7 * jarosjir@fit.vutbr.cz
8 *
9 * @brief The header file containing the HDF5 related classes.
10 *
11 * @version kspaceFirstOrder3D 3.4
12 *
13 * @date 27 July 2012, 14:14 (created) \n
14 * 10 August 2016, 10:49 (revised)
15 *
16 *
17 * @section HDF HDF5 File Structure
18 *
19 * The CUDA/C++ code has been designed as a standalone application which is not dependent on MATLAB
20 * libraries or a MEX interface. This is of particular importance when using servers and
21 * supercomputers without MATLAB support. For this reason, simulation data must be transferred
22 * between the CUDA/C++ code and MATLAB using external input and output files. These files are
23 * stored using the Hierarchical Data Format HDF5 (http://www.hdfgroup.org/HDF5/). This is a data
24 * model, library, and file format for storing and managing data. It supports a variety of
25 * datatypes, and is designed for flexible and efficient I/O and for high volume and complex data.
26 * The HDF5 technology suite includes tools and applications for managing, manipulating, viewing,
27 * and analysing data in the HDF5 format.
28 *
29 *
30 * Each HDF5 file is a container for storing a variety of scientific data and is composed of two
31 * primary types of objects: groups and datasets. An HDF5 group is a structure containing zero or
32 * more HDF5 objects, together with supporting metadata. A HDF5 group can be seen as a disk folder.
33 * An HDF5 dataset is a multidimensional array of data elements, together with supporting metadata.
34 * A HDF5 dataset can be seen as a disk file. Any HDF5 group or dataset may also have an associated
35 * attribute list. An HDF5 attribute is a user-defined HDF5 structure that provides extra
36 * information about an HDF5 object. More information can be obtained from the HDF5 documentation
37 * (http://www.hdfgroup.org/HDF5/doc/index.html).
38 *
39 *
40 * kspaceFirstOrder3D-CUDA v1.1 introduces a new version of the HDF5 input and output file format.
41 * The code is happy to work with both versions (1.0 and 1.1), however when working with an input
42 * file of version 1.0, some features are not supported, namely the cuboid sensor mask, and
43 * u_non_staggered_raw. When running from within the actual MATLAB K-Wave Toolbox, the files will
44 * always be generated in version 1.1
45 *
46 * The HDF5 input file for the CUDA/C++ simulation code contains a file header with brief
47 * description of the simulation stored in string attributes, and the root group `/' which stores
48 * all the simulation properties in the form of 3D datasets (a complete list of input datasets is
49 * given bellow).
50 * The HDF5 checkpoint file contains the same file header as the input file and the root group `/'
51 * with a few datasets keeping the actual simulation state.
52 * The HDF5 output file contains a file header with the simulation description as well as
53 * performance statistics, such as the simulation time and memory consumption, stored in string
54 * attributes.
55
56 * The results of the simulation are stored in the root group `/' in the form of 3D datasets. If the
57 * linear sensor mask is used, all output quantities are stored as datasets in the root group. If
58 * the cuboid corners sensor mask is used, the sampled quantities form private groups containing
59 * datasets on per cuboid basis.
60 *
61 *
62 * \verbatim
63 ==============================================================================================================
64 Input File/Checkpoint File Header
65 =============================================================================================================
66 created_by Short description of the tool that created this file
67 creation_date Date when the file was created
68 file_description Short description of the content of the file (e.g. simulation name)
69 file_type Type of the file (input)
70 major_version Major version of the file definition (1)
71 minor_version Minor version of the file definition (1)
72 ==============================================================================================================
73 \endverbatim
74 *
75 * \verbatim
76 ==============================================================================================================
77 Output File Header
78 ==============================================================================================================
79 created_by Short description of the tool that created this file
80 creation_date Date when the file was created
81 file_description Short description of the content of the file (e.g. simulation name)
82 file_type Type of the file (output)
83 major_version Major version of the file definition (1)
84 minor_version Minor version of the file definition (1)
85 -------------------------------------------------------------------------------------------------------------
86 host_names List of hosts (computer names) the simulation was executed on
87 number_of_cpu_cores Number of CPU cores used for the simulation
88 data_loading_phase_execution_time Time taken to load data from the file
89 pre-processing_phase_execution_time Time taken to pre-process data
90 simulation_phase_execution_time Time taken to run the simulation
91 post-processing_phase_execution_time Time taken to complete the post-processing phase
92 total_execution_time Total execution time
93 peak_core_memory_in_use Peak memory required per core during the simulation
94 total_memory_in_use Total Peak memory in use
95 ==============================================================================================================
96 \endverbatim
97 *
98 *
99 *
100 * The input and checkpoint file stores all quantities as three dimensional datasets with dimension
101 * sizes designed by <tt>(Nx, Ny, Nz)</tt>. In order to support scalars and 1D and 2D arrays, the
102 * unused dimensions are set to 1. For example, scalar variables are stored with a dimension size of
103 * <tt>(1,1,1)</tt>, 1D vectors oriented in y-direction are stored with a dimension size of
104 * <tt>(1, Ny, 1)</tt>, and so on. If the dataset stores a complex variable, the real and imaginary
105 * parts are stored in an interleaved layout and the lowest used dimension size is doubled (i.e.,
106 * Nx for a 3D matrix, Ny for a 1D vector oriented in the y-direction). The datasets are physically
107 * stored in row-major order (in contrast to column-major order used by MATLAB) using either the
108 * <tt>`H5T_IEEE_F32LE'</tt> data type for floating point datasets or <tt>`H5T_STD_U64LE'</tt> for
109 * integer based datasets. All the datasets are store under the root group.
110 *
111 *
112 * The output file of version 1.0 could only store recorded quantities as 3D datasets under the
113 * root group. However, with version 1.1 and the new cuboid corner sensor mask, the sampled
114 * quantities may be laid out as 4D quantities stored under specific groups. The dimensions are
115 * always <tt>(Nx, Ny, Nz, Nt)</tt>, every sampled cuboid is stored as a distinct dataset and the
116 * datasets are grouped under a group named by the quantity stored. This makes the file
117 * clearly readable and easy to parse.
118 *
119 *
120 * In order to enable compression and more efficient data processing, big datasets are not stored as
121 * monolithic blocks but broken into chunks that may be compressed by the ZIP library and stored
122 * separately. The chunk size is defined as follows:
123 *
124 * \li <tt> (1M elements, 1, 1) </tt> in the case of 1D variables - index sensor mask (8MB blocks).
125 * \li <tt> (Nx, Ny, 1) </tt> in the case of 3D variables (one 2D slab).
126 * \li <tt> (Nx, Ny, Nz, 1) </tt> in the case of 4D variables (one time step).
127 * \li <tt> (N_sensor_points, 1, 1) </tt> in the case of the output time series (one time step of
128 * the simulation).
129 *
130 *
131 * All datasets have two attributes that specify the content of the dataset. The \c `data_type'
132 * attribute specifies the data type of the dataset. The admissible values are either \c `float' or
133 * \c `long'. The \c `domain_type' attribute specifies the domain of the dataset. The admissible
134 * values are either \c `real' for the real domain or \c `complex' for the complex domain. The
135 * C++ code reads these attributes and checks their values.
136 *
137 *
138 *
139 * \verbatim
140 ==============================================================================================================
141 Input File Datasets
142 ==============================================================================================================
143 Name Size Data type Domain Type Condition of Presence
144 ==============================================================================================================
145 1. Simulation Flags
146 --------------------------------------------------------------------------------------------------------------
147 ux_source_flag (1, 1, 1) long real
148 uy_source_flag (1, 1, 1) long real
149 uz_source_flag (1, 1, 1) long real
150 p_source_flag (1, 1, 1) long real
151 p0_source_flag (1, 1, 1) long real
152 transducer_source_flag (1, 1, 1) long real
153 nonuniform_grid_flag (1, 1, 1) long real must be set to 0
154 nonlinear_flag (1, 1, 1) long real
155 absorbing_flag (1, 1, 1) long real
156 --------------------------------------------------------------------------------------------------------------
157 2. Grid Properties
158 --------------------------------------------------------------------------------------------------------------
159 Nx (1, 1, 1) long real
160 Ny (1, 1, 1) long real
161 Nz (1, 1, 1) long real
162 Nt (1, 1, 1) long real
163 dt (1, 1, 1) float real
164 dx (1, 1, 1) float real
165 dy (1, 1, 1) float real
166 dz (1, 1, 1) float real
167 --------------------------------------------------------------------------------------------------------------
168 3 Medium Properties
169 --------------------------------------------------------------------------------------------------------------
170 3.1 Regular Medium Properties
171 rho0 (Nx, Ny, Nz) float real heterogenous
172 (1, 1, 1) float real homogenous
173 rho0_sgx (Nx, Ny, Nz) float real heterogenous
174 (1, 1, 1) float real homogenous
175 rho0_sgy (Nx, Ny, Nz) float real heterogenous
176 (1, 1, 1) float real homogenous
177 rho0_sgz (Nx, Ny, Nz) float real heterogenous
178 (1, 1, 1) float real homogenous
179 c0 (Nx, Ny, Nz) float real heterogenous
180 (1, 1, 1) float real homogenous
181 c_ref (1, 1, 1) float real
182
183 3.2 Nonlinear Medium Properties (defined if (nonlinear_flag == 1))
184 BonA (Nx, Ny, Nz) float real heterogenous
185 (1, 1, 1) float real homogenous
186
187 3.3 Absorbing Medium Properties (defined if (absorbing_flag == 1))
188 alpha_coef (Nx, Ny, Nz) float real heterogenous
189 (1, 1, 1) float real homogenous
190 alpha_power (1, 1, 1) float real
191 --------------------------------------------------------------------------------------------------------------
192 4. Sensor Variables
193 --------------------------------------------------------------------------------------------------------------
194 sensor_mask_type (1, 1, 1) long real file version 1.1 (0 = index, 1 = corners)
195 sensor_mask_index (Nsens, 1, 1) long real file version 1.0 always, File version 1.1 if sensor_mask_type == 0
196 sensor_mask_corners (Ncubes, 6, 1) long real file version 1.1, if sensor_mask_type == 1
197 --------------------------------------------------------------------------------------------------------------
198 5 Source Properties
199 --------------------------------------------------------------------------------------------------------------
200 5.1 Velocity Source Terms (defined if (ux_source_flag == 1 || uy_source_flag == 1 || uz_source_flag == 1))
201 u_source_mode (1, 1, 1) long real
202 u_source_many (1, 1, 1) long real
203 u_source_index (Nsrc, 1, 1) long real
204 ux_source_input (1, Nt_src, 1) float real u_source_many == 0
205 (Nsrc, Nt_src, 1) float real u_source_many == 1
206 uy_source_input (1, Nt_src, 1) float real u_source_many == 0
207 (Nsrc, Nt_src, 1) float real u_source_many == 1
208 uz_source_input (1, Nt_src, 1) float real u_source_many == 0
209 (Nt_src, Nsrc, 1) float real u_source_many == 1
210
211 5.2 Pressure Source Terms (defined if (p_source_flag == 1))
212 p_source_mode (1, 1, 1) long real
213 p_source_many (1, 1, 1) long real
214 p_source_index (Nsrc, 1, 1) long real
215 p_source_input (Nsrc, Nt_src, 1) float real p_source_many == 1
216 (1, Nt_src, 1) float real p_source_many == 0
217
218 5.3 Transducer Source Terms (defined if (transducer_source_flag == 1))
219 u_source_index (Nsrc, 1, 1) long real
220 transducer_source_input (Nt_src, 1, 1) float real
221 delay_mask (Nsrc, 1, 1) float real
222
223 5.4 IVP Source Terms (defined if ( p0_source_flag ==1))
224 p0_source_input (Nx, Ny, Nz) float real
225 --------------------------------------------------------------------------------------------------------------
226 6. K-space and Shift Variables
227 --------------------------------------------------------------------------------------------------------------
228 ddx_k_shift_pos_r (Nx/2 + 1, 1, 1) float complex
229 ddx_k_shift_neg_r (Nx/2 + 1, 1, 1) float complex
230 ddy_k_shift_pos (1, Ny, 1) float complex
231 ddy_k_shift_neg (1, Ny, 1) float complex
232 ddz_k_shift_pos (1, 1, Nz) float complex
233 ddz_k_shift_neg (1, 1, Nz) float complex
234 x_shift_neg_r (Nx/2 + 1, 1, 1) float complex file version 1.1
235 y_shift_neg_r (1, Ny/2 + 1, 1) float complex file version 1.1
236 z_shift_neg_r (1, 1, Nz/2) float complex file version 1.1
237 --------------------------------------------------------------------------------------------------------------
238 7. PML Variables
239 --------------------------------------------------------------------------------------------------------------
240 pml_x_size (1, 1, 1) long real
241 pml_y_size (1, 1, 1) long real
242 pml_z_size (1, 1, 1) long real
243 pml_x_alpha (1, 1, 1) float real
244 pml_y_alpha (1, 1, 1) float real
245 pml_z_alpha (1, 1, 1) float real
246
247 pml_x (Nx, 1, 1) float real
248 pml_x_sgx (Nx, 1, 1) float real
249 pml_y (1, Ny, 1) float real
250 pml_y_sgy (1, Ny, 1) float real
251 pml_z (1, 1, Nz) float real
252 pml_z_sgz (1, 1, Nz) float real
253 ==============================================================================================================
254 \endverbatim
255
256 \verbatim
257 ==============================================================================================================
258 Checkpoint File Datasets
259 ==============================================================================================================
260 Name Size Data type Domain Type Condition of Presence
261 ==============================================================================================================
262 1. Grid Properties
263 --------------------------------------------------------------------------------------------------------------
264 Nx (1, 1, 1) long real
265 Ny (1, 1, 1) long real
266 Nz (1, 1, 1) long real
267 Nt (1, 1, 1) long real
268 t_index (1, 1, 1) long real
269 --------------------------------------------------------------------------------------------------------------
270 2. Simulation State
271 --------------------------------------------------------------------------------------------------------------
272 p (Nx, Ny, Nz) float real
273 ux_sgx (Nx, Ny, Nz) float real
274 uy_sgy (Nx, Ny, Nz) float real
275 uz_sgz (Nx, Ny, Nz) float real
276 rhox (Nx, Ny, Nz) float real
277 rhoy (Nx, Ny, Nz) float real
278 rhoz (Nx, Ny, Nz) float real
279 --------------------------------------------------------------------------------------------------------------
280 \endverbatim
281
282
283 \verbatim
284 ==============================================================================================================
285 Output File Datasets
286 ==============================================================================================================
287 Name Size Data type Domain Type Condition of Presence
288 ==============================================================================================================
289 1. Simulation Flags
290 --------------------------------------------------------------------------------------------------------------
291 ux_source_flag (1, 1, 1) long real
292 uy_source_flag (1, 1, 1) long real
293 uz_source_flag (1, 1, 1) long real
294 p_source_flag (1, 1, 1) long real
295 p0_source_flag (1, 1, 1) long real
296 transducer_source_flag (1, 1, 1) long real
297 nonuniform_grid_flag (1, 1, 1) long real
298 nonlinear_flag (1, 1, 1) long real
299 absorbing_flag (1, 1, 1) long real
300 u_source_mode (1, 1, 1) long real if u_source
301 u_source_many (1, 1, 1) long real if u_source
302 p_source_mode (1, 1, 1) long real if p_source
303 p_source_many (1, 1, 1) long real if p_source
304 --------------------------------------------------------------------------------------------------------------
305 2. Grid Properties
306 --------------------------------------------------------------------------------------------------------------
307 Nx (1, 1, 1) long real
308 Ny (1, 1, 1) long real
309 Nz (1, 1, 1) long real
310 Nt (1, 1, 1) long real
311 dt (1, 1, 1) float real
312 dx (1, 1, 1) float real
313 dy (1, 1, 1) float real
314 dz (1, 1, 1) float real
315 -------------------------------------------------------------------------------------------------------------
316 3. PML Variables
317 --------------------------------------------------------------------------------------------------------------
318 pml_x_size (1, 1, 1) long real
319 pml_y_size (1, 1, 1) long real
320 pml_z_size (1, 1, 1) long real
321 pml_x_alpha (1, 1, 1) float real
322 pml_y_alpha (1, 1, 1) float real
323 pml_z_alpha (1, 1, 1) float real
324
325 pml_x (Nx, 1, 1) float real
326 pml_x_sgx (Nx, 1, 1) float real
327 pml_y (1, Ny, 1) float real
328 pml_y_sgy (1, Ny, 1) float real
329 pml_z (1, 1, Nz) float real
330 pml_z_sgz (1, 1, Nz) float real
331 --------------------------------------------------------------------------------------------------------------
332 4. Sensor Variables (present if --copy_sensor_mask)
333 --------------------------------------------------------------------------------------------------------------
334 sensor_mask_type (1, 1, 1) long real file version 1.1 and --copy_sensor_mask
335 sensor_mask_index (Nsens, 1, 1) long real file version 1.1 and if sensor_mask_type == 0
336 sensor_mask_corners (Ncubes, 6, 1) long real file version 1.1 and if sensor_mask_type == 1
337 --------------------------------------------------------------------------------------------------------------
338 5a. Simulation Results: if sensor_mask_type == 0 (index), or File version == 1.0
339 --------------------------------------------------------------------------------------------------------------
340 p (Nsens, Nt - s, 1) float real -p or --p_raw
341 p_rms (Nsens, 1, 1) float real --p_rms
342 p_max (Nsens, 1, 1) float real --p_max
343 p_min (Nsens, 1, 1) float real --p_min
344 p_max_all (Nx, Ny, Nz) float real --p_max_all
345 p_min_all (Nx, Ny, Nz) float real --p_min_all
346 p_final (Nx, Ny, Nz) float real --p_final
347
348
349 ux (Nsens, Nt - s, 1) float real -u or --u_raw
350 uy (Nsens, Nt - s, 1) float real -u or --u_raw
351 uz (Nsens, Nt - s, 1) float real -u or --u_raw
352
353 ux_non_staggered (Nsens, Nt - s, 1) float real --u_non_staggered_raw (File version ==1.1)
354 uy_non_staggered (Nsens, Nt - s, 1) float real --u_non_staggered_raw (File version ==1.1)
355 uz_non_staggered (Nsens, Nt - s, 1) float real --u_non_staggered_raw (File version ==1.1)
356
357 ux_rms (Nsens, 1, 1) float real --u_rms
358 uy_rms (Nsens, 1, 1) float real --u_rms
359 uz_rms (Nsens, 1, 1) float real --u_rms
360
361 ux_max (Nsens, 1, 1) float real --u_max
362 uy_max (Nsens, 1, 1) float real --u_max
363 uz_max (Nsens, 1, 1) float real --u_max
364
365 ux_min (Nsens, 1, 1) float real --u_min
366 uy_min (Nsens, 1, 1) float real --u_min
367 uz_min (Nsens, 1, 1) float real --u_min
368
369 ux_max_all (Nx, Ny, Nz) float real --u_max_all
370 uy_max_all (Nx, Ny, Nz) float real --u_max_all
371 uz_max_all (Nx, Ny, Nz) float real --u_max_all
372
373 ux_min_all (Nx, Ny, Nz) float real --u_min_all
374 uy_min_all (Nx, Ny, Nz) float real --u_min_all
375 uz_min_all (Nx, Ny, Nz) float real --u_min_all
376
377 ux_final (Nx, Ny, Nz) float real --u_final
378 uy_final (Nx, Ny, Nz) float real --u_final
379 uz_final (Nx, Ny, Nz) float real --u_final
380 --------------------------------------------------------------------------------------------------------------
381 5b. Simulation Results: if sensor_mask_type == 1 (corners) and file version == 1.1
382 --------------------------------------------------------------------------------------------------------------
383 /p group of datasets, one per cuboid -p or --p_raw
384 /p/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
385 /p/2 (Cx, Cy, Cz, Nt-s) float real 2nd sampled cuboid, etc.
386
387 /p_rms group of datasets, one per cuboid --p_rms
388 /p_rms/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
389
390 /p_max group of datasets, one per cuboid --p_max
391 /p_max/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
392
393 /p_min group of datasets, one per cuboid --p_min
394 /p_min/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
395
396 p_max_all (Nx, Ny, Nz) float real --p_max_all
397 p_min_all (Nx, Ny, Nz) float real --p_min_all
398 p_final (Nx, Ny, Nz) float real --p_final
399
400
401 /ux group of datasets, one per cuboid -u or --u_raw
402 /ux/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
403 /uy group of datasets, one per cuboid -u or --u_raw
404 /uy/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
405 /uz group of datasets, one per cuboid -u or --u_raw
406 /uz/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
407
408 /ux_non_staggered group of datasets, one per cuboid --u_non_staggered_raw
409 /ux_non_staggered/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
410 /uy_non_staggered group of datasets, one per cuboid --u_non_staggered_raw
411 /uy_non_staggered/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
412 /uz_non_staggered group of datasets, one per cuboid --u_non_staggered_raw
413 /uz_non_staggered/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
414
415 /ux_rms group of datasets, one per cuboid --u_rms
416 /ux_rms/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
417 /uy_rms group of datasets, one per cuboid --u_rms
418 /uy_rms/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
419 /uz_rms group of datasets, one per cuboid --u_rms
420 /uy_rms/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
421
422 /ux_max group of datasets, one per cuboid --u_max
423 /ux_max/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
424 /uy_max group of datasets, one per cuboid --u_max
425 /ux_max/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
426 /uz_max group of datasets, one per cuboid --u_max
427 /ux_max/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
428
429 /ux_min group of datasets, one per cuboid --u_min
430 /ux_min/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
431 /uy_min group of datasets, one per cuboid --u_min
432 /ux_min/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
433 /uz_min group of datasets, one per cuboid --u_min
434 /ux_min/1 (Cx, Cy, Cz, Nt-s) float real 1st sampled cuboid
435
436 ux_max_all (Nx, Ny, Nz) float real --u_max_all
437 uy_max_all (Nx, Ny, Nz) float real --u_max_all
438 uz_max_all (Nx, Ny, Nz) float real --u_max_all
439
440 ux_min_all (Nx, Ny, Nz) float real --u_min_all
441 uy_min_all (Nx, Ny, Nz) float real --u_min_all
442 uz_min_all (Nx, Ny, Nz) float real --u_min_all
443
444 ux_final (Nx, Ny, Nz) float real --u_final
445 uy_final (Nx, Ny, Nz) float real --u_final
446 uz_final (Nx, Ny, Nz) float real --u_final
447 ==============================================================================================================
448 \endverbatim
449 *
450 *
451 *
452 * @section License
453 * This file is part of the C++ extension of the k-Wave Toolbox
454 * (http://www.k-wave.org).\n Copyright (C) 2016 Jiri Jaros and Bradley Treeby.
455 *
456 * This file is part of the k-Wave. k-Wave is free software: you can redistribute it and/or modify
457 * it under the terms of the GNU Lesser General Public License as published by the Free Software
458 * Foundation, either version 3 of the License, or (at your option) any later version.
459 *
460 * k-Wave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
461 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
462 * General Public License for more details.
463 *
464 * You should have received a copy of the GNU Lesser General Public License along with k-Wave.
465 * If not, see http://www.gnu.org/licenses/.
466 */
467
468 #ifndef THDF5_FILE_H
469 #define THDF5_FILE_H
470
471
472 #include <hdf5.h>
473 #include <hdf5_hl.h>
474 #include <cstring>
475 #include <map>
476
477 // Linux build
478 #ifdef __linux__
479 #include <unistd.h>
480 #endif
481 // Windows build
482 #ifdef _WIN64
483 #include <io.h>
484 #endif
485
486 #include <Utils/DimensionSizes.h>
487 #include <Utils/MatrixNames.h>
488
489
490 // Class with File header
491 class THDF5_FileHeader;
492
493 /**
494 * @class THDF5_File
495 * @brief Class wrapping the HDF5 routines.
496 * @details This class is responsible for working with HDF5 files. It offers routines to manage
497 * files (create, open, close) as well as creating, reading and modifying the contents
498 * (groups and datasets).
499 */
500 class THDF5_File
501 {
502 public:
503
504 /**
505 * @enum TMatrixDataType
506 * @brief HDF5 matrix data type (float or uint64).
507 * @details HDF5 matrix data type (float or uint64).
508 */
509 enum TMatrixDataType
510 {
511 FLOAT = 0,
512 LONG = 1
513 };
514
515 /**
516 * @enum TMatrixDomainType
517 * @brief HDF5 Matrix domain type (real or complex).
518 * @details HDF5 Matrix domain type (real or complex).
519 */
520 enum TMatrixDomainType
521 {
522 REAL = 0,
523 COMPLEX = 1
524 };
525
526
527 /// Constructor of the class.
528 THDF5_File();
529 /// Destructor.
530 virtual ~THDF5_File();
531
532 //----------------------- Basic file operations --------------------------//
533 /// Create a file.
534 void Create(const std::string& fileName,
535 unsigned int flags = H5F_ACC_TRUNC);
536
537 /// Open a file.
538 void Open(const std::string& fileName,
539 unsigned int flags = H5F_ACC_RDONLY);
540 /**
541 * @brief Is the file opened?
542 * @details Is the file opened?
543 * @return true if the file is opened.
544 */
545 bool IsOpen() const {return file != H5I_BADID;};
546
547 /**
548 * @brief Does the file exist?
549 * @details Check if the file exist.
550 * @param [in] fileName
551 * @return true if the file exists.
552 */
553 static bool IsHDF5(const std::string& fileName);
554
555 /// Close file.
556 void Close();
557
558 //----------------------------------- Group manipulators -------------------------------------//
559 /// Create a HDF5 group at a specified place in the file tree.
560 hid_t CreateGroup(const hid_t parentGroup,
561 TMatrixName& groupName);
562 /// Open a HDF5 group at a specified place in the file tree.
563 hid_t OpenGroup(const hid_t parentGroup,
564 TMatrixName& groupName);
565 /// Close group.
566 void CloseGroup(const hid_t group);
567
568 /**
569 * @brief Get handle to the root group.
570 * @details Get handle to the root group.
571 * @return handle to the root group
572 */
573 hid_t GetRootGroup() const {return file;};
574
575
576 //---------------------------------- Dataset manipulators -------------------------------------//
577 /// Open the HDF5 dataset at a specified place in the file tree.
578 hid_t OpenDataset(const hid_t parentGroup,
579 TMatrixName& datasetName);
580
581 /// Create a float HDF5 dataset at a specified place in the file tree (3D/4D).
582 hid_t CreateFloatDataset(const hid_t parentGroup,
583 TMatrixName& datasetName,
584 const TDimensionSizes& dimensionSizes,
585 const TDimensionSizes& chunkSizes,
586 const size_t compressionLevel);
587
588 /// Create an index HDF5 dataset at a specified place in the file tree (3D only).
589 hid_t CreateIndexDataset(const hid_t parentGroup,
590 TMatrixName& datasetName,
591 const TDimensionSizes& dimensionSizes,
592 const TDimensionSizes& chunkSizes,
593 const size_t compressionLevel);
594
595 /// Close the HDF5 dataset.
596 void CloseDataset (const hid_t dataset);
597
598
599 //----------------------------- Dataset Read/Write operations --------------------------------//
600 /// Write a hyper-slab into the dataset - float dataset.
601 void WriteHyperSlab(const hid_t dataset,
602 const TDimensionSizes& position,
603 const TDimensionSizes& size,
604 const float* data);
605 /// Write a hyper-slab into the dataset - long dataset.
606 void WriteHyperSlab(const hid_t dataset,
607 const TDimensionSizes& position,
608 const TDimensionSizes& size,
609 const size_t* data);
610
611 /// Write a cuboid selected within the matrixData into a hyperslab.
612 void WriteCuboidToHyperSlab(const hid_t dataset,
613 const TDimensionSizes& hyperslabPosition,
614 const TDimensionSizes& cuboidPosition,
615 const TDimensionSizes& cuboidSize,
616 const TDimensionSizes& matrixDimensions,
617 const float* mMatrixData);
618
619 /// Write sensor data selected by the sensor mask - Occasionally very slow, do not use!
620 void WriteDataByMaskToHyperSlab(const hid_t dataset,
621 const TDimensionSizes& hyperslabPosition,
622 const size_t indexSensorSize,
623 const size_t* indexSensorData,
624 const TDimensionSizes& matrixDimensions,
625 const float* matrixData);
626
627 /// Write the scalar value under a specified group, float value.
628 void WriteScalarValue(const hid_t parentGroup,
629 TMatrixName& datasetName,
630 const float value);
631 /// Write the scalar value under a specified group, index value.
632 void WriteScalarValue(const hid_t parentGroup,
633 TMatrixName& datasetName,
634 const size_t value);
635
636 /// Read the scalar value under a specified group, float value.
637 void ReadScalarValue(const hid_t parentGroup,
638 TMatrixName& datasetName,
639 float& value);
640 /// Read the scalar value under a specified group, index value.
641 void ReadScalarValue(const hid_t parentGroup,
642 TMatrixName& datasetName,
643 size_t& value);
644
645 /// Read data from the dataset under a specified group, float dataset.
646 void ReadCompleteDataset(const hid_t parentGroup,
647 TMatrixName& datasetName,
648 const TDimensionSizes& dimensionSizes,
649 float* data);
650 /// Read data from the dataset under a specified group, index dataset.
651 void ReadCompleteDataset(const hid_t parentGroup,
652 TMatrixName& datasetName,
653 const TDimensionSizes& dimensionSizes,
654 size_t* data);
655
656 //---------------------------- Attributes Read/Write operations ------------------------------//
657
658 /// Get dimension sizes of the dataset under a specified group.
659 TDimensionSizes GetDatasetDimensionSizes(const hid_t parentGroup,
660 TMatrixName& datasetName);
661
662 /// Get number of dimensions of the dataset under a specified group.
663 size_t GetDatasetNumberOfDimensions(const hid_t parentGroup,
664 TMatrixName& datasetName);
665
666 /// Get dataset element count under a specified group.
667 size_t GetDatasetElementCount(const hid_t parentGroup,
668 TMatrixName& datasetName);
669
670
671 /// Write matrix data type into the dataset under a specified group.
672 void WriteMatrixDataType (const hid_t parentGroup,
673 TMatrixName& datasetName,
674 const TMatrixDataType& matrixDataType);
675 /// Write matrix domain type into the dataset under the root group.
676 void WriteMatrixDomainType(const hid_t parentGroup,
677 TMatrixName& datasetName,
678 const TMatrixDomainType& matrixDomainType);
679
680 /// Read matrix data type from the dataset.
681 THDF5_File::TMatrixDataType ReadMatrixDataType(const hid_t parentGroup,
682 TMatrixName& datasetName);
683 /// Read matrix domain type from the dataset under a specified group.
684 THDF5_File::TMatrixDomainType ReadMatrixDomainType(const hid_t parentGroup,
685 TMatrixName& datasetName);
686
687
688 /// Write string attribute into the dataset under the root group.
689 void WriteStringAttribute(const hid_t parentGroup,
690 TMatrixName& datasetName,
691 TMatrixName& attributeName,
692 const std::string& value);
693 /// Read string attribute from the dataset under the root group.
694 std::string ReadStringAttribute(const hid_t parentGroup,
695 TMatrixName& datasetName,
696 TMatrixName& attributeName);
697
698 protected:
699
700 /// Copy constructor is not allowed for public.
701 THDF5_File(const THDF5_File& src);
702 /// Operator = is not allowed for public.
703 THDF5_File& operator= (const THDF5_File& src);
704
705 private:
706 /// String representation of the Domain type in the HDF5 file.
707 static const std::string matrixDomainTypeName;
708 /// String representation of the Data type in the HDF5 file.
709 static const std::string matrixDataTypeName;
710
711 /// String representation of different domain types.
712 static const std::string matrixDomainTypeNames[];
713 /// String representation of different data types.
714 static const std::string matrixDataTypeNames[];
715
716 /// HDF file handle.
717 hid_t file;
718 /// File name.
719 std::string fileName;
720 }; // THDF5_File
721 //--------------------------------------------------------------------------------------------------
722
723
724 /**
725 * @class THDF5_FileHeader
726 * @brief Class for HDF5 header.
727 * @details This class manages all information that can be stored in the input output or checkpoint
728 * file header.
729 */
730 class THDF5_FileHeader
731 {
732 public:
733
734 /**
735 * @enum TFileHeaderItems
736 * @brief List of all header items.
737 * @details List of all header items.
738 * @todo In the future we should add number of GPUs, peak GPU memory.
739 */
740 enum TFileHeaderItems
741 {
742 CREATED_BY = 0,
743 CREATION_DATA = 1,
744 FILE_DESCRIPTION = 2,
745 MAJOR_VERSION = 3,
746 MINOR_VERSION = 4,
747 FILE_TYPE = 5,
748 HOST_NAME = 6,
749 TOTAL_MEMORY_CONSUMPTION = 7,
750 PEAK_CORE_MEMORY_CONSUMPTION = 8,
751 TOTAL_EXECUTION_TIME = 9,
752 DATA_LOAD_TIME = 10,
753 PREPROCESSING_TIME = 11,
754 SIMULATION_TIME = 12,
755 POST_PROCESSING_TIME = 13,
756 NUMBER_OF_CORES = 14
757 };
758
759 /**
760 * @enum TFileType
761 * @brief HDF5 file type.
762 * @details HDF5 file type.
763 */
764 enum TFileType
765 {
766 INPUT = 0,
767 OUTPUT = 1,
768 CHECKPOINT = 2,
769 UNKNOWN = 3
770 };
771
772 /**
773 * @enum TFileVersion
774 * @brief HDF5 file version.
775 * @details HDF5 file version.
776 */
777 enum TFileVersion
778 {
779 VERSION_10 = 0,
780 VERSION_11 = 1,
781 VERSION_UNKNOWN = 2
782 };
783
784 /// Constructor.
785 THDF5_FileHeader();
786 /// Copy constructor.
787 THDF5_FileHeader(const THDF5_FileHeader& src);
788 /// Destructor.
789 ~THDF5_FileHeader();
790
791 /// Read header from the input file.
792 void ReadHeaderFromInputFile(THDF5_File& inputFile);
793 /// Read Header from output file (necessary for checkpoint-restart).
794 void ReadHeaderFromOutputFile(THDF5_File& outputFile);
795 /// Read Header from checkpoint file (necessary for checkpoint-restart).
796 void ReadHeaderFromCheckpointFile(THDF5_File& checkpointFile);
797
798 /// Write header to the output file
799 void WriteHeaderToOutputFile(THDF5_File& outputFile);
800 /// Write header to the output file
801 void WriteHeaderToCheckpointFile(THDF5_File& checkpointFile);
802
803 /**
804 * @brief Set code name.
805 * @details Set code name to the header.
806 * @param [in] codeName - code version
807 */
808 void SetCodeName(const std::string& codeName)
809 {
810 headerValues[CREATED_BY] = codeName;
811 };
812
813 /// Set creation time.
814 void SetActualCreationTime();
815
816 /**
817 * @brief Get string version of current Major version.
818 * @details Get string version of current Major version.
819 * @return Current major version
820 */
821 static std::string GetCurrentHDF5_MajorVersion()
822 {
823 return hdf5_MajorFileVersionsNames[0];
824 };
825
826 /**
827 * @brief Get string version of current Minor version.
828 * @details Get string version of current Minor version.
829 * @return Current minor version
830 */
831 static std::string GetCurrentHDF5_MinorVersion()
832 {
833 return hdf5_MinorFileVersionsNames[1];
834 };
835
836 /**
837 * @brief Set major file version.
838 * @details Set major file version.
839 */
840 void SetMajorFileVersion()
841 {
842 headerValues[MAJOR_VERSION] = GetCurrentHDF5_MajorVersion();
843 };
844
845 /**
846 * @brief Set minor file version.
847 * @details Set minor file version.
848 */
849 void SetMinorFileVersion()
850 {
851 headerValues[MINOR_VERSION] = GetCurrentHDF5_MinorVersion();
852 };
853
854 /// Set major file version in a string.
855 TFileVersion GetFileVersion();
856
857 /**
858 * @brief Check major file version.
859 * @details Check major file version.
860 * @return true if ok
861 */
862 bool CheckMajorFileVersion()
863 {
864 return (headerValues[MAJOR_VERSION] == GetCurrentHDF5_MajorVersion());
865 };
866
867 /**
868 * @brief Check minor file version.
869 * @details Check minor file version.
870 * @return true if ok
871 */
872 bool CheckMinorFileVersion()
873 {
874 return (headerValues[MINOR_VERSION] <= GetCurrentHDF5_MinorVersion());
875 };
876
877
878 /// Get File type.
879 THDF5_FileHeader::TFileType GetFileType();
880 /// Set file type.
881 void SetFileType(const THDF5_FileHeader::TFileType fileType);
882
883 /// Set host name.
884 void SetHostName();
885 /// Set memory consumption.
886 void SetMemoryConsumption(const size_t totalMemory);
887 /// Set execution times.
888 void SetExecutionTimes(const double totalTime,
889 const double loadTime,
890 const double preProcessingTime,
891 const double simulationTime,
892 const double postprocessingTime);
893
894 /// Get execution times stored in the output file header.
895 void GetExecutionTimes(double& totalTime,
896 double& loadTime,
897 double& preProcessingTime,
898 double& simulationTime,
899 double& postprocessingTime);
900 /// Set number of cores.
901 void SetNumberOfCores();
902
903 private:
904 /// Populate the map with the header items.
905 void PopulateHeaderFileMap();
906
907 /// map for the header values.
908 std::map<TFileHeaderItems, std::string> headerValues;
909 /// map for the header names.
910 std::map<TFileHeaderItems, std::string> headerNames;
911
912 ///String representation of different file types.
913 static const std::string hdf5_FileTypesNames[];
914 /// String representations of Major file versions.
915 static const std::string hdf5_MajorFileVersionsNames[];
916 /// String representations of Major file versions.
917 static const std::string hdf5_MinorFileVersionsNames[];
918
919 };// THDF5_FileHeader
920 //--------------------------------------------------------------------------------------------------
921
922 #endif /* THDF5_FILE_H */
THDF5_FileHeader
Class for HDF5 header.
Definition: HDF5_File.h:730
THDF5_File::GetDatasetNumberOfDimensions
size_t GetDatasetNumberOfDimensions(const hid_t parentGroup, TMatrixName &datasetName)
Get number of dimensions of the dataset under a specified group.
Definition: HDF5_File.cpp:982
THDF5_File::CreateFloatDataset
hid_t CreateFloatDataset(const hid_t parentGroup, TMatrixName &datasetName, const TDimensionSizes &dimensionSizes, const TDimensionSizes &chunkSizes, const size_t compressionLevel)
Create a float HDF5 dataset at a specified place in the file tree (3D/4D).
Definition: HDF5_File.cpp:296
THDF5_File::WriteMatrixDomainType
void WriteMatrixDomainType(const hid_t parentGroup, TMatrixName &datasetName, const TMatrixDomainType &matrixDomainType)
Write matrix domain type into the dataset under the root group.
Definition: HDF5_File.cpp:1048
THDF5_File::ReadStringAttribute
std::string ReadStringAttribute(const hid_t parentGroup, TMatrixName &datasetName, TMatrixName &attributeName)
Read string attribute from the dataset under the root group.
Definition: HDF5_File.cpp:1163
THDF5_File::TMatrixDataType
TMatrixDataType
HDF5 matrix data type (float or uint64).
Definition: HDF5_File.h:509
THDF5_FileHeader::SetFileType
void SetFileType(const THDF5_FileHeader::TFileType fileType)
Set file type.
Definition: HDF5_File.cpp:1491
THDF5_FileHeader::SetMinorFileVersion
void SetMinorFileVersion()
Set minor file version.
Definition: HDF5_File.h:849
THDF5_FileHeader::THDF5_FileHeader
THDF5_FileHeader()
Constructor.
Definition: HDF5_File.cpp:1205
THDF5_FileHeader::hdf5_MajorFileVersionsNames
static const std::string hdf5_MajorFileVersionsNames[]
String representations of Major file versions.
Definition: HDF5_File.h:915
THDF5_File::matrixDomainTypeName
static const std::string matrixDomainTypeName
String representation of the Domain type in the HDF5 file.
Definition: HDF5_File.h:707
THDF5_FileHeader::SetMajorFileVersion
void SetMajorFileVersion()
Set major file version.
Definition: HDF5_File.h:840
THDF5_File::Open
void Open(const std::string &fileName, unsigned int flags=H5F_ACC_RDONLY)
Open a file.
Definition: HDF5_File.cpp:127
THDF5_FileHeader::GetExecutionTimes
void GetExecutionTimes(double &totalTime, double &loadTime, double &preProcessingTime, double &simulationTime, double &postprocessingTime)
Get execution times stored in the output file header.
Definition: HDF5_File.cpp:1575
THDF5_File::TMatrixDomainType
TMatrixDomainType
HDF5 Matrix domain type (real or complex).
Definition: HDF5_File.h:520
THDF5_FileHeader::TFileHeaderItems
TFileHeaderItems
List of all header items.
Definition: HDF5_File.h:740
THDF5_FileHeader::GetCurrentHDF5_MinorVersion
static std::string GetCurrentHDF5_MinorVersion()
Get string version of current Minor version.
Definition: HDF5_File.h:831
THDF5_FileHeader::headerNames
std::map< TFileHeaderItems, std::string > headerNames
map for the header names.
Definition: HDF5_File.h:910
THDF5_FileHeader::hdf5_FileTypesNames
static const std::string hdf5_FileTypesNames[]
String representation of different file types.
Definition: HDF5_File.h:913
THDF5_FileHeader::SetExecutionTimes
void SetExecutionTimes(const double totalTime, const double loadTime, const double preProcessingTime, const double simulationTime, const double postprocessingTime)
Set execution times.
Definition: HDF5_File.cpp:1552
THDF5_File::CreateGroup
hid_t CreateGroup(const hid_t parentGroup, TMatrixName &groupName)
Create a HDF5 group at a specified place in the file tree.
Definition: HDF5_File.cpp:208
THDF5_File::ReadMatrixDataType
THDF5_File::TMatrixDataType ReadMatrixDataType(const hid_t parentGroup, TMatrixName &datasetName)
Read matrix data type from the dataset.
Definition: HDF5_File.cpp:1068
THDF5_File::WriteScalarValue
void WriteScalarValue(const hid_t parentGroup, TMatrixName &datasetName, const float value)
Write the scalar value under a specified group, float value.
Definition: HDF5_File.cpp:748
THDF5_File::Close
void Close()
Close file.
Definition: HDF5_File.cpp:175
THDF5_File::WriteCuboidToHyperSlab
void WriteCuboidToHyperSlab(const hid_t dataset, const TDimensionSizes &hyperslabPosition, const TDimensionSizes &cuboidPosition, const TDimensionSizes &cuboidSize, const TDimensionSizes &matrixDimensions, const float *mMatrixData)
Write a cuboid selected within the matrixData into a hyperslab.
Definition: HDF5_File.cpp:618
THDF5_FileHeader::SetCodeName
void SetCodeName(const std::string &codeName)
Set code name.
Definition: HDF5_File.h:808
THDF5_File::IsOpen
bool IsOpen() const
Is the file opened?
Definition: HDF5_File.h:545
THDF5_FileHeader::PopulateHeaderFileMap
void PopulateHeaderFileMap()
Populate the map with the header items.
Definition: HDF5_File.cpp:1609
THDF5_File::file
hid_t file
HDF file handle.
Definition: HDF5_File.h:717
TMatrixName
const std::string TMatrixName
Datatype for matrix names.
Definition: MatrixNames.h:45
THDF5_FileHeader::ReadHeaderFromCheckpointFile
void ReadHeaderFromCheckpointFile(THDF5_File &checkpointFile)
Read Header from checkpoint file (necessary for checkpoint-restart).
Definition: HDF5_File.cpp:1336
THDF5_FileHeader::WriteHeaderToCheckpointFile
void WriteHeaderToCheckpointFile(THDF5_File &checkpointFile)
Write header to the output file.
Definition: HDF5_File.cpp:1386
THDF5_File::GetDatasetDimensionSizes
TDimensionSizes GetDatasetDimensionSizes(const hid_t parentGroup, TMatrixName &datasetName)
Get dimension sizes of the dataset under a specified group.
Definition: HDF5_File.cpp:949
THDF5_FileHeader::GetCurrentHDF5_MajorVersion
static std::string GetCurrentHDF5_MajorVersion()
Get string version of current Major version.
Definition: HDF5_File.h:821
THDF5_FileHeader::WriteHeaderToOutputFile
void WriteHeaderToOutputFile(THDF5_File &outputFile)
Write header to the output file.
Definition: HDF5_File.cpp:1369
THDF5_File::WriteMatrixDataType
void WriteMatrixDataType(const hid_t parentGroup, TMatrixName &datasetName, const TMatrixDataType &matrixDataType)
Write matrix data type into the dataset under a specified group.
Definition: HDF5_File.cpp:1029
THDF5_FileHeader::ReadHeaderFromOutputFile
void ReadHeaderFromOutputFile(THDF5_File &outputFile)
Read Header from output file (necessary for checkpoint-restart).
Definition: HDF5_File.cpp:1290
THDF5_File::THDF5_File
THDF5_File()
Constructor of the class.
Definition: HDF5_File.cpp:82
THDF5_FileHeader::SetHostName
void SetHostName()
Set host name.
Definition: HDF5_File.cpp:1503
THDF5_File::ReadScalarValue
void ReadScalarValue(const hid_t parentGroup, TMatrixName &datasetName, float &value)
Read the scalar value under a specified group, float value.
Definition: HDF5_File.cpp:855
THDF5_File::matrixDataTypeNames
static const std::string matrixDataTypeNames[]
String representation of different data types.
Definition: HDF5_File.h:714
THDF5_FileHeader::ReadHeaderFromInputFile
void ReadHeaderFromInputFile(THDF5_File &inputFile)
Read header from the input file.
Definition: HDF5_File.cpp:1241
THDF5_File::WriteStringAttribute
void WriteStringAttribute(const hid_t parentGroup, TMatrixName &datasetName, TMatrixName &attributeName, const std::string &value)
Write string attribute into the dataset under the root group.
Definition: HDF5_File.cpp:1135
THDF5_FileHeader::hdf5_MinorFileVersionsNames
static const std::string hdf5_MinorFileVersionsNames[]
String representations of Major file versions.
Definition: HDF5_File.h:917
THDF5_File::IsHDF5
static bool IsHDF5(const std::string &fileName)
Does the file exist?
Definition: HDF5_File.cpp:158
THDF5_File::GetRootGroup
hid_t GetRootGroup() const
Get handle to the root group.
Definition: HDF5_File.h:573
THDF5_FileHeader::TFileVersion
TFileVersion
HDF5 file version.
Definition: HDF5_File.h:777
MatrixNames.h
The header file storing names of all variables/matrices/output streams used in the simulation...
THDF5_FileHeader::~THDF5_FileHeader
~THDF5_FileHeader()
Destructor.
Definition: HDF5_File.cpp:1227
THDF5_FileHeader::TFileType
TFileType
HDF5 file type.
Definition: HDF5_File.h:764
DimensionSizes.h
The header file containing the structure with 3D dimension sizes.
THDF5_File::matrixDomainTypeNames
static const std::string matrixDomainTypeNames[]
String representation of different domain types.
Definition: HDF5_File.h:712
THDF5_File::Create
void Create(const std::string &fileName, unsigned int flags=H5F_ACC_TRUNC)
Create a file.
Definition: HDF5_File.cpp:97
THDF5_File::WriteDataByMaskToHyperSlab
void WriteDataByMaskToHyperSlab(const hid_t dataset, const TDimensionSizes &hyperslabPosition, const size_t indexSensorSize, const size_t *indexSensorData, const TDimensionSizes &matrixDimensions, const float *matrixData)
Write sensor data selected by the sensor mask - Occasionally very slow, do not use! ...
Definition: HDF5_File.cpp:686
THDF5_FileHeader::SetActualCreationTime
void SetActualCreationTime()
Set creation time.
Definition: HDF5_File.cpp:1429
THDF5_FileHeader::CheckMajorFileVersion
bool CheckMajorFileVersion()
Check major file version.
Definition: HDF5_File.h:862
THDF5_FileHeader::CheckMinorFileVersion
bool CheckMinorFileVersion()
Check minor file version.
Definition: HDF5_File.h:872
THDF5_FileHeader::GetFileType
THDF5_FileHeader::TFileType GetFileType()
Get File type.
Definition: HDF5_File.cpp:1472
THDF5_FileHeader::GetFileVersion
TFileVersion GetFileVersion()
Set major file version in a string.
Definition: HDF5_File.cpp:1447
THDF5_File::CreateIndexDataset
hid_t CreateIndexDataset(const hid_t parentGroup, TMatrixName &datasetName, const TDimensionSizes &dimensionSizes, const TDimensionSizes &chunkSizes, const size_t compressionLevel)
Create an index HDF5 dataset at a specified place in the file tree (3D only).
Definition: HDF5_File.cpp:392
THDF5_FileHeader::SetNumberOfCores
void SetNumberOfCores()
Set number of cores.
Definition: HDF5_File.cpp:1593
THDF5_File::ReadMatrixDomainType
THDF5_File::TMatrixDomainType ReadMatrixDomainType(const hid_t parentGroup, TMatrixName &datasetName)
Read matrix domain type from the dataset under a specified group.
Definition: HDF5_File.cpp:1101
THDF5_File::WriteHyperSlab
void WriteHyperSlab(const hid_t dataset, const TDimensionSizes &position, const TDimensionSizes &size, const float *data)
Write a hyper-slab into the dataset - float dataset.
Definition: HDF5_File.cpp:473
THDF5_File::matrixDataTypeName
static const std::string matrixDataTypeName
String representation of the Data type in the HDF5 file.
Definition: HDF5_File.h:709
THDF5_File::OpenGroup
hid_t OpenGroup(const hid_t parentGroup, TMatrixName &groupName)
Open a HDF5 group at a specified place in the file tree.
Definition: HDF5_File.cpp:232
THDF5_File::CloseGroup
void CloseGroup(const hid_t group)
Close group.
Definition: HDF5_File.cpp:254
THDF5_File::~THDF5_File
virtual ~THDF5_File()
Destructor.
Definition: HDF5_File.cpp:193
THDF5_File::operator=
THDF5_File & operator=(const THDF5_File &src)
Operator = is not allowed for public.
THDF5_File::GetDatasetElementCount
size_t GetDatasetElementCount(const hid_t parentGroup, TMatrixName &datasetName)
Get dataset element count under a specified group.
Definition: HDF5_File.cpp:1006
THDF5_File::ReadCompleteDataset
void ReadCompleteDataset(const hid_t parentGroup, TMatrixName &datasetName, const TDimensionSizes &dimensionSizes, float *data)
Read data from the dataset under a specified group, float dataset.
Definition: HDF5_File.cpp:887
THDF5_File::fileName
std::string fileName
File name.
Definition: HDF5_File.h:719
THDF5_File::CloseDataset
void CloseDataset(const hid_t dataset)
Close the HDF5 dataset.
Definition: HDF5_File.cpp:457
THDF5_File
Class wrapping the HDF5 routines.
Definition: HDF5_File.h:500
THDF5_FileHeader::headerValues
std::map< TFileHeaderItems, std::string > headerValues
map for the header values.
Definition: HDF5_File.h:908
TDimensionSizes
Structure with 4D dimension sizes (3 in space and 1 in time).
Definition: DimensionSizes.h:66
THDF5_FileHeader::SetMemoryConsumption
void SetMemoryConsumption(const size_t totalMemory)
Set memory consumption.
Definition: HDF5_File.cpp:1531
THDF5_File::OpenDataset
hid_t OpenDataset(const hid_t parentGroup, TMatrixName &datasetName)
Open the HDF5 dataset at a specified place in the file tree.
Definition: HDF5_File.cpp:268