| 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
BaseMatrix.h
Go to the documentation of this file.
1 /**
2 * @file BaseMatrix.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 common ancestor of all matrix classes.
10 * A pure abstract class.
11 *
12 * @version kspaceFirstOrder3D 3.4
13 *
14 * @date 11 July 2012, 11:34 (created) \n
15 * 26 July 2016, 12:30 (revised)
16 *
17 * @section License
18 * This file is part of the C++ extension of the k-Wave Toolbox
19 * (http://www.k-wave.org).\n Copyright (C) 2016 Jiri Jaros and Bradley Treeby.
20 *
21 * This file is part of the k-Wave. k-Wave is free software: you can redistribute it and/or modify
22 * it under the terms of the GNU Lesser General Public License as published by the Free Software
23 * Foundation, either version 3 of the License, or (at your option) any later version.
24 *
25 * k-Wave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
26 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
27 * General Public License for more details.
28 *
29 * You should have received a copy of the GNU Lesser General Public License along with k-Wave.
30 * If not, see http://www.gnu.org/licenses/.
31 */
32
33 #ifndef BASE_MATRIX_H
34 #define BASE_MATRIX_H
35
36 #include <Utils/DimensionSizes.h>
37 #include <HDF5/HDF5_File.h>
38
39 /**
40 * @class TBaseMatrix
41 * @brief Abstract base class. The common ancestor defining the common interface and allowing
42 * derived classes to be allocated, freed and loaded from the file using the Matrix container.
43 *
44 * @details Abstract base class. The common ancestor defining the common interface and allowing
45 * derived classes to be allocated, freed and loaded from the file using the Matrix
46 * container. In this version of the code, It allocates memory both on the CPU and GPU side.
47 */
48 class TBaseMatrix
49 {
50 public:
51 /// Default constructor.
52 TBaseMatrix() {};
53
54 /// Destructor
55 virtual ~TBaseMatrix() {};
56
57 /// Get dimension sizes of the matrix.
58 virtual struct TDimensionSizes GetDimensionSizes() const = 0;
59
60 /// Get total element count of the matrix.
61 virtual size_t GetElementCount() const = 0;
62 /// Get total allocated element count (might differ from the total element count used for the simulation because of e.g. padding).
63 virtual size_t GetAllocatedElementCount() const = 0;
64
65 /**
66 * @brief Read matrix from the HDF5 file.
67 * @details Read matrix from the HDF5 file.
68 * @param [in] file - Handle to the HDF5 file
69 * @param [in] matrixName - HDF5 dataset name to read from
70 */
71 virtual void ReadDataFromHDF5File(THDF5_File& file,
72 TMatrixName& matrixName) = 0;
73
74 /**
75 * @brief Write data into the HDF5 file.
76 * @details Write data into the HDF5 file.
77 * @param [in] file - Handle to the HDF5 file
78 * @param [in] matrixName - HDF5 dataset name to write to
79 * @param [in] compressionLevel - Compression level for the HDF5 dataset
80 */
81 virtual void WriteDataToHDF5File(THDF5_File& file,
82 TMatrixName& matrixName,
83 const size_t compressionLevel) = 0;
84
85 /// Copy data from CPU -> GPU (Host -> Device).
86 virtual void CopyToDevice() = 0;
87
88 /// Copy data from GPU -> CPU (Device -> Host).
89 virtual void CopyFromDevice() = 0;
90
91 protected:
92
93 };// end of TBaseMatrix
94 //--------------------------------------------------------------------------------------------------
95
96 #endif /* BASE_MATRIX_H */
97
TBaseMatrix
Abstract base class. The common ancestor defining the common interface and allowing derived classes t...
Definition: BaseMatrix.h:48
TBaseMatrix::GetDimensionSizes
virtual struct TDimensionSizes GetDimensionSizes() const =0
Get dimension sizes of the matrix.
TBaseMatrix::WriteDataToHDF5File
virtual void WriteDataToHDF5File(THDF5_File &file, TMatrixName &matrixName, const size_t compressionLevel)=0
Write data into the HDF5 file.
TBaseMatrix::CopyToDevice
virtual void CopyToDevice()=0
Copy data from CPU -> GPU (Host -> Device).
HDF5_File.h
The header file containing the HDF5 related classes.
TBaseMatrix::TBaseMatrix
TBaseMatrix()
Default constructor.
Definition: BaseMatrix.h:52
TMatrixName
const std::string TMatrixName
Datatype for matrix names.
Definition: MatrixNames.h:45
TBaseMatrix::~TBaseMatrix
virtual ~TBaseMatrix()
Destructor.
Definition: BaseMatrix.h:55
DimensionSizes.h
The header file containing the structure with 3D dimension sizes.
TBaseMatrix::ReadDataFromHDF5File
virtual void ReadDataFromHDF5File(THDF5_File &file, TMatrixName &matrixName)=0
Read matrix from the HDF5 file.
TBaseMatrix::CopyFromDevice
virtual void CopyFromDevice()=0
Copy data from GPU -> CPU (Device -> Host).
TBaseMatrix::GetElementCount
virtual size_t GetElementCount() const =0
Get total element count of the matrix.
TBaseMatrix::GetAllocatedElementCount
virtual size_t GetAllocatedElementCount() const =0
Get total allocated element count (might differ from the total element count used for the simulation ...
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