![]() |
kspaceFirstOrder3D-CUDA
1.1
The CUDA/C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
|
Class implementing the matrix container. More...
#include <MatrixContainer.h>
Public Member Functions | |
TMatrixContainer () | |
Constructor. More... | |
~TMatrixContainer () | |
Destructor. More... | |
size_t | Size () const |
Get the number of matrices in the container. More... | |
bool | IsEmpty () const |
Is the container empty? More... | |
TMatrixRecord & | operator[] (const TMatrixIdx matrixIdx) |
operator[] More... | |
template<typename T > | |
T & | GetMatrix (const TMatrixIdx matrixIdx) |
Get the matrix with a specific type from the container. More... | |
void | CreateMatrices () |
Create all matrices in the container. | |
void | AddMatrices () |
Populate the container based on the simulation type. More... | |
void | FreeMatrices () |
Destroy and free all matrices. More... | |
void | LoadDataFromInputFile (THDF5_File &inputFile) |
Load all matrices from the input HDF5 file. More... | |
void | LoadDataFromCheckpointFile (THDF5_File &checkpointFile) |
Load all matrices from the output HDF5 file. More... | |
void | StoreDataIntoCheckpointFile (THDF5_File &checkpointFile) |
Store selected matrices into the checkpoint file. More... | |
void | CopyMatricesToDevice () |
Copy all matrices from host to device (CPU -> GPU). More... | |
void | CopyMatricesFromDevice () |
Copy all matrices from device to host (GPU -> CPU). More... | |
Private Types | |
typedef std::map< TMatrixIdx, TMatrixRecord > | TMatrixRecordContainer |
Datatype for the map associating the matrix ID enum and matrix record. | |
Private Member Functions | |
TMatrixContainer (const TMatrixContainer &orig) | |
Copy constructor is not allowed for public. | |
TMatrixContainer & | operator= (const TMatrixContainer &src) |
Operator = is not allowed for public. | |
Private Attributes | |
TMatrixRecordContainer | matrixContainer |
map holding the container | |
This container is responsible to maintain all the matrices in the code except the output streams. The matrices are allocated, freed, loaded stored and check-pointed from here.
Definition at line 96 of file MatrixContainer.h.
TMatrixContainer::TMatrixContainer | ( | ) |
Constructor
Definition at line 51 of file MatrixContainer.cpp.
TMatrixContainer::~TMatrixContainer | ( | ) |
Destructor. No need for virtual destructor (no polymorphism).
Definition at line 62 of file MatrixContainer.cpp.
void TMatrixContainer::AddMatrices | ( | ) |
This function creates the list of matrices being used in the simulation. It is done based on the simulation parameters. All matrices records are created here.
Definition at line 123 of file MatrixContainer.cpp.
void TMatrixContainer::CopyMatricesFromDevice | ( | ) |
Copy all matrices back over to CPU. Can be used for debugging purposes.
Definition at line 486 of file MatrixContainer.cpp.
void TMatrixContainer::CopyMatricesToDevice | ( | ) |
Copy all matrices over to the GPU.
Definition at line 474 of file MatrixContainer.cpp.
void TMatrixContainer::FreeMatrices | ( | ) |
Free all matrix objects.
Definition at line 458 of file MatrixContainer.cpp.
|
inline |
This template routine returns the reference to the matrix re-casted to the specific class type.
[in] | matrixIdx | - Matrix identifier |
Definition at line 144 of file MatrixContainer.h.
|
inline |
Is the container empty?
Definition at line 120 of file MatrixContainer.h.
void TMatrixContainer::LoadDataFromCheckpointFile | ( | THDF5_File & | checkpointFile | ) |
Load selected matrices from the checkpoint HDF5 file.
[in] | checkpointFile | - HDF5 checkpoint file handle |
Definition at line 422 of file MatrixContainer.cpp.
void TMatrixContainer::LoadDataFromInputFile | ( | THDF5_File & | inputFile | ) |
Load all marked matrices from the input HDF5 file.
[in] | inputFile | - HDF5 input file handle |
Definition at line 406 of file MatrixContainer.cpp.
|
inline |
operator[]
[in] | matrixIdx | - Matrix identifier |
Definition at line 131 of file MatrixContainer.h.
|
inline |
Get the number of matrices in the container.
Definition at line 110 of file MatrixContainer.h.
void TMatrixContainer::StoreDataIntoCheckpointFile | ( | THDF5_File & | checkpointFile | ) |
Store selected matrices into the checkpoint file.
[in] | checkpointFile | - Checkpoint file |
Definition at line 438 of file MatrixContainer.cpp.