kspaceFirstOrder3D-OMP  1.2
The C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
WholeDomainOutputStream.h
Go to the documentation of this file.
1 /**
2  * @file WholeDomainOutputStream.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 whole RealMatrix into the output HDF5 file, e.g. p_max_all.
10  *
11  * @version kspaceFirstOrder3D 2.16
12  *
13  * @date 26 August 2017, 16:55 (created) \n
14  * 04 September 2017, 11:10 (revised)
15  *
16  * @copyright Copyright (C) 2017 Jiri Jaros and Bradley Treeby.
17  *
18  * This file is part of the C++ extension of the [k-Wave Toolbox](http://www.k-wave.org).
19  *
20  * This file is part of the k-Wave. k-Wave is free software: you can redistribute it and/or modify it under the terms
21  * of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the
22  * License, or (at your option) any later version.
23  *
24  * k-Wave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
25  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
26  * more details.
27  *
28  * You should have received a copy of the GNU Lesser General Public License along with k-Wave.
29  * If not, see [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/).
30  */
31 
32 #ifndef WHOLE_DOMAIN_OUTPUT_STREAM_H
33 #define WHOLE_DOMAIN_OUTPUT_STREAM_H
34 
36 
37 /**
38  * @class WholeDomainOutputStream
39  * @brief Output stream for quantities sampled in the whole domain.
40  *
41  * Output stream for quantities sampled in the whole domain. The data is stored in a single dataset
42  * (aggregated quantities only).
43  */
45 {
46  public:
47  /// Default constructor not allowed.
48  WholeDomainOutputStream() = delete;
49 
50  /** @brief Constructor links the HDF5 File, SourceMatrix, and SensorMask together.
51  * @param [in] file - HDF5 file to write the output to
52  * @param [in] datasetName - The name of the HDF5 group. This group contains datasets for particular cuboids
53  * @param [in] sourceMatrix - Source matrix to be sampled
54  * @param [in] reductionOp - Reduction operator
55  * @param [in] bufferToReuse - If there is a memory space to be reused, provide a pointer
56  */
58  MatrixName& datasetName,
59  const RealMatrix& sourceMatrix,
60  const ReduceOperator reductionOp,
61  float* bufferToReuse=nullptr);
62 
63  /// Copy constructor not allowed.
65 
66  /// Destructor.
67  virtual ~WholeDomainOutputStream();
68 
69  /// operator= is not allowed.
71 
72  /// Create a HDF5 stream and allocate data for it.
73  virtual void create();
74 
75  /// Reopen the output stream after restart and reload data.
76  virtual void reopen();
77 
78  /// Sample data into buffer and apply reduction, or flush to disk (no sensor mask here).
79  virtual void sample();
80 
81  /// Apply post-processing on the buffer and flush it to the file.
82  virtual void postProcess();
83 
84  ///Checkpoint the stream and close.
85  virtual void checkpoint();
86 
87  /// Close stream (apply post-processing if necessary, flush data and close).
88  virtual void close();
89 
90  protected:
91  /// Flush the buffer to the file.
92  virtual void flushBufferToFile();
93 
94  /// Handle to a HDF5 dataset.
95  hid_t mDataset;
96 
97  /// Time step to store (N/A for aggregated).
99 };// end of WholeDomainOutputStream
100 //----------------------------------------------------------------------------------------------------------------------
101 
102 #endif /* WHOLE_DOMAIN_OUTPUT_STREAM_H */
virtual void create()
Create a HDF5 stream and allocate data for it.
The class for real matrices.
Definition: RealMatrix.h:47
WholeDomainOutputStream()=delete
Default constructor not allowed.
hid_t mDataset
Handle to a HDF5 dataset.
size_t mSampledTimeStep
Time step to store (N/A for aggregated).
virtual void flushBufferToFile()
Flush the buffer to the file.
Output stream for quantities sampled in the whole domain.
Class wrapping the HDF5 routines.
Definition: Hdf5File.h:490
virtual void checkpoint()
Checkpoint the stream and close.
const std::string MatrixName
Datatype for matrix names.
Definition: MatrixNames.h:39
virtual void close()
Close stream (apply post-processing if necessary, flush data and close).
virtual void postProcess()
Apply post-processing on the buffer and flush it to the file.
ReduceOperator
How to aggregate data.
WholeDomainOutputStream & operator=(const WholeDomainOutputStream &)=delete
operator= is not allowed.
virtual ~WholeDomainOutputStream()
Destructor.
The header file of the class saving RealMatrix data into the output HDF5 file.
virtual void reopen()
Reopen the output stream after restart and reload data.
Abstract base class for output data streams (sampled data).
virtual void sample()
Sample data into buffer and apply reduction, or flush to disk (no sensor mask here).