| 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
IndexOutputHDF5Stream.h
Go to the documentation of this file.
1 /**
2 * @file IndexOutputHDF5Stream.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 of the class saving data based on the index senor mask into the
10 * output HDF5 file.
11 *
12 * @version kspaceFirstOrder3D 3.4
13 *
14 * @date 28 August 2014, 10:00 (created)
15 * 26 July 2016, 13:55 (revised)
16 *
17 * @section License
18 * This file is part of the C++ extension of the k-Wave Toolbox
19 * (http://www.k-wave.org).\n Copyright (C) 2016 Jiri Jaros and Bradley Treeby.
20 *
21 * This file is part of the k-Wave. k-Wave is free software: you can redistribute it and/or modify
22 * it under the terms of the GNU Lesser General Public License as published by the Free Software
23 * Foundation, either version 3 of the License, or (at your option) any later version.
24 *
25 * k-Wave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
26 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
27 * General Public License for more details.
28 *
29 * You should have received a copy of the GNU Lesser General Public License along with k-Wave.
30 * If not, see http://www.gnu.org/licenses/.
31 */
32 #ifndef INDEX_OUTPUT_HDF5_STREAM_H
33 #define INDEX_OUTPUT_HDF5_STREAM_H
34
35 #include <cuda_runtime.h>
36
37 #include <OutputHDF5Streams/BaseOutputHDF5Stream.h>
38
39 /**
40 * @class TIndexOutputHDF5Stream.
41 * @brief Output stream for quantities sampled by an index sensor mask.
42 * @details Output stream for quantities sampled by an index sensor mask.
43 * This class writes data to a single dataset in a root group of the HDF5 file (time-series
44 * as well as aggregations).
45 *
46 */
47 class TIndexOutputHDF5Stream : public TBaseOutputHDF5Stream
48 {
49 public:
50
51 /// Constructor.
52 TIndexOutputHDF5Stream(THDF5_File& file,
53 TMatrixName& datasetName,
54 const TRealMatrix& sourceMatrix,
55 const TIndexMatrix& sensorMask,
56 const TReduceOperator reduceOp);
57
58
59 /// Destructor.
60 virtual ~TIndexOutputHDF5Stream();
61
62 /// Create a HDF5 stream and allocate data for it.
63 virtual void Create();
64
65 /// Reopen the output stream after restart and reload data.
66 virtual void Reopen();
67
68 /// Sample data into buffer, apply reduction or copy to the CPU side
69 virtual void Sample();
70
71 /// Flush data to disk (from raw streams only).
72 virtual void FlushRaw();
73
74 /// Apply post-processing on the buffer and flush it to the file.
75 virtual void PostProcess();
76
77 /// Checkpoint the stream.
78 virtual void Checkpoint();
79
80 /// Close stream (apply post-processing if necessary, flush data and close).
81 virtual void Close();
82
83 protected:
84
85 /// Flush the buffer to the file.
86 virtual void FlushBufferToFile();
87
88 /// Sensor mask to sample data.
89 const TIndexMatrix& sensorMask;
90
91 /// Handle to a HDF5 dataset.
92 hid_t dataset;
93
94 /// Time step to store (N/A for aggregated)
95 size_t sampledTimeStep;
96
97 /// Has the sampling finished?
98 cudaEvent_t eventSamplingFinished;
99
100 } ; // end of TIndexOutputHDF5Stream
101 //------------------------------------------------------------------------------
102
103 #endif /* INDEX_OUTPUT_HDF5_STREAM_H */
104
TBaseOutputHDF5Stream::file
THDF5_File & file
HDF5 file handle.
Definition: BaseOutputHDF5Stream.h:115
BaseOutputHDF5Stream.h
The header file of the class saving RealMatrix data into the output HDF5 file.
TBaseOutputHDF5Stream::reduceOp
const TReduceOperator reduceOp
Reduce operator.
Definition: BaseOutputHDF5Stream.h:126
TIndexOutputHDF5Stream::Reopen
virtual void Reopen()
Reopen the output stream after restart and reload data.
Definition: IndexOutputHDF5Stream.cpp:140
TIndexOutputHDF5Stream::Sample
virtual void Sample()
Sample data into buffer, apply reduction or copy to the CPU side.
Definition: IndexOutputHDF5Stream.cpp:187
TMatrixName
const std::string TMatrixName
Datatype for matrix names.
Definition: MatrixNames.h:45
TBaseOutputHDF5Stream::sourceMatrix
const TRealMatrix & sourceMatrix
Source matrix to be sampled.
Definition: BaseOutputHDF5Stream.h:121
TIndexOutputHDF5Stream::TIndexOutputHDF5Stream
TIndexOutputHDF5Stream(THDF5_File &file, TMatrixName &datasetName, const TRealMatrix &sourceMatrix, const TIndexMatrix &sensorMask, const TReduceOperator reduceOp)
Constructor.
Definition: IndexOutputHDF5Stream.cpp:59
TIndexOutputHDF5Stream::Checkpoint
virtual void Checkpoint()
Checkpoint the stream.
Definition: IndexOutputHDF5Stream.cpp:282
TIndexOutputHDF5Stream::FlushBufferToFile
virtual void FlushBufferToFile()
Flush the buffer to the file.
Definition: IndexOutputHDF5Stream.cpp:318
TIndexOutputHDF5Stream
Output stream for quantities sampled by an index sensor mask.
Definition: IndexOutputHDF5Stream.h:47
TBaseOutputHDF5Stream::TReduceOperator
TReduceOperator
How to aggregate data.
Definition: BaseOutputHDF5Stream.h:54
TIndexOutputHDF5Stream::eventSamplingFinished
cudaEvent_t eventSamplingFinished
Has the sampling finished?
Definition: IndexOutputHDF5Stream.h:98
TBaseOutputHDF5Stream
Abstract base class for output data streams (sampled data).
Definition: BaseOutputHDF5Stream.h:46
TIndexOutputHDF5Stream::Close
virtual void Close()
Close stream (apply post-processing if necessary, flush data and close).
Definition: IndexOutputHDF5Stream.cpp:298
TIndexOutputHDF5Stream::dataset
hid_t dataset
Handle to a HDF5 dataset.
Definition: IndexOutputHDF5Stream.h:92
TRealMatrix
The class for real matrices.
Definition: RealMatrix.h:45
TIndexMatrix
The class for 64b unsigned integers (indices). It is used for sensor_mask_index or sensor_corners_mas...
Definition: IndexMatrix.h:46
TIndexOutputHDF5Stream::FlushRaw
virtual void FlushRaw()
Flush data to disk (from raw streams only).
Definition: IndexOutputHDF5Stream.cpp:243
TIndexOutputHDF5Stream::sampledTimeStep
size_t sampledTimeStep
Time step to store (N/A for aggregated)
Definition: IndexOutputHDF5Stream.h:95
TIndexOutputHDF5Stream::PostProcess
virtual void PostProcess()
Apply post-processing on the buffer and flush it to the file.
Definition: IndexOutputHDF5Stream.cpp:260
TIndexOutputHDF5Stream::~TIndexOutputHDF5Stream
virtual ~TIndexOutputHDF5Stream()
Destructor.
Definition: IndexOutputHDF5Stream.cpp:80
THDF5_File
Class wrapping the HDF5 routines.
Definition: HDF5_File.h:500
TIndexOutputHDF5Stream::Create
virtual void Create()
Create a HDF5 stream and allocate data for it.
Definition: IndexOutputHDF5Stream.cpp:94
TIndexOutputHDF5Stream::sensorMask
const TIndexMatrix & sensorMask
Sensor mask to sample data.
Definition: IndexOutputHDF5Stream.h:89