kspaceFirstOrder3D-OMP  1.1
The C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
 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 
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  */
53 {
54  public:
55 
56  /// Default constructor.
58  pTotalElementCount(0), pTotalAllocatedElementCount(0), pDimensionSizes(),
59  pDataRowSize(0), p2DDataSliceSize (0), pMatrixData (NULL)
60  {};
61 
62 
63  /// Get dimension sizes of the matrix.
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.
110  /// Total number of allocated elements (in terms of floats).
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).
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.
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 */
Abstract base class for float based matrices defining basic interface. Higher dimensional matrices st...
virtual float * GetRawData()
Get raw data out of the class (for direct kernel access).
Abstract base class, the common ancestor defining the common interface and allowing derived classes t...
Definition: BaseMatrix.h:52
virtual size_t GetTotalElementCount() const
Get element count of the matrix.
TBaseFloatMatrix()
Default constructor.
size_t p2DDataSliceSize
Size of a 2D slab (X,Y).
size_t pTotalAllocatedElementCount
Total number of allocated elements (in terms of floats).
virtual TDimensionSizes GetDimensionSizes() const
Get dimension sizes of the matrix.
size_t pTotalElementCount
Total number of elements.
virtual size_t GetTotalAllocatedElementCount() const
Get total allocated element count (might differ from total element count used for the simulation beca...
size_t pDataRowSize
Size of a 1D row in X dimension.
The header file containing the structure with 3D dimension sizes.
virtual ~TBaseFloatMatrix()
Destructor.
float * pMatrixData
Raw matrix data.
The header file of the common ancestor of all matrix classes. A pure abstract class.
virtual const float * GetRawData() const
Get raw data out of the class (for direct kernel access).
Structure with 4D dimension sizes (3 in space and 1 in time).