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

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Friends Pages
BaseFloatMatrix.h
Go to the documentation of this file.
1 /**
2 * @file BaseFloatMatrix.h
3 * @author Jiri Jaros \n
4 * Faculty of Information Technology\n
5 * Brno University of Technology \n
6 * jarosjir@fit.vutbr.cz
7 *
8 * @brief The header file containing the base class for
9 * single precisions floating point numbers (floats)
10 *
11 * @version kspaceFirstOrder3D 2.15
12 *
13 * @date 11 July 2011, 12:13 (created) \n
14 * 24 September 2014, 14:07 (revised)
15 *
16 * @section License
17 * This file is part of the C++ extension of the k-Wave Toolbox (http://www.k-wave.org).\n
18 * Copyright (C) 2014 Jiri Jaros and Bradley Treeby
19 *
20 * This file is part of k-Wave. k-Wave is free software: you can redistribute it
21 * and/or modify it under the terms of the GNU Lesser General Public License as
22 * published by the Free Software Foundation, either version 3 of the License,
23 * or (at your option) any later version.
24 *
25 * k-Wave is distributed in the hope that it will be useful, but
26 * WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
28 * See the GNU Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public License
31 * along with k-Wave. If not, see <http://www.gnu.org/licenses/>.
32 */
33
34
35 #ifndef BASEFLOATMATRIXDATA_H
36 #define BASEFLOATMATRIXDATA_H
37
38 #include <MatrixClasses/BaseMatrix.h>
39 #include <Utils/DimensionSizes.h>
40
41 using namespace std;
42
43 /**
44 * @class TBaseFloatMatrix
45 * @brief Abstract base class for float based matrices defining basic interface.
46 * Higher dimensional matrices stored as 1D arrays, row-major order.
47 *
48 * @details Abstract base class for float based matrices defining basic interface.
49 * Higher dimensional matrices stored as 1D arrays, row-major order.
50 *
51 */
52 class TBaseFloatMatrix : public TBaseMatrix
53 {
54 public:
55
56 /// Default constructor.
57 TBaseFloatMatrix() : TBaseMatrix(),
58 pTotalElementCount(0), pTotalAllocatedElementCount(0), pDimensionSizes(),
59 pDataRowSize(0), p2DDataSliceSize (0), pMatrixData (NULL)
60 {};
61
62
63 /// Get dimension sizes of the matrix.
64 virtual TDimensionSizes GetDimensionSizes() const
65 {
66 return pDimensionSizes;
67 }
68
69 /// Get element count of the matrix.
70 virtual size_t GetTotalElementCount() const
71 {
72 return pTotalElementCount;
73 };
74
75 /// Get total allocated element count (might differ from total element count used for the simulation because of padding).
76 virtual size_t GetTotalAllocatedElementCount() const
77 {
78 return pTotalAllocatedElementCount;
79 };
80
81 /// Destructor.
82 virtual ~TBaseFloatMatrix() {};
83
84
85 /// Copy data from other matrix with the same size.
86 virtual void CopyData(const TBaseFloatMatrix & src);
87
88 /// Zero all elements of the matrix (NUMA first touch).
89 virtual void ZeroMatrix();
90
91 /// Divide scalar/ matrix_element[i].
92 virtual void ScalarDividedBy(const float scalar);
93
94 /// Get raw data out of the class (for direct kernel access).
95 virtual float* GetRawData()
96 {
97 return pMatrixData;
98 }
99
100 /// Get raw data out of the class (for direct kernel access).
101 virtual const float * GetRawData() const
102 {
103 return pMatrixData;
104 }
105
106 protected:
107
108 /// Total number of elements.
109 size_t pTotalElementCount;
110 /// Total number of allocated elements (in terms of floats).
111 size_t pTotalAllocatedElementCount;
112
113 /// Dimension sizes.
114 struct TDimensionSizes pDimensionSizes;
115
116 /// Size of a 1D row in X dimension.
117 size_t pDataRowSize;
118 /// Size of a 2D slab (X,Y).
119 size_t p2DDataSliceSize;
120
121 /// Raw matrix data.
122 float * pMatrixData;
123
124 /// Memory allocation.
125 virtual void AllocateMemory();
126
127 /// Memory deallocation.
128 virtual void FreeMemory();
129
130 /// Copy constructor is not directly allowed.
131 TBaseFloatMatrix(const TBaseFloatMatrix& src);
132 /// operator = is not directly allowed.
133 TBaseFloatMatrix & operator =(const TBaseFloatMatrix& src);
134
135 private:
136
137 };// end of class TBaseFloatMatrix
138 //-----------------------------------------------------------------------------
139
140 #endif /* TBASEMATRIXDATA_H */
TBaseFloatMatrix
Abstract base class for float based matrices defining basic interface. Higher dimensional matrices st...
Definition: BaseFloatMatrix.h:52
TBaseFloatMatrix::GetRawData
virtual float * GetRawData()
Get raw data out of the class (for direct kernel access).
Definition: BaseFloatMatrix.h:95
TBaseMatrix
Abstract base class, the common ancestor defining the common interface and allowing derived classes t...
Definition: BaseMatrix.h:52
TBaseFloatMatrix::GetTotalElementCount
virtual size_t GetTotalElementCount() const
Get element count of the matrix.
Definition: BaseFloatMatrix.h:70
TBaseFloatMatrix::TBaseFloatMatrix
TBaseFloatMatrix()
Default constructor.
Definition: BaseFloatMatrix.h:57
TBaseFloatMatrix::p2DDataSliceSize
size_t p2DDataSliceSize
Size of a 2D slab (X,Y).
Definition: BaseFloatMatrix.h:119
TBaseFloatMatrix::pTotalAllocatedElementCount
size_t pTotalAllocatedElementCount
Total number of allocated elements (in terms of floats).
Definition: BaseFloatMatrix.h:111
TBaseFloatMatrix::GetDimensionSizes
virtual TDimensionSizes GetDimensionSizes() const
Get dimension sizes of the matrix.
Definition: BaseFloatMatrix.h:64
TBaseFloatMatrix::pTotalElementCount
size_t pTotalElementCount
Total number of elements.
Definition: BaseFloatMatrix.h:109
TBaseFloatMatrix::GetTotalAllocatedElementCount
virtual size_t GetTotalAllocatedElementCount() const
Get total allocated element count (might differ from total element count used for the simulation beca...
Definition: BaseFloatMatrix.h:76
TBaseFloatMatrix::pDataRowSize
size_t pDataRowSize
Size of a 1D row in X dimension.
Definition: BaseFloatMatrix.h:117
DimensionSizes.h
The header file containing the structure with 3D dimension sizes.
TBaseFloatMatrix::~TBaseFloatMatrix
virtual ~TBaseFloatMatrix()
Destructor.
Definition: BaseFloatMatrix.h:82
TBaseFloatMatrix::pMatrixData
float * pMatrixData
Raw matrix data.
Definition: BaseFloatMatrix.h:122
BaseMatrix.h
The header file of the common ancestor of all matrix classes. A pure abstract class.
TBaseFloatMatrix::GetRawData
virtual const float * GetRawData() const
Get raw data out of the class (for direct kernel access).
Definition: BaseFloatMatrix.h:101
TDimensionSizes
Structure with 4D dimension sizes (3 in space and 1 in time).
Definition: DimensionSizes.h:63