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