kspaceFirstOrder3D-OMP  1.2
The C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
MatrixContainer.cpp
Go to the documentation of this file.
1 /**
2  * @file MatrixContainer.cpp
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 implementation file containing the matrix container.
10  *
11  * @version kspaceFirstOrder3D 2.16
12  *
13  * @date 12 July 2012, 10:27 (created) \n
14  * 04 September 2017, 10:54 (revised)
15  *
16  * @copyright Copyright (C) 2017 Jiri Jaros and Bradley Treeby.
17  *
18  * This file is part of the C++ extension of the [k-Wave Toolbox](http://www.k-wave.org).
19  *
20  * This file is part of the k-Wave. k-Wave is free software: you can redistribute it and/or modify it under the terms
21  * of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the
22  * License, or (at your option) any later version.
23  *
24  * k-Wave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
25  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
26  * more details.
27  *
28  * You should have received a copy of the GNU Lesser General Public License along with k-Wave.
29  * If not, see [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/).
30  */
31 
32 #include <stdexcept>
33 
35 #include <Parameters/Parameters.h>
36 #include <Logger/Logger.h>
37 
42 
43 
44 
45 using std::string;
46 
47 //--------------------------------------------------------------------------------------------------------------------//
48 //-------------------------------------------------- Public methods --------------------------------------------------//
49 //--------------------------------------------------------------------------------------------------------------------//
50 
51 /**
52  * Constructor.
53  */
55  : mContainer()
56 {
57 
58 }// end of Constructor.
59 //----------------------------------------------------------------------------------------------------------------------
60 
61 
62 /**
63  * Destructor.
64  * No need for virtual destructor (no polymorphism).
65  */
67 {
68  mContainer.clear();
69 }// end of ~MatrixContainer
70 //----------------------------------------------------------------------------------------------------------------------
71 
72 
73 /**
74  * Create all matrix objects in the container.
75  */
77 {
78  using MatrixType = MatrixRecord::MatrixType;
79 
80  for (auto& it : mContainer)
81  {
82  if (it.second.matrixPtr != nullptr)
83  {
84  throw std::invalid_argument(Logger::formatMessage(kErrFmtRelocationError, it.second.matrixName.c_str()));
85  }
86 
87  switch (it.second.matrixType)
88  {
89  case MatrixType::kReal:
90  {
91  it.second.matrixPtr = new RealMatrix(it.second.dimensionSizes);
92  break;
93  }
94 
95  case MatrixType::kComplex:
96  {
97  it.second.matrixPtr = new ComplexMatrix(it.second.dimensionSizes);
98  break;
99  }
100 
101  case MatrixType::kIndex:
102  {
103  it.second.matrixPtr = new IndexMatrix(it.second.dimensionSizes);
104  break;
105  }
106 
107  case MatrixType::kFftw:
108  {
109  it.second.matrixPtr = new FftwComplexMatrix(it.second.dimensionSizes);
110  break;
111  }
112 
113  default:
114  {
115  throw std::invalid_argument(Logger::formatMessage(kErrFmtBadMatrixType, it.second.matrixName.c_str()));
116  break;
117  }
118  }// switch
119  }// end for
120 }// end of createMatrices
121 //----------------------------------------------------------------------------------------------------------------------
122 
123 
124 /**
125  * This function creates the list of matrices being used in the simulation. It is done based on the
126  * simulation parameters. All matrices records are created here.
127  */
129 {
130  using MT = MatrixRecord::MatrixType;
131  using MI = MatrixContainer::MatrixIdx;
132 
133  const Parameters& params = Parameters::getInstance();
134 
135  DimensionSizes fullDims = params.getFullDimensionSizes();
136  DimensionSizes reducedDims = params.getReducedDimensionSizes();
137 
138  constexpr bool kLoad = true;
139  constexpr bool kNoLoad = false;
140  constexpr bool kCheckpoint = true;
141  constexpr bool kNoCheckpoint = false;
142 
143  //--------------------------------------------- Allocate all matrices ----------------------------------------------//
144 
145  mContainer[MI::kKappa].set(MT::kReal, reducedDims, kNoLoad, kNoCheckpoint, kKappaRName);
146 
147  if (!params.getC0ScalarFlag())
148  {
149  mContainer[MI::kC2] .set(MT::kReal, fullDims , kLoad, kNoCheckpoint, kC0Name);
150  }
151 
152  mContainer[MI::kP] .set(MT::kReal, fullDims , kNoLoad, kCheckpoint, kPName);
153 
154  mContainer[MI::kRhoX] .set(MT::kReal, fullDims , kNoLoad, kCheckpoint, kRhoXName);
155  mContainer[MI::kRhoY] .set(MT::kReal, fullDims , kNoLoad, kCheckpoint, kRhoYName);
156  mContainer[MI::kRhoZ] .set(MT::kReal, fullDims , kNoLoad, kCheckpoint, kRhoZName);
157 
158  mContainer[MI::kUxSgx].set(MT::kReal, fullDims , kNoLoad, kCheckpoint, kUxSgxName);
159  mContainer[MI::kUySgy].set(MT::kReal, fullDims , kNoLoad, kCheckpoint, kUySgyName);
160  mContainer[MI::kUzSgz].set(MT::kReal, fullDims , kNoLoad, kCheckpoint, kUzSgzName);
161 
162  mContainer[MI::kDuxdx].set(MT::kReal, fullDims , kNoLoad, kNoCheckpoint, kDuxdxName);
163  mContainer[MI::kDuydy].set(MT::kReal, fullDims , kNoLoad, kNoCheckpoint, kDuydyName);
164  mContainer[MI::kDuzdz].set(MT::kReal, fullDims , kNoLoad, kNoCheckpoint, kDuzdzName);
165 
166  if (!params.getRho0ScalarFlag())
167  {
168  mContainer[MI::kRho0] .set(MT::kReal, fullDims, kLoad, kNoCheckpoint, kRho0Name);
169  mContainer[MI::kDtRho0Sgx].set(MT::kReal, fullDims, kLoad, kNoCheckpoint, kRho0SgxName);
170  mContainer[MI::kDtRho0Sgy].set(MT::kReal, fullDims, kLoad, kNoCheckpoint, kRho0SgyName);
171  mContainer[MI::kDtRho0Sgz].set(MT::kReal, fullDims, kLoad, kNoCheckpoint, kRho0SgzName);
172  }
173 
174 
175  mContainer[MI::kDdxKShiftPosR].set(MT::kComplex, DimensionSizes(reducedDims.nx, 1, 1),
176  kLoad, kNoCheckpoint, kDdxKShiftPosRName);
177  mContainer[MI::kDdyKShiftPos] .set(MT::kComplex, DimensionSizes(1, reducedDims.ny, 1),
178  kLoad, kNoCheckpoint, kDdyKShiftPosName);
179  mContainer[MI::kDdzKShiftPos] .set(MT::kComplex, DimensionSizes(1, 1, reducedDims.nz),
180  kLoad, kNoCheckpoint, kDdzKShiftPosName);
181 
182  mContainer[MI::kDdxKShiftNegR].set(MT::kComplex, DimensionSizes(reducedDims.nx ,1, 1),
183  kLoad, kNoCheckpoint, kDdxKShiftNegRName);
184  mContainer[MI::kDdyKShiftNeg] .set(MT::kComplex, DimensionSizes(1, reducedDims.ny, 1),
185  kLoad, kNoCheckpoint, kDdyKShiftNegName);
186  mContainer[MI::kDdzKShiftNeg] .set(MT::kComplex, DimensionSizes(1, 1, reducedDims.nz),
187  kLoad, kNoCheckpoint, kDdzKShiftNegName);
188 
189 
190  mContainer[MI::kPmlXSgx].set(MT::kReal, DimensionSizes(fullDims.nx, 1, 1), kLoad, kNoCheckpoint, kPmlXSgxName);
191  mContainer[MI::kPmlYSgy].set(MT::kReal, DimensionSizes(1, fullDims.ny, 1), kLoad, kNoCheckpoint, kPmlYSgyName);
192  mContainer[MI::kPmlZSgz].set(MT::kReal, DimensionSizes(1, 1, fullDims.nz), kLoad, kNoCheckpoint, kPmlZSgzName);
193 
194  mContainer[MI::kPmlX] .set(MT::kReal, DimensionSizes(fullDims.nx, 1, 1), kLoad, kNoCheckpoint, kPmlXName);
195  mContainer[MI::kPmlY] .set(MT::kReal, DimensionSizes(1, fullDims.ny, 1), kLoad, kNoCheckpoint, kPmlYName);
196  mContainer[MI::kPmlZ] .set(MT::kReal, DimensionSizes(1, 1, fullDims.nz), kLoad, kNoCheckpoint, kPmlZName);
197 
198  if (params.getNonLinearFlag())
199  {
200  if (! params.getBOnAScalarFlag())
201  {
202  mContainer[MI::kBOnA].set(MT::kReal, fullDims , kLoad, kNoCheckpoint, kBonAName);
203  }
204  }
205 
206  if (params.getAbsorbingFlag() != 0)
207  {
208  if (!((params.getC0ScalarFlag()) && (params.getAlphaCoeffScalarFlag())))
209  {
210  mContainer[MI::kAbsorbTau] .set(MT::kReal, fullDims , kNoLoad, kNoCheckpoint, kAbsorbTauName);
211  mContainer[MI::kAbsorbEta] .set(MT::kReal, fullDims , kNoLoad, kNoCheckpoint, kAbsorbEtaName);
212  }
213  mContainer[MI::kAbsorbNabla1].set(MT::kReal, reducedDims, kNoLoad, kNoCheckpoint, kAbsorbNabla1RName);
214  mContainer[MI::kAbsorbNabla2].set(MT::kReal, reducedDims, kNoLoad, kNoCheckpoint, kAbsorbNabla2RName);
215  }
216 
217  // linear sensor mask
219  {
220  mContainer[MI::kSensorMaskIndex].set(MT::kIndex,
221  DimensionSizes(params.getSensorMaskIndexSize(), 1, 1),
222  kLoad, kNoCheckpoint, kSensorMaskIndexName);
223  }
224 
225  // cuboid sensor mask
227  {
228  mContainer[MI::kSensorMaskCorners].set(MT::kIndex,
230  kLoad, kNoCheckpoint, kSensorMaskCornersName);
231  }
232 
233 
234  // if p0 source flag
235  if (params.getInitialPressureSourceFlag() == 1)
236  {
237  mContainer[MI::kInitialPressureSourceInput].set(MT::kReal,fullDims, kLoad, kNoCheckpoint,
239  }
240 
241 
242  // us_index
243  if ((params.getTransducerSourceFlag() != 0) ||
244  (params.getVelocityXSourceFlag() != 0) ||
245  (params.getVelocityYSourceFlag() != 0) ||
246  (params.getVelocityZSourceFlag() != 0))
247  {
248  mContainer[MI::kVelocitySourceIndex].set(MT::kIndex,
250  kLoad, kNoCheckpoint, kVelocitySourceIndexName);
251  }
252 
253  //transducer source flag defined
254  if (params.getTransducerSourceFlag() != 0)
255  {
256  mContainer[MI::kDelayMask] .set(MT::kIndex,DimensionSizes(1 ,1, params.getVelocitySourceIndexSize()) ,
257  kLoad, kNoCheckpoint, kDelayMaskName);
258  mContainer[MI::kTransducerSourceInput].set(MT::kReal ,DimensionSizes(1 ,1, params.getTransducerSourceInputSize()),
259  kLoad, kNoCheckpoint, kTransducerSourceInputName);
260  }
261 
262  // p variables
263  if (params.getPressureSourceFlag() != 0)
264  {
265  if (params.getPressureSourceMany() == 0)
266  { // 1D case
267  mContainer[MI::kPressureSourceInput].set(MT::kReal,
268  DimensionSizes(1 ,1, params.getPressureSourceFlag()),
269  kLoad, kNoCheckpoint, kPressureSourceInputName);
270  }
271  else
272  { // 2D case
273  mContainer[MI::kPressureSourceInput].set(MT::kReal,
275  params.getPressureSourceFlag()),
276  kLoad, kNoCheckpoint, kPressureSourceInputName);
277  }
278 
279  mContainer[MI::kPressureSourceIndex].set(MT::kIndex,
281  kLoad, kNoCheckpoint, kPressureSourceIndexName);
282  }
283 
284 
285 
286  //-------------------------------------------- Velocity source flags -----------------------------------------------//
287  if (params.getVelocityXSourceFlag() != 0)
288  {
289  if (params.getVelocitySourceMany() == 0)
290  { // 1D
291  mContainer[MI::kVelocityXSourceInput].set(MT::kReal,
292  DimensionSizes(1 ,1, params.getVelocityXSourceFlag()),
293  kLoad, kNoCheckpoint, kVelocityXSourceInputName);
294  }
295  else
296  { // 2D
297  mContainer[MI::kVelocityXSourceInput].set(MT::kReal,
299  params.getVelocityXSourceFlag()),
300  kLoad, kNoCheckpoint, kVelocityXSourceInputName);
301  }
302  }// ux_source_input
303 
304 
305  if (params.getVelocityYSourceFlag() != 0)
306  {
307  if (params.getVelocitySourceMany() == 0)
308  { // 1D
309  mContainer[MI::kVelocityYSourceInput].set(MT::kReal,
310  DimensionSizes(1 ,1, params.getVelocityYSourceFlag()),
311  kLoad, kNoCheckpoint, kVelocityYSourceInputName);
312  }
313  else
314  { // 2D
315  mContainer[MI::kVelocityYSourceInput].set(MT::kReal,
317  params.getVelocityYSourceFlag()),
318  kLoad, kNoCheckpoint, kVelocityYSourceInputName);
319  }
320  }// uy_source_input
321 
322  if (params.getVelocityZSourceFlag() != 0)
323  {
324  if (params.getVelocitySourceMany() == 0)
325  { // 1D
326  mContainer[MI::kVelocityZSourceInput].set(MT::kReal,
327  DimensionSizes(1 ,1, params.getVelocityZSourceFlag()),
328  kLoad, kNoCheckpoint, kVelocityZSourceInputName);
329  }
330  else
331  { // 2D
332  mContainer[MI::kVelocityZSourceInput].set(MT::kReal,
334  params.getVelocityZSourceFlag()),
335  kLoad, kNoCheckpoint, kVelocityZSourceInputName);
336  }
337  }// uz_source_input
338 
339 
340  //------------------------------------------------ Nonlinear grid --------------------------------------------------//
341  if (params.getNonUniformGridFlag()!= 0)
342  {
343  mContainer[MI::kDxudxn] .set(MT::kReal, DimensionSizes(fullDims.nx, 1, 1), kLoad, kNoCheckpoint, kDxudxnName);
344  mContainer[MI::kDyudyn] .set(MT::kReal, DimensionSizes(1, fullDims.ny, 1), kLoad, kNoCheckpoint, kDyudynName);
345  mContainer[MI::kDzudzn] .set(MT::kReal, DimensionSizes(1 ,1, fullDims.nz), kLoad, kNoCheckpoint, kDzudznName);
346 
347  mContainer[MI::kDxudxnSgx].set(MT::kReal, DimensionSizes(fullDims.nx, 1, 1), kLoad, kNoCheckpoint, kDxudxnSgxName);
348  mContainer[MI::kDyudynSgy].set(MT::kReal, DimensionSizes(1, fullDims.ny, 1), kLoad, kNoCheckpoint, kDyudynSgyName);
349  mContainer[MI::kDzudznSgz].set(MT::kReal, DimensionSizes(1 ,1, fullDims.nz), kLoad, kNoCheckpoint, kDzudznSgzName);
350  }
351 
352  //-------------------------------------------- Non staggered velocity ----------------------------------------------//
354  {
355  DimensionSizes shiftDims = fullDims;
356 
357  size_t nxR = fullDims.nx / 2 + 1;
358  size_t nyR = fullDims.ny / 2 + 1;
359  size_t nzR = fullDims.nz / 2 + 1;
360 
361  size_t xCutSize = nxR * fullDims.ny * fullDims.nz;
362  size_t yCutSize = fullDims.nx * nyR * fullDims.nz;
363  size_t zCutSize = fullDims.nx * fullDims.ny * nzR;
364 
365  if ((xCutSize >= yCutSize) && (xCutSize >= zCutSize))
366  { // X cut is the biggest
367  shiftDims.nx = nxR;
368  }
369  else if ((yCutSize >= xCutSize) && (yCutSize >= zCutSize))
370  { // Y cut is the biggest
371  shiftDims.ny = nyR;
372  }
373  else if ((zCutSize >= xCutSize) && (zCutSize >= yCutSize))
374  { // Z cut is the biggest
375  shiftDims.nz = nzR;
376  }
377  else
378  { //all are the same
379  shiftDims.nx = nxR;
380  }
381 
382  mContainer[MI::kTempFftwShift].set(MT::kFftw, shiftDims, kNoLoad, kNoCheckpoint, kCufftShiftTempName);
383 
384  // these three are necessary only for u_non_staggered calculation now
385  mContainer[MI::kUxShifted].set(MT::kReal, fullDims, kNoLoad, kNoCheckpoint, kUxShiftedName);
386  mContainer[MI::kUyShifted].set(MT::kReal, fullDims, kNoLoad, kNoCheckpoint, kUyShiftedName);
387  mContainer[MI::kUzShifted].set(MT::kReal, fullDims, kNoLoad, kNoCheckpoint, kUzShiftedName);
388 
389  // shifts from the input file
390  mContainer[MI::kXShiftNegR].set(MT::kComplex, DimensionSizes(nxR, 1 , 1 ), kLoad, kNoCheckpoint, kXShiftNegRName);
391  mContainer[MI::kYShiftNegR].set(MT::kComplex, DimensionSizes(1 , nyR, 1 ), kLoad, kNoCheckpoint, kYShiftNegRName);
392  mContainer[MI::kZShiftNegR].set(MT::kComplex, DimensionSizes(1 , 1 , nzR), kLoad, kNoCheckpoint, kZShiftNegRName);
393  }// u_non_staggered
394 
395 
396  //----------------------------------------------- Temporary matrices -----------------------------------------------//
397  // this matrix used to load alphaCoeff for absorbTau pre-calculation
398  if ((params.getAbsorbingFlag() != 0) && (!params.getAlphaCoeffScalarFlag()))
399  {
400  mContainer[MI::kTemp1Real3D].set(MT::kReal, fullDims , kLoad, kNoCheckpoint, kAlphaCoeffName);
401  }
402  else
403  {
404  mContainer[MI::kTemp1Real3D].set(MT::kReal, fullDims , kNoLoad, kNoCheckpoint, kTemp1Real3DName);
405  }
406 
407  mContainer[MI::kTemp2Real3D].set(MT::kReal, fullDims , kNoLoad, kNoCheckpoint, kTemp2Real3DName);
408  mContainer[MI::kTemp3Real3D].set(MT::kReal, fullDims , kNoLoad, kNoCheckpoint, kTemp3Real3DName);
409 
410  mContainer[MI::kTempFftwX].set(MT::kFftw, reducedDims, kNoLoad, kNoCheckpoint, kCufftXTempName);
411  mContainer[MI::kTempFftwY].set(MT::kFftw, reducedDims, kNoLoad, kNoCheckpoint, kCufftYTempName);
412  mContainer[MI::kTempFftwZ].set(MT::kFftw, reducedDims, kNoLoad, kNoCheckpoint, kCufftZTempName);
413 }// end of addMatrices
414 //----------------------------------------------------------------------------------------------------------------------
415 
416 /**
417  * Free all matrix objects.
418  */
420 {
421  for (auto& it : mContainer)
422  {
423  if (it.second.matrixPtr)
424  {
425  delete it.second.matrixPtr;
426  it.second.matrixPtr = nullptr;
427  }
428  }
429 }// end of freeMatrices
430 //----------------------------------------------------------------------------------------------------------------------
431 
432 /**
433  * Load all marked matrices from the input HDF5 file.
434  */
436 {
438 
439  for (const auto& it : mContainer)
440  {
441  if (it.second.loadData)
442  {
443  it.second.matrixPtr->readData(inputFile, it.second.matrixName);
444  }
445  }
446 }// end of loadDataFromInputFile
447 //----------------------------------------------------------------------------------------------------------------------
448 
449 /**
450  * Load selected matrices from the checkpoint HDF5 file.
451  */
453 {
454  Hdf5File& checkpointFile = Parameters::getInstance().getCheckpointFile();
455 
456  for (const auto& it : mContainer)
457  {
458  if (it.second.checkpoint)
459  {
460  it.second.matrixPtr->readData(checkpointFile,it.second.matrixName);
461  }
462  }
463 }// end of loadDataFromCheckpointFile
464 //----------------------------------------------------------------------------------------------------------------------
465 
466 /**
467  * Store selected matrices into the checkpoint file.
468  */
470 {
471  Hdf5File& checkpointFile = Parameters::getInstance().getCheckpointFile();
472  auto compressionLevel = Parameters::getInstance().getCompressionLevel();
473 
474  for (const auto& it : mContainer)
475  {
476  if (it.second.checkpoint)
477  {
478  it.second.matrixPtr->writeData(checkpointFile, it.second.matrixName, compressionLevel);
479  }
480  }
481 }// end of storeDataIntoCheckpointFile
482 //----------------------------------------------------------------------------------------------------------------------
483 
484 //--------------------------------------------------------------------------------------------------------------------//
485 //------------------------------------------------ Protected methods -------------------------------------------------//
486 //--------------------------------------------------------------------------------------------------------------------//
487 
488 //--------------------------------------------------------------------------------------------------------------------//
489 //------------------------------------------------- Private methods --------------------------------------------------//
490 //--------------------------------------------------------------------------------------------------------------------//
491 
MatrixName kYShiftNegRName
y_shift_neg_r variable name
Definition: MatrixNames.h:79
The class for real matrices.
Definition: RealMatrix.h:47
MatrixName kRhoYName
rhoy variable name
Definition: MatrixNames.h:189
Hdf5File & getCheckpointFile()
Get checkpoint file handle.
Definition: Parameters.h:163
MatrixName kDxudxnSgxName
dxudxn_sgx variable name
Definition: MatrixNames.h:229
size_t getCompressionLevel() const
Get compression level.
Definition: Parameters.h:127
MatrixName kUzShiftedName
uz_shifted variable name
Definition: MatrixNames.h:88
Class implementing 3D and 1D Real-To-Complex and Complex-To-Real transforms using FFTW interface...
size_t nz
Number of elements in the z direction.
bool getC0ScalarFlag() const
Is sound speed in the medium homogeneous (scalar value)?
Definition: Parameters.h:249
MatrixName kTemp3Real3DName
Temp_3_RS3D variable name.
Definition: MatrixNames.h:327
MatrixName kPmlYSgyName
pml_y_sgy variable name
Definition: MatrixNames.h:100
bool getRho0ScalarFlag() const
Is density in the medium homogeneous (scalar value)?
Definition: Parameters.h:266
size_t getPressureSourceIndexSize() const
Get spatial size of the pressure source.
Definition: Parameters.h:444
size_t getTransducerSourceFlag() const
Get transducer source flag.
Definition: Parameters.h:419
ErrorMessage kErrFmtBadMatrixType
Matrix container error message.
size_t getSensorMaskIndexSize() const
Get spatial size of the index sensor mask.
Definition: Parameters.h:489
MatrixName kDdxKShiftPosRName
ddx_k_shift_pos_r variable name
Definition: MatrixNames.h:236
size_t getNonLinearFlag() const
Is the wave propagation nonlinear?
Definition: Parameters.h:319
MatrixName kVelocityYSourceInputName
uy_source_input variable name
Definition: MatrixNames.h:151
The header file containing the class for real matrices.
MatrixName kRho0Name
rho0 variable name
Definition: MatrixNames.h:250
void loadDataFromCheckpointFile()
Load selected matrices from the checkpoint HDF5 file.
MatrixName kDelayMaskName
delay_mask variable name
Definition: MatrixNames.h:177
MatrixName kAbsorbNabla1RName
absorb_nabla1_r variable name
Definition: MatrixNames.h:263
MatrixName kUySgyName
uy_sgy variable name
Definition: MatrixNames.h:203
Class storing all parameters of the simulation.
Definition: Parameters.h:50
MatrixName kPmlZName
pml_z variable name
Definition: MatrixNames.h:109
MatrixName kVelocityXSourceInputName
ux_source_input variable name
Definition: MatrixNames.h:149
DimensionSizes getFullDimensionSizes() const
Get full dimension sizes of the simulation (real classes).
Definition: Parameters.h:191
MatrixName kDuydyName
duydy variable name
Definition: MatrixNames.h:217
MatrixName kAbsorbNabla2RName
absorb_nabla2_r variable name
Definition: MatrixNames.h:265
MatrixName kDdzKShiftNegName
ddz_k_shift_neg variable name
Definition: MatrixNames.h:247
MatrixName kDuxdxName
duxdx variable name
Definition: MatrixNames.h:215
MatrixName kCufftShiftTempName
CUFFT_shift_temp variable name.
Definition: MatrixNames.h:331
The header file containing the parameters of the simulation.
size_t getPressureSourceFlag() const
Get pressure source flag.
Definition: Parameters.h:408
MatrixName kPmlZSgzName
pml_z_sgz variable name
Definition: MatrixNames.h:102
size_t getNonUniformGridFlag() const
Enable non uniform grid? - not implemented yet.
Definition: Parameters.h:309
void freeMatrices()
Destroy and free all matrices.
MatrixName kUxSgxName
ux_sgx variable name
Definition: MatrixNames.h:201
MatrixName kCufftYTempName
CUFFT_Y_temp variable name.
Definition: MatrixNames.h:335
bool getStoreVelocityNonStaggeredRawFlag() const
Is –u_non_staggered_raw set?
Definition: Parameters.h:547
std::map< MatrixIdx, MatrixRecord > mContainer
Map holding the container.
MatrixName kC0Name
c0 variable name
Definition: MatrixNames.h:62
MatrixName kDxudxnName
dxudxn variable name
Definition: MatrixNames.h:222
MatrixName kBonAName
BonA variable name.
Definition: MatrixNames.h:183
void createMatrices()
Create all matrix objects in the container.
The header file containing a class responsible for printing out info and error messages (stdout...
~MatrixContainer()
Destructor.
size_t getVelocityXSourceFlag() const
Get velocity in x source flag.
Definition: Parameters.h:425
Class wrapping the HDF5 routines.
Definition: Hdf5File.h:490
MatrixName kPmlXSgxName
pml_x_sgx variable name
Definition: MatrixNames.h:98
The class for complex matrices.
Definition: ComplexMatrix.h:51
MatrixName kDyudynName
dyudyn variable name
Definition: MatrixNames.h:224
MatrixName kXShiftNegRName
x_shift_neg_r variable name
Definition: MatrixNames.h:77
MatrixName kKappaRName
kappa_r variable name
Definition: MatrixNames.h:181
MatrixName kDdyKShiftPosName
ddy_k_shift_pos variable name
Definition: MatrixNames.h:238
MatrixName kVelocityZSourceInputName
uz_source_input variable name
Definition: MatrixNames.h:153
MatrixName kInitialPressureSourceInputName
p0_source_input variable name
Definition: MatrixNames.h:175
MatrixName kPmlYName
pml_y variable name
Definition: MatrixNames.h:107
MatrixType
All possible types of the matrix.
Definition: MatrixRecord.h:53
static std::string formatMessage(const std::string &format, Args ... args)
C++-11 replacement for sprintf that works with std::string instead of char*.
Definition: Logger.h:157
bool getBOnAScalarFlag() const
Is nonlinear coefficient homogeneous in the medium (scalar value)?
Definition: Parameters.h:361
The header file containing the class for 64b integer matrices.
MatrixName kPName
p variable name
Definition: MatrixNames.h:185
MatrixContainer()
Constructor.
MatrixName kTemp2Real3DName
Temp_2_RS3D variable name.
Definition: MatrixNames.h:325
MatrixName kDzudznName
dzudzn variable name
Definition: MatrixNames.h:226
MatrixIdx
Matrix identifers of all matrices in the k-space code.
Structure with 4D dimension sizes (3 in space and 1 in time).
MatrixName kDdxKShiftNegRName
ddx_k_shift_neg_r variable name
Definition: MatrixNames.h:243
size_t getInitialPressureSourceFlag() const
Get initial pressure source flag (p0).
Definition: Parameters.h:413
MatrixName kVelocitySourceIndexName
u_source_index variable name
Definition: MatrixNames.h:147
Cuboid corners sensor mask.
ErrorMessage kErrFmtRelocationError
Matrix container error message.
MatrixName kDyudynSgyName
dyudyn_sgy variable name
Definition: MatrixNames.h:231
SensorMaskType getSensorMaskType() const
Get sensor mask type (linear or corners).
Definition: Parameters.h:484
size_t getTransducerSourceInputSize() const
Get spatial size of the transducer source.
Definition: Parameters.h:449
MatrixName kUzSgzName
uz_sgz variable name
Definition: MatrixNames.h:205
The header file with the class for complex matrices.
size_t ny
Number of elements in the y direction.
MatrixName kAlphaCoeffName
alpha_coeff variable name
Definition: MatrixNames.h:67
MatrixName kSensorMaskIndexName
sensor_mask_index variable name
Definition: MatrixNames.h:165
MatrixName kDdzKShiftPosName
ddz_k_shift_pos variable name
Definition: MatrixNames.h:240
size_t getVelocitySourceIndexSize() const
Get spatial size of the velocity source.
Definition: Parameters.h:454
Hdf5File & getInputFile()
Get input file handle.
Definition: Parameters.h:153
bool getAlphaCoeffScalarFlag() const
Is alpha absorption coefficient homogeneous (scalar value)?
Definition: Parameters.h:325
MatrixName kAbsorbEtaName
absorb_eta variable name
Definition: MatrixNames.h:261
MatrixName kRho0SgyName
rho0_sgy variable name
Definition: MatrixNames.h:254
void storeDataIntoCheckpointFile()
Store selected matrices into the checkpoint file.
MatrixName kTransducerSourceInputName
transducer_source_input variable name
Definition: MatrixNames.h:172
The header file containing the matrix container.
size_t getVelocityYSourceFlag() const
Get velocity in y source flag.
Definition: Parameters.h:431
MatrixName kCufftZTempName
CUFFT_Z_temp variable name.
Definition: MatrixNames.h:337
MatrixName kRho0SgzName
rho0_sgz variable name
Definition: MatrixNames.h:256
MatrixName kDdyKShiftNegName
ddy_k_shift_neg variable name
Definition: MatrixNames.h:245
MatrixName kDuzdzName
duzdz variable name
Definition: MatrixNames.h:219
MatrixName kUxShiftedName
ux_shifted variable name
Definition: MatrixNames.h:84
MatrixName kSensorMaskCornersName
sensor_mask_corners variable name
Definition: MatrixNames.h:169
size_t nx
Number of elements in the x direction.
void loadDataFromInputFile()
Load all marked matrices from the input HDF5 file.
size_t getPressureSourceMany() const
Get number of time series in the pressure source.
Definition: Parameters.h:466
size_t getVelocityZSourceFlag() const
Get velocity in z source flag.
Definition: Parameters.h:437
The header file containing the class that implements 3D FFT using the FFTW interface.
MatrixName kPressureSourceIndexName
p_source_index variable name
Definition: MatrixNames.h:144
MatrixName kDzudznSgzName
dzudzn_sgz variable name
Definition: MatrixNames.h:233
size_t getVelocitySourceMany() const
Get number of time series in the velocity sources.
Definition: Parameters.h:477
static Parameters & getInstance()
Get instance of the singleton class.
Definition: Parameters.cpp:84
MatrixName kZShiftNegRName
z_shift_neg_r variable name
Definition: MatrixNames.h:81
size_t getAbsorbingFlag() const
Is the simulation absrobing or lossless?
Definition: Parameters.h:314
MatrixName kRhoZName
rhoz variable name
Definition: MatrixNames.h:191
MatrixName kRho0SgxName
rho0_sgx variable name
Definition: MatrixNames.h:252
The class for 64b unsigned integers (indices). It is used for linear and cuboid corners masks to get ...
Definition: IndexMatrix.h:47
MatrixName kPressureSourceInputName
p_source_input variable name
Definition: MatrixNames.h:142
MatrixName kAbsorbTauName
absorb_tau variable name
Definition: MatrixNames.h:259
MatrixName kUyShiftedName
uy_shifted variable name
Definition: MatrixNames.h:86
MatrixName kRhoXName
rhox variable name
Definition: MatrixNames.h:187
size_t getSensorMaskCornersSize() const
Get number of cuboids the sensor is composed of.
Definition: Parameters.h:494
MatrixName kCufftXTempName
CUFFT_X_temp variable name.
Definition: MatrixNames.h:333
void addMatrices()
Populate the container based on the simulation type.
MatrixName kPmlXName
pml_x variable name
Definition: MatrixNames.h:105
MatrixName kTemp1Real3DName
Temp_1_RS3D variable name.
Definition: MatrixNames.h:323
DimensionSizes getReducedDimensionSizes() const
Get reduced dimension sizes of the simulation (complex classes).
Definition: Parameters.h:197