kspaceFirstOrder3D-OMP  1.2
The C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
MatrixContainer Class Reference

Class implementing the matrix container. More...

#include <MatrixContainer.h>

Collaboration diagram for MatrixContainer:

Public Types

enum  MatrixIdx {
  MatrixIdx::kKappa, MatrixIdx::kC2, MatrixIdx::kP, MatrixIdx::kRhoX,
  MatrixIdx::kRhoY, MatrixIdx::kRhoZ, MatrixIdx::kUxSgx, MatrixIdx::kUySgy,
  MatrixIdx::kUzSgz, MatrixIdx::kDuxdx, MatrixIdx::kDuydy, MatrixIdx::kDuzdz,
  MatrixIdx::kRho0, MatrixIdx::kDtRho0Sgx, MatrixIdx::kDtRho0Sgy, MatrixIdx::kDtRho0Sgz,
  MatrixIdx::kDdxKShiftPosR, MatrixIdx::kDdyKShiftPos, MatrixIdx::kDdzKShiftPos, MatrixIdx::kDdxKShiftNegR,
  MatrixIdx::kDdyKShiftNeg, MatrixIdx::kDdzKShiftNeg, MatrixIdx::kPmlXSgx, MatrixIdx::kPmlYSgy,
  MatrixIdx::kPmlZSgz, MatrixIdx::kPmlX, MatrixIdx::kPmlY, MatrixIdx::kPmlZ,
  MatrixIdx::kBOnA, MatrixIdx::kAbsorbTau, MatrixIdx::kAbsorbEta, MatrixIdx::kAbsorbNabla1,
  MatrixIdx::kAbsorbNabla2, MatrixIdx::kSensorMaskIndex, MatrixIdx::kSensorMaskCorners, MatrixIdx::kInitialPressureSourceInput,
  MatrixIdx::kPressureSourceInput, MatrixIdx::kTransducerSourceInput, MatrixIdx::kVelocityXSourceInput, MatrixIdx::kVelocityYSourceInput,
  MatrixIdx::kVelocityZSourceInput, MatrixIdx::kPressureSourceIndex, MatrixIdx::kVelocitySourceIndex, MatrixIdx::kDelayMask,
  MatrixIdx::kDxudxn, MatrixIdx::kDyudyn, MatrixIdx::kDzudzn, MatrixIdx::kDxudxnSgx,
  MatrixIdx::kDyudynSgy, MatrixIdx::kDzudznSgz, MatrixIdx::kUxShifted, MatrixIdx::kUyShifted,
  MatrixIdx::kUzShifted, MatrixIdx::kXShiftNegR, MatrixIdx::kYShiftNegR, MatrixIdx::kZShiftNegR,
  MatrixIdx::kTemp1Real3D, MatrixIdx::kTemp2Real3D, MatrixIdx::kTemp3Real3D, MatrixIdx::kTempFftwX,
  MatrixIdx::kTempFftwY, MatrixIdx::kTempFftwZ, MatrixIdx::kTempFftwShift
}
 Matrix identifers of all matrices in the k-space code. More...
 

Public Member Functions

 MatrixContainer ()
 Constructor. More...
 
 MatrixContainer (const MatrixContainer &)=delete
 Copy constructor is not allowed.
 
 ~MatrixContainer ()
 Destructor. More...
 
MatrixContaineroperator= (const MatrixContainer &)=delete
 Operator = is not allowed.
 
size_t size () const
 Get the number of matrices in the container. More...
 
bool empty () const
 Is the container empty? More...
 
MatrixRecordoperator[] (const MatrixIdx matrixIdx)
 operator[] More...
 
template<typename T >
T & getMatrix (const MatrixIdx matrixIdx)
 Get the matrix with a specific type from the container. More...
 
void createMatrices ()
 Create all matrix objects in the container. More...
 
void addMatrices ()
 Populate the container based on the simulation type. More...
 
void freeMatrices ()
 Destroy and free all matrices. More...
 
void loadDataFromInputFile ()
 Load all marked matrices from the input HDF5 file. More...
 
void loadDataFromCheckpointFile ()
 Load selected matrices from the checkpoint HDF5 file. More...
 
void storeDataIntoCheckpointFile ()
 Store selected matrices into the checkpoint file. More...
 

Private Attributes

std::map< MatrixIdx, MatrixRecordmContainer
 Map holding the container.
 

Detailed Description

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 49 of file MatrixContainer.h.

Member Enumeration Documentation

◆ MatrixIdx

Enumerator
kKappa 

Kappa matrix.

kC2 

c^2 matrix.

kP 

Pressure matrix.

kRhoX 

Acoustic density x.

kRhoY 

Acoustic density y.

kRhoZ 

Acoustic density z.

kUxSgx 

Velocity x on staggered grid.

kUySgy 

Velocity y on staggered grid.

kUzSgz 

Velocity z on staggered grid.

kDuxdx 

Acoustic acceleration x.

kDuydy 

Acoustic acceleration y.

kDuzdz 

Acoustic acceleration z.

kRho0 

Initial velocity.

kDtRho0Sgx 

dt / initial velocity on staggered grid x.

kDtRho0Sgy 

dt / initial velocity on staggered grid y.

kDtRho0Sgz 

dt / initial velocity on staggered grid z.

kDdxKShiftPosR 

Positive Fourier shift in x.

kDdyKShiftPos 

Positive Fourier shift in y.

kDdzKShiftPos 

Positive Fourier shift in z.

kDdxKShiftNegR 

Negative Fourier shift in x.

kDdyKShiftNeg 

Negative Fourier shift in y.

kDdzKShiftNeg 

Negative Fourier shift in z.

kPmlXSgx 

PML on staggered grid x.

kPmlYSgy 

PML on staggered grid y.

kPmlZSgz 

PML on staggered grid z.

kPmlX 

PML in x.

kPmlY 

PML in y.

kPmlZ 

PML in z.

kBOnA 

Nonlinear coefficient.

kAbsorbTau 

Absorbing coefficient Tau.

kAbsorbEta 

Absorbing coefficient Eau.

kAbsorbNabla1 

Absorbing coefficient Nabla 1.

kAbsorbNabla2 

Absorbing coefficient Nabla 2.

kSensorMaskIndex 

Linear sensor mask.

kSensorMaskCorners 

Cuboid corners sensor mask.

kInitialPressureSourceInput 

Initial pressure source data.

kPressureSourceInput 

Pressure source input data.

kTransducerSourceInput 

Transducer source input data.

kVelocityXSourceInput 

Velocity x source input data.

kVelocityYSourceInput 

Velocity y source input data.

kVelocityZSourceInput 

Velocity z source input data.

kPressureSourceIndex 

Pressure source geometry data.

kVelocitySourceIndex 

Velocity source geometry data.

kDelayMask 

Delay mask for many types sources.

kDxudxn 

Non uniform grid acoustic velocity in x.

kDyudyn 

Non uniform grid acoustic velocity in y.

kDzudzn 

Non uniform grid acoustic velocity in z.

kDxudxnSgx 

Non uniform grid acoustic velocity on staggered grid x.

kDyudynSgy 

Non uniform grid acoustic velocity on staggered grid y.

kDzudznSgz 

Non uniform grid acoustic velocity on staggered grid z.

kUxShifted 

velocity shift for non-staggered velocity in x.

kUyShifted 

velocity shift for non-staggered velocity in y.

kUzShifted 

velocity shift for non-staggered velocity in z.

kXShiftNegR 

Negative shift for non-staggered velocity in x.

kYShiftNegR 

Negative shift for non-staggered velocity in y.

kZShiftNegR 

Negative shift for non-staggered velocity in z.

kTemp1Real3D 

3D temporary matrix.

kTemp2Real3D 

3D temporary matrix.

kTemp3Real3D 

3D temporary matrix.

kTempFftwX 

Temporary matrix for 1D fft in x.

kTempFftwY 

Temporary matrix for 1D fft in y.

kTempFftwZ 

Temporary matrix for 1D fft in z.

kTempFftwShift 

Temporary matrix for fft shift.

Definition at line 56 of file MatrixContainer.h.

Constructor & Destructor Documentation

◆ MatrixContainer()

MatrixContainer::MatrixContainer ( )

Constructor.

Definition at line 54 of file MatrixContainer.cpp.

◆ ~MatrixContainer()

MatrixContainer::~MatrixContainer ( )

Destructor. No need for virtual destructor (no polymorphism).

Definition at line 66 of file MatrixContainer.cpp.

Member Function Documentation

◆ addMatrices()

void MatrixContainer::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 128 of file MatrixContainer.cpp.

◆ createMatrices()

void MatrixContainer::createMatrices ( )
Exceptions
std::bad_alloc- Usually due to out of memory.
std::invalid_argument- If this routine is called more than once.
std::invalid_argument- If matrix type is unknown.

Create all matrix objects in the container.

Definition at line 76 of file MatrixContainer.cpp.

◆ empty()

bool MatrixContainer::empty ( ) const
inline
Returns
true - If the container is empty.

Definition at line 223 of file MatrixContainer.h.

◆ freeMatrices()

void MatrixContainer::freeMatrices ( )

Free all matrix objects.

Definition at line 419 of file MatrixContainer.cpp.

◆ getMatrix()

template<typename T >
T& MatrixContainer::getMatrix ( const MatrixIdx  matrixIdx)
inline

This template routine returns the reference to the matrix re-casted to the specific class type.

Parameters
[in]matrixIdx- Matrix identifier,
Returns
Reference to the Matrix,

Definition at line 245 of file MatrixContainer.h.

◆ loadDataFromCheckpointFile()

void MatrixContainer::loadDataFromCheckpointFile ( )

Load selected matrices from the checkpoint HDF5 file.

Definition at line 452 of file MatrixContainer.cpp.

◆ loadDataFromInputFile()

void MatrixContainer::loadDataFromInputFile ( )

Load all marked matrices from the input HDF5 file.

Definition at line 435 of file MatrixContainer.cpp.

◆ operator[]()

MatrixRecord& MatrixContainer::operator[] ( const MatrixIdx  matrixIdx)
inline
Parameters
[in]matrixIdx- Matrix identifier
Returns
Matrix record.

Definition at line 233 of file MatrixContainer.h.

◆ size()

size_t MatrixContainer::size ( ) const
inline
Returns
Number of matrices in the container.

Definition at line 214 of file MatrixContainer.h.

◆ storeDataIntoCheckpointFile()

void MatrixContainer::storeDataIntoCheckpointFile ( )

Store selected matrices into the checkpoint file.

Definition at line 469 of file MatrixContainer.cpp.


The documentation for this class was generated from the following files: