| 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
RealMatrix.h
Go to the documentation of this file.
1 /**
2 * @file RealMatrix.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 class for real matrices.
10 *
11 * @version kspaceFirstOrder3D 3.4
12 * @date 11 July 2011, 10:30 (created) \n
13 * 10 August 2016, 11:59 (revised)
14 *
15 * @section License
16 * This file is part of the C++ extension of the k-Wave Toolbox
17 * (http://www.k-wave.org).\n Copyright (C) 2016 Jiri Jaros and Bradley Treeby.
18 *
19 * This file is part of the k-Wave. k-Wave is free software: you can redistribute it and/or modify
20 * it under the terms of the GNU Lesser General Public License as published by the Free Software
21 * Foundation, either version 3 of the License, or (at your option) any later version.
22 *
23 * k-Wave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
24 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
25 * General Public License for more details.
26 *
27 * You should have received a copy of the GNU Lesser General Public License along with k-Wave.
28 * If not, see http://www.gnu.org/licenses/.
29 */
30
31 #ifndef REAL_MATRIX_H
32 #define REAL_MATRIX_H
33
34 #include <MatrixClasses/BaseFloatMatrix.h>
35 #include <Utils/DimensionSizes.h>
36
37 // Forward declaration
38 class TComplexMatrix;
39
40 /**
41 * @class TRealMatrix
42 * @brief The class for real matrices
43 * @details The class for real matrices (floats) on both CPU and GPU side
44 */
45 class TRealMatrix : public TBaseFloatMatrix
46 {
47 public:
48 /// Constructor.
49 TRealMatrix(const TDimensionSizes& dimensionSizes);
50 /// Destructor.
51 virtual ~TRealMatrix();
52
53 /// Read data from the HDF5 file - only from the root group.
54 virtual void ReadDataFromHDF5File(THDF5_File& file,
55 TMatrixName& matrixName);
56
57 /// Write data into the HDF5 file.
58 virtual void WriteDataToHDF5File(THDF5_File& file,
59 TMatrixName& matrixName,
60 const size_t compressionLevel);
61
62 /**
63 * @brief Operator [].
64 * @details Operator [].
65 * @param [in] index - 1D index
66 * @return An element
67 */
68 inline float& operator[](const size_t& index)
69 {
70 return hostData[index];
71 };
72
73 /**
74 * @brief Operator [], constant version.
75 * @details Operator [], constant version.
76 * @param [in] index - 1D index
77 * @return An element
78 */
79 inline const float& operator[](const size_t& index) const
80 {
81 return hostData[index];
82 };
83
84 /// Default constructor is not allowed for public.
85 TRealMatrix() : TBaseFloatMatrix() {};
86 /// Copy constructor not allowed for public.
87 TRealMatrix(const TRealMatrix& src);
88 /// Operator = is not allowed for public.
89 TRealMatrix& operator= (const TRealMatrix& src);
90
91 /// Init dimension sizes.
92 virtual void InitDimensions(const TDimensionSizes& dimensionSizes);
93
94 private:
95
96 /// Number of elements to get 4MB block of data.
97 static const size_t CHUNK_SIZE_1D_4MB = 1048576; //(4MB)
98 /// Number of elements to get 1MB block of data.
99 static const size_t CHUNK_SIZE_1D_1MB = 262144; //(1MB)
100 /// Number of elements to get 256KB block of data.
101 static const size_t CHUNK_SIZE_1D_256KB = 65536; //(256KB)
102 };// end of class TRealMatrix
103 //--------------------------------------------------------------------------------------------------
104
105 #endif /* REAL_MATRIX_H */
TBaseFloatMatrix
Abstract base class for float based matrices defining basic interface. Higher dimensional matrices st...
Definition: BaseFloatMatrix.h:49
TBaseFloatMatrix::hostData
float * hostData
Raw CPU matrix data.
Definition: BaseFloatMatrix.h:138
TBaseFloatMatrix::dimensionSizes
struct TDimensionSizes dimensionSizes
Dimension sizes.
Definition: BaseFloatMatrix.h:130
TRealMatrix::CHUNK_SIZE_1D_256KB
static const size_t CHUNK_SIZE_1D_256KB
Number of elements to get 256KB block of data.
Definition: RealMatrix.h:101
TRealMatrix::WriteDataToHDF5File
virtual void WriteDataToHDF5File(THDF5_File &file, TMatrixName &matrixName, const size_t compressionLevel)
Write data into the HDF5 file.
Definition: RealMatrix.cpp:102
TRealMatrix::operator[]
const float & operator[](const size_t &index) const
Operator [], constant version.
Definition: RealMatrix.h:79
TRealMatrix::InitDimensions
virtual void InitDimensions(const TDimensionSizes &dimensionSizes)
Init dimension sizes.
Definition: RealMatrix.cpp:152
TMatrixName
const std::string TMatrixName
Datatype for matrix names.
Definition: MatrixNames.h:45
TRealMatrix::CHUNK_SIZE_1D_1MB
static const size_t CHUNK_SIZE_1D_1MB
Number of elements to get 1MB block of data.
Definition: RealMatrix.h:99
TRealMatrix::~TRealMatrix
virtual ~TRealMatrix()
Destructor.
Definition: RealMatrix.cpp:60
TRealMatrix::CHUNK_SIZE_1D_4MB
static const size_t CHUNK_SIZE_1D_4MB
Number of elements to get 4MB block of data.
Definition: RealMatrix.h:97
DimensionSizes.h
The header file containing the structure with 3D dimension sizes.
TRealMatrix
The class for real matrices.
Definition: RealMatrix.h:45
BaseFloatMatrix.h
The header file containing the base class for single precisions floating point numbers (floats)...
TRealMatrix::operator=
TRealMatrix & operator=(const TRealMatrix &src)
Operator = is not allowed for public.
TComplexMatrix
The class for complex matrices.
Definition: ComplexMatrix.h:54
TRealMatrix::ReadDataFromHDF5File
virtual void ReadDataFromHDF5File(THDF5_File &file, TMatrixName &matrixName)
Read data from the HDF5 file - only from the root group.
Definition: RealMatrix.cpp:74
TRealMatrix::operator[]
float & operator[](const size_t &index)
Operator [].
Definition: RealMatrix.h:68
TRealMatrix::TRealMatrix
TRealMatrix()
Default constructor is not allowed for public.
Definition: RealMatrix.h:85
THDF5_File
Class wrapping the HDF5 routines.
Definition: HDF5_File.h:500
TDimensionSizes
Structure with 4D dimension sizes (3 in space and 1 in time).
Definition: DimensionSizes.h:66