kspaceFirstOrder3D-CUDA  1.1
The CUDA/C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 3.4
12  *
13  * @date 02 December 2014, 16:17 (created) \n
14  * 10 August 2016, 10:35 (revised)
15  *
16  * @section License
17  * This file is part of the C++ extension of the k-Wave Toolbox
18  * (http://www.k-wave.org).\n Copyright (C) 2016 Jiri Jaros and Bradley Treeby.
19  *
20  * This file is part of the k-Wave. k-Wave is free software: you can redistribute it and/or modify
21  * it under the terms of the GNU Lesser General Public License as published by the Free Software
22  * Foundation, either version 3 of the 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
25  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
26  * General Public License for 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/.
30  */
31 
32 #include <stdexcept>
33 
35 #include <Parameters/Parameters.h>
36 #include <Logger/ErrorMessages.h>
37 #include <Logger/Logger.h>
38 
39 //------------------------------------------------------------------------------------------------//
40 //------------------------------------------ Constants -------------------------------------------//
41 //------------------------------------------------------------------------------------------------//
42 
43 
44 //------------------------------------------------------------------------------------------------//
45 //--------------------------------------- Public methods -----------------------------------------//
46 //------------------------------------------------------------------------------------------------//
47 
48 /**
49  * Constructor
50  */
52 {
53 
54 }// end of Constructor.
55 //--------------------------------------------------------------------------------------------------
56 
57 
58 /**
59  * Destructor.
60  * No need for virtual destructor (no polymorphism).
61  */
63 {
64  matrixContainer.clear();
65 }// end of ~TMatrixContainer
66 //--------------------------------------------------------------------------------------------------
67 
68 /*
69  * Create all matrix objects in the container.
70  * @throw bad_alloc - usually due to out of memory.
71  */
73 {
74  for (auto& it : matrixContainer)
75  {
76  if (it.second.matrixPtr != nullptr)
77  { // the data is already allocated
78  throw std::invalid_argument(TLogger::FormatMessage(ERR_FMT_RELOCATION_ERROR,
79  it.second.matrixName.c_str()));
80  }
81 
82  switch (it.second.matrixType)
83  {
84  case TMatrixRecord::REAL:
85  {
86  it.second.matrixPtr = new TRealMatrix(it.second.dimensionSizes);
87  break;
88  }
89 
90  case TMatrixRecord::COMPLEX:
91  {
92  it.second.matrixPtr = new TComplexMatrix(it.second.dimensionSizes);
93  break;
94  }
95 
96  case TMatrixRecord::INDEX:
97  {
98  it.second.matrixPtr = new TIndexMatrix(it.second.dimensionSizes);
99  break;
100  }
101 
102  case TMatrixRecord::CUFFT:
103  {
104  it.second.matrixPtr = new TCUFFTComplexMatrix(it.second.dimensionSizes);
105  break;
106  }
107 
108  default: // unknown matrix type
109  {
111  it.second.matrixName.c_str()));
112  break;
113  }
114  }// switch
115  }// end for
116 }// end of CreateAllObjects
117 //--------------------------------------------------------------------------------------------------
118 
119 /**
120  * This function creates the list of matrices being used in the simulation. It is done based on the
121  * simulation parameters. All matrices records are created here.
122  */
124 {
125  const TParameters& params = TParameters::GetInstance();
126 
127  TDimensionSizes fullDims = params.GetFullDimensionSizes();
128  TDimensionSizes reducedDims = params.GetReducedDimensionSizes();
129 
130  // this cannot be constexpr because of Visual studio 12.
131  const bool LOAD = true;
132  const bool NOLOAD = false;
133  const bool CHECKPOINT = true;
134  const bool NOCHECKPOINT = false;
135 
136  //----------------------------------------- Allocate all matrices ------------------------------//
137 
138  matrixContainer[kappa] .Set(TMatrixRecord::REAL, reducedDims, NOLOAD, NOCHECKPOINT, kappa_r_NAME);
139 
140  if (!params.Get_c0_scalar_flag())
141  {
142  matrixContainer[c2] .Set(TMatrixRecord::REAL, fullDims, LOAD, NOCHECKPOINT, c0_NAME);
143  }
144 
145  matrixContainer[p] .Set(TMatrixRecord::REAL, fullDims, NOLOAD, CHECKPOINT, p_NAME);
146 
147  matrixContainer[rhox] .Set(TMatrixRecord::REAL, fullDims, NOLOAD, CHECKPOINT, rhox_NAME);
148  matrixContainer[rhoy] .Set(TMatrixRecord::REAL, fullDims, NOLOAD, CHECKPOINT, rhoy_NAME);
149  matrixContainer[rhoz] .Set(TMatrixRecord::REAL, fullDims, NOLOAD, CHECKPOINT, rhoz_NAME);
150 
151  matrixContainer[ux_sgx].Set(TMatrixRecord::REAL, fullDims, NOLOAD, CHECKPOINT, ux_sgx_NAME);
152  matrixContainer[uy_sgy].Set(TMatrixRecord::REAL, fullDims, NOLOAD, CHECKPOINT, uy_sgy_NAME);
153  matrixContainer[uz_sgz].Set(TMatrixRecord::REAL, fullDims, NOLOAD, CHECKPOINT, uz_sgz_NAME);
154 
155  matrixContainer[duxdx] .Set(TMatrixRecord::REAL, fullDims, NOLOAD, NOCHECKPOINT, duxdx_NAME);
156  matrixContainer[duydy] .Set(TMatrixRecord::REAL, fullDims, NOLOAD, NOCHECKPOINT, duydy_NAME);
157  matrixContainer[duzdz] .Set(TMatrixRecord::REAL, fullDims, NOLOAD, NOCHECKPOINT, duzdz_NAME);
158 
159  if (!params.Get_rho0_scalar_flag())
160  {
161  matrixContainer[rho0] .Set(TMatrixRecord::REAL, fullDims, LOAD, NOCHECKPOINT, rho0_NAME);
162  matrixContainer[dt_rho0_sgx].Set(TMatrixRecord::REAL, fullDims, LOAD, NOCHECKPOINT, rho0_sgx_NAME);
163  matrixContainer[dt_rho0_sgy].Set(TMatrixRecord::REAL, fullDims, LOAD, NOCHECKPOINT, rho0_sgy_NAME);
164  matrixContainer[dt_rho0_sgz].Set(TMatrixRecord::REAL, fullDims, LOAD, NOCHECKPOINT, rho0_sgz_NAME);
165  }
166 
167  matrixContainer[ddx_k_shift_pos].Set(TMatrixRecord::COMPLEX, TDimensionSizes(reducedDims.nx, 1, 1), LOAD, NOCHECKPOINT, ddx_k_shift_pos_r_NAME);
168  matrixContainer[ddy_k_shift_pos].Set(TMatrixRecord::COMPLEX, TDimensionSizes(1, reducedDims.ny, 1), LOAD, NOCHECKPOINT, ddy_k_shift_pos_NAME);
169  matrixContainer[ddz_k_shift_pos].Set(TMatrixRecord::COMPLEX, TDimensionSizes(1, 1, reducedDims.nz), LOAD, NOCHECKPOINT, ddz_k_shift_pos_NAME);
170 
171  matrixContainer[ddx_k_shift_neg].Set(TMatrixRecord::COMPLEX, TDimensionSizes(reducedDims.nx ,1, 1), LOAD, NOCHECKPOINT, ddx_k_shift_neg_r_NAME);
172  matrixContainer[ddy_k_shift_neg].Set(TMatrixRecord::COMPLEX, TDimensionSizes(1, reducedDims.ny, 1), LOAD, NOCHECKPOINT, ddy_k_shift_neg_NAME);
173  matrixContainer[ddz_k_shift_neg].Set(TMatrixRecord::COMPLEX, TDimensionSizes(1, 1, reducedDims.nz), LOAD, NOCHECKPOINT, ddz_k_shift_neg_NAME);
174 
175  matrixContainer[pml_x_sgx].Set(TMatrixRecord::REAL, TDimensionSizes(fullDims.nx, 1, 1), LOAD, NOCHECKPOINT, pml_x_sgx_NAME);
176  matrixContainer[pml_y_sgy].Set(TMatrixRecord::REAL, TDimensionSizes(1, fullDims.ny, 1), LOAD, NOCHECKPOINT, pml_y_sgy_NAME);
177  matrixContainer[pml_z_sgz].Set(TMatrixRecord::REAL, TDimensionSizes(1, 1, fullDims.nz), LOAD, NOCHECKPOINT, pml_z_sgz_NAME);
178 
179  matrixContainer[pml_x].Set(TMatrixRecord::REAL, TDimensionSizes(fullDims.nx, 1, 1), LOAD, NOCHECKPOINT, pml_x_NAME);
180  matrixContainer[pml_y].Set(TMatrixRecord::REAL, TDimensionSizes(1, fullDims.ny, 1), LOAD, NOCHECKPOINT, pml_y_NAME);
181  matrixContainer[pml_z].Set(TMatrixRecord::REAL, TDimensionSizes(1, 1, fullDims.nz), LOAD, NOCHECKPOINT, pml_z_NAME);
182 
183  if (params.Get_nonlinear_flag())
184  {
185  if (! params.Get_BonA_scalar_flag())
186  {
187  matrixContainer[BonA].Set(TMatrixRecord::REAL, fullDims, LOAD, NOCHECKPOINT, BonA_NAME);
188  }
189  }
190 
191  if (params.Get_absorbing_flag() != 0)
192  {
193  if (!((params.Get_c0_scalar_flag()) && (params.Get_alpha_coeff_scalar_flag())))
194  {
195  matrixContainer[absorb_tau].Set(TMatrixRecord::REAL, fullDims, NOLOAD, NOCHECKPOINT, absorb_tau_NAME);
196  matrixContainer[absorb_eta].Set(TMatrixRecord::REAL, fullDims, NOLOAD, NOCHECKPOINT, absorb_eta_NAME);
197  }
198 
199  matrixContainer[absorb_nabla1].Set(TMatrixRecord::REAL, reducedDims, NOLOAD, NOCHECKPOINT, absorb_nabla1_r_NAME);
200  matrixContainer[absorb_nabla2].Set(TMatrixRecord::REAL, reducedDims, NOLOAD, NOCHECKPOINT, absorb_nabla2_r_NAME);
201  }
202 
203  // linear sensor mask
204  if (params.Get_sensor_mask_type() == TParameters::INDEX)
205  {
206  matrixContainer[sensor_mask_index].Set(TMatrixRecord::INDEX,
208  LOAD, NOCHECKPOINT, sensor_mask_index_NAME);
209  }
210 
211  // cuboid sensor mask
212  if (params.Get_sensor_mask_type() == TParameters::CORNERS)
213  {
214  matrixContainer[sensor_mask_corners].Set(TMatrixRecord::INDEX,
216  LOAD, NOCHECKPOINT, sensor_mask_corners_NAME);
217  }
218 
219  // if p0 source flag
220  if (params.Get_p0_source_flag() == 1)
221  {
222  matrixContainer[p0_source_input].Set(TMatrixRecord::REAL, fullDims, LOAD, NOCHECKPOINT, p0_source_input_NAME);
223  }
224 
225  // u_source_index
226  if ((params.Get_transducer_source_flag() != 0) ||
227  (params.Get_ux_source_flag() != 0) ||
228  (params.Get_uy_source_flag() != 0) ||
229  (params.Get_uz_source_flag() != 0))
230  {
231  matrixContainer[u_source_index].Set(TMatrixRecord::INDEX,
233  LOAD, NOCHECKPOINT, u_source_index_NAME);
234  }
235 
236  //transducer source flag defined
237  if (params.Get_transducer_source_flag() != 0)
238  {
239  matrixContainer[delay_mask].Set(TMatrixRecord::INDEX,
241  LOAD, NOCHECKPOINT, delay_mask_NAME);
242 
243  matrixContainer[transducer_source_input].Set(TMatrixRecord::REAL,
245  LOAD, NOCHECKPOINT, transducer_source_input_NAME);
246  }
247 
248  // p variables
249  if (params.Get_p_source_flag() != 0)
250  {
251  if (params.Get_p_source_many() == 0)
252  { // 1D case
253  matrixContainer[p_source_input].Set(TMatrixRecord::REAL,
254  TDimensionSizes(1, 1, params.Get_p_source_flag()),
255  LOAD, NOCHECKPOINT, p_source_input_NAME);
256  }
257  else
258  { // 2D case
259  matrixContainer[p_source_input].Set(TMatrixRecord::REAL,
261  LOAD, NOCHECKPOINT, p_source_input_NAME);
262  }
263 
264  matrixContainer[p_source_index].Set(TMatrixRecord::INDEX,
266  LOAD, NOCHECKPOINT, p_source_index_NAME);
267  }
268 
269  //------------------------------------ uxyz source flags ---------------------------------------//
270  if (params.Get_ux_source_flag() != 0)
271  {
272  if (params.Get_u_source_many() == 0)
273  { // 1D
274  matrixContainer[ux_source_input].Set(TMatrixRecord::REAL,
275  TDimensionSizes(1, 1, params.Get_ux_source_flag()),
276  LOAD, NOCHECKPOINT, ux_source_input_NAME);
277  }
278  else
279  { // 2D
280  matrixContainer[ux_source_input].Set(TMatrixRecord::REAL,
282  LOAD, NOCHECKPOINT, ux_source_input_NAME);
283  }
284  }// ux_source_input
285 
286  if (params.Get_uy_source_flag() != 0)
287  {
288  if (params.Get_u_source_many() == 0)
289  { // 1D
290  matrixContainer[uy_source_input].Set(TMatrixRecord::REAL,
291  TDimensionSizes(1, 1, params.Get_uy_source_flag()),
292  LOAD, NOCHECKPOINT, uy_source_input_NAME);
293  }
294  else
295  { // 2D
296  matrixContainer[uy_source_input].Set(TMatrixRecord::REAL,
298  LOAD, NOCHECKPOINT, uy_source_input_NAME);
299  }
300  }// uy_source_input
301 
302  if (params.Get_uz_source_flag() != 0)
303  {
304  if (params.Get_u_source_many() == 0)
305  { // 1D
306  matrixContainer[uz_source_input].Set(TMatrixRecord::REAL,
307  TDimensionSizes(1, 1, params.Get_uz_source_flag()),
308  LOAD, NOCHECKPOINT, uz_source_input_NAME);
309  }
310  else
311  { // 2D
312  matrixContainer[uz_source_input].Set(TMatrixRecord::REAL,
314  LOAD, NOCHECKPOINT, uz_source_input_NAME);
315  }
316  }// uz_source_input
317 
318  //-- Nonlinear grid
319  if (params.Get_nonuniform_grid_flag()!= 0)
320  {
321  matrixContainer[dxudxn].Set(TMatrixRecord::REAL, TDimensionSizes(fullDims.nx, 1, 1), LOAD, NOCHECKPOINT, dxudxn_NAME);
322  matrixContainer[dyudyn].Set(TMatrixRecord::REAL, TDimensionSizes(1, fullDims.ny, 1), LOAD, NOCHECKPOINT, dyudyn_NAME);
323  matrixContainer[dzudzn].Set(TMatrixRecord::REAL, TDimensionSizes(1 ,1, fullDims.nz), LOAD, NOCHECKPOINT, dzudzn_NAME);
324 
325  matrixContainer[dxudxn_sgx].Set(TMatrixRecord::REAL, TDimensionSizes(fullDims.nx, 1, 1), LOAD, NOCHECKPOINT, dxudxn_sgx_NAME);
326  matrixContainer[dyudyn_sgy].Set(TMatrixRecord::REAL, TDimensionSizes(1, fullDims.ny, 1), LOAD, NOCHECKPOINT, dyudyn_sgy_NAME);
327  matrixContainer[dzudzn_sgz].Set(TMatrixRecord::REAL, TDimensionSizes(1 ,1, fullDims.nz), LOAD, NOCHECKPOINT, dzudzn_sgz_NAME);
328  }
329 
330  //-- u_non_staggered_raw
331  if (params.IsStore_u_non_staggered_raw())
332  {
333  TDimensionSizes shiftDims = fullDims;
334 
335  const size_t nx_2 = fullDims.nx / 2 + 1;
336  const size_t ny_2 = fullDims.ny / 2 + 1;
337  const size_t nz_2 = fullDims.nz / 2 + 1;
338 
339  size_t xCutSize = nx_2 * fullDims.ny * fullDims.nz;
340  size_t yCutSize = fullDims.nx * ny_2 * fullDims.nz;
341  size_t zCutSize = fullDims.nx * fullDims.ny * nz_2;
342 
343  if ((xCutSize >= yCutSize) && (xCutSize >= zCutSize))
344  {
345  // X cut is the biggest
346  shiftDims.nx = nx_2;
347  }
348  else if ((yCutSize >= xCutSize) && (yCutSize >= zCutSize))
349  {
350  // Y cut is the biggest
351  shiftDims.ny = ny_2;
352  }
353  else if ((zCutSize >= xCutSize) && (zCutSize >= yCutSize))
354  {
355  // Z cut is the biggest
356  shiftDims.nz = nz_2;
357  }
358  else
359  {
360  //all are the same
361  shiftDims.nx = nx_2;
362  }
363 
364  matrixContainer[cufft_shift_temp].Set(TMatrixRecord::CUFFT, shiftDims, NOLOAD, NOCHECKPOINT, cufft_shift_temp_NAME);
365 
366 
367  // these three are necessary only for u_non_staggered calculation now
368  matrixContainer[ux_shifted].Set(TMatrixRecord::REAL, fullDims, NOLOAD, NOCHECKPOINT, ux_shifted_NAME);
369  matrixContainer[uy_shifted].Set(TMatrixRecord::REAL, fullDims, NOLOAD, NOCHECKPOINT, uy_shifted_NAME);
370  matrixContainer[uz_shifted].Set(TMatrixRecord::REAL, fullDims, NOLOAD, NOCHECKPOINT, uz_shifted_NAME);
371 
372  // shifts from the input file
373  matrixContainer[x_shift_neg_r].Set(TMatrixRecord::COMPLEX, TDimensionSizes(nx_2, 1, 1), LOAD,NOCHECKPOINT, x_shift_neg_r_NAME);
374  matrixContainer[y_shift_neg_r].Set(TMatrixRecord::COMPLEX, TDimensionSizes(1, ny_2, 1), LOAD,NOCHECKPOINT, y_shift_neg_r_NAME);
375  matrixContainer[z_shift_neg_r].Set(TMatrixRecord::COMPLEX, TDimensionSizes(1, 1, nz_2), LOAD,NOCHECKPOINT, z_shift_neg_r_NAME);
376  }// u_non_staggered
377 
378 
379  //------------------------------------- Temporary matrices -------------------------------------//
380  // this matrix used to load alpha_coeff for absorb_tau pre-calculation
381 
382  if ((params.Get_absorbing_flag() != 0) && (!params.Get_alpha_coeff_scalar_flag()))
383  {
384  matrixContainer[temp_1_real_3D].Set(TMatrixRecord::REAL, fullDims, LOAD, NOCHECKPOINT, alpha_coeff_NAME);
385  }
386  else
387  {
388  matrixContainer[temp_1_real_3D].Set(TMatrixRecord::REAL, fullDims, NOLOAD, NOCHECKPOINT, temp_1_real_3D_NAME);
389  }
390 
391  matrixContainer[temp_2_real_3D].Set(TMatrixRecord::REAL, fullDims, NOLOAD, NOCHECKPOINT, temp_2_real_3D_NAME);
392  matrixContainer[temp_3_real_3D].Set(TMatrixRecord::REAL, fullDims, NOLOAD, NOCHECKPOINT, temp_3_real_3D_NAME);
393 
394  matrixContainer[cufft_x_temp].Set(TMatrixRecord::CUFFT, reducedDims, NOLOAD, NOCHECKPOINT, cufft_X_temp_NAME);
395  matrixContainer[cufft_y_temp].Set(TMatrixRecord::CUFFT, reducedDims, NOLOAD, NOCHECKPOINT, cufft_Y_temp_NAME);
396  matrixContainer[cufft_z_temp].Set(TMatrixRecord::CUFFT, reducedDims, NOLOAD, NOCHECKPOINT, cufft_z_temp_NAME);
397 }// end of AddMatricesIntoContainer
398 //--------------------------------------------------------------------------------------------------
399 
400 
401 
402 /**
403  * Load all marked matrices from the input HDF5 file.
404  * @param [in] inputFile - HDF5 input file handle
405  */
407 {
408  for (const auto& it : matrixContainer)
409  {
410  if (it.second.loadData)
411  {
412  it.second.matrixPtr->ReadDataFromHDF5File(inputFile, it.second.matrixName);
413  }
414  }
415 }// end of LoadDataFromInputFile
416 //--------------------------------------------------------------------------------------------------
417 
418 /**
419  * Load selected matrices from the checkpoint HDF5 file.
420  * @param [in] checkpointFile - HDF5 checkpoint file handle
421  */
423 {
424  for (const auto& it : matrixContainer)
425  {
426  if (it.second.checkpoint)
427  {
428  it.second.matrixPtr->ReadDataFromHDF5File(checkpointFile,it.second.matrixName);
429  }
430  }
431 }// end of LoadDataFromCheckpointFile
432 //--------------------------------------------------------------------------------------------------
433 
434 /**
435  * Store selected matrices into the checkpoint file.
436  * @param [in] checkpointFile - Checkpoint file
437  */
439 {
440  for (const auto& it : matrixContainer)
441  {
442  if (it.second.checkpoint)
443  {
444  // Copy data from device first
445  it.second.matrixPtr->CopyFromDevice();
446  // store data to the checkpoint file
447  it.second.matrixPtr->WriteDataToHDF5File(checkpointFile,
448  it.second.matrixName,
450  }
451  }
452 }// end of StoreDataIntoCheckpointFile
453 //--------------------------------------------------------------------------------------------------
454 
455 /**
456  * Free all matrix objects.
457  */
459 {
460  for (auto& it : matrixContainer)
461  {
462  if (it.second.matrixPtr)
463  {
464  delete it.second.matrixPtr;
465  it.second.matrixPtr = nullptr;
466  }
467  }
468 }// end of FreeMatrices
469 //--------------------------------------------------------------------------------------------------
470 
471 /**
472  * Copy all matrices over to the GPU.
473  */
475 {
476  for (const auto& it : matrixContainer)
477  {
478  it.second.matrixPtr->CopyToDevice();
479  }
480 }//end of CopyMatricesToDevice
481 //--------------------------------------------------------------------------------------------------
482 
483 /**
484  * Copy all matrices back over to CPU. Can be used for debugging purposes.
485  */
487 {
488  for (const auto& it : matrixContainer)
489  {
490  it.second.matrixPtr->CopyFromDevice();
491  }
492 }// end of CopyAllMatricesFromGPU
493 //--------------------------------------------------------------------------------------------------
494 
495 //------------------------------------------------------------------------------------------------//
496 //-------------------------------------- Protected methods ---------------------------------------//
497 //------------------------------------------------------------------------------------------------//
498 
499 //------------------------------------------------------------------------------------------------//
500 //--------------------------------------- Private methods ----------------------------------------//
501 //------------------------------------------------------------------------------------------------//
TMatrixName y_shift_neg_r_NAME
y_shift_neg_r variable name
Definition: MatrixNames.h:80
size_t nx
number of elements in the x direction
TMatrixName pml_y_sgy_NAME
pml_y_sgy variable name
Definition: MatrixNames.h:101
TDimensionSizes GetReducedDimensionSizes() const
Reduced dimension sizes of the simulation (complex classes).
Definition: Parameters.h:97
TMatrixName rhox_NAME
rhox variable name
Definition: MatrixNames.h:188
size_t Get_sensor_mask_index_size() const
Get sensor_mask_index_size value.
Definition: Parameters.h:168
void AddMatrices()
Populate the container based on the simulation type.
void FreeMatrices()
Destroy and free all matrices.
size_t Get_u_source_index_size() const
Get u_source_index_size value.
Definition: Parameters.h:173
TMatrixName uy_sgy_NAME
uy_sgy variable name
Definition: MatrixNames.h:204
TMatrixName uy_source_input_NAME
uy_source_input variable name
Definition: MatrixNames.h:152
TMatrixName uz_shifted_NAME
uz_shifted variable name
Definition: MatrixNames.h:89
void LoadDataFromCheckpointFile(THDF5_File &checkpointFile)
Load all matrices from the output HDF5 file.
TMatrixName temp_1_real_3D_NAME
Temp_1_RS3D variable name.
Definition: MatrixNames.h:323
TMatrixName absorb_tau_NAME
absorb_tau variable name
Definition: MatrixNames.h:260
TMatrixRecordContainer matrixContainer
map holding the container
TMatrixName pml_y_NAME
pml_y variable name
Definition: MatrixNames.h:108
TMatrixName temp_3_real_3D_NAME
Temp_3_RS3D variable name.
Definition: MatrixNames.h:327
TMatrixName p_source_index_NAME
p_source_index variable name
Definition: MatrixNames.h:145
TMatrixName rhoy_NAME
rhoy variable name
Definition: MatrixNames.h:190
TMatrixName ddz_k_shift_neg_NAME
ddz_k_shift_neg variable name
Definition: MatrixNames.h:248
TMatrixName sensor_mask_index_NAME
sensor_mask_index variable name
Definition: MatrixNames.h:166
TMatrixName transducer_source_input_NAME
transducer_source_input variable name
Definition: MatrixNames.h:173
size_t Get_ux_source_flag() const
Get ux_source_flag value.
Definition: Parameters.h:137
TMatrixName rho0_sgz_NAME
rho0_sgz variable name
Definition: MatrixNames.h:257
TMatrixName BonA_NAME
BonA variable name.
Definition: MatrixNames.h:184
TMatrixName ddy_k_shift_neg_NAME
ddy_k_shift_neg variable name
Definition: MatrixNames.h:246
static TParameters & GetInstance()
Get instance of the singleton class.
Definition: Parameters.cpp:70
TMatrixName ddy_k_shift_pos_NAME
ddy_k_shift_pos variable name
Definition: MatrixNames.h:239
~TMatrixContainer()
Destructor.
size_t Get_sensor_mask_corners_size() const
Get number of cubes in the mask.
Definition: Parameters.h:170
void LoadDataFromInputFile(THDF5_File &inputFile)
Load all matrices from the input HDF5 file.
TMatrixName duydy_NAME
duydy variable name
Definition: MatrixNames.h:218
TMatrixName uy_shifted_NAME
uy_shifted variable name
Definition: MatrixNames.h:87
TMatrixName absorb_eta_NAME
absorb_eta variable name
Definition: MatrixNames.h:262
TMatrixName u_source_index_NAME
u_source_index variable name
Definition: MatrixNames.h:148
bool Get_c0_scalar_flag() const
Get c0_scalar_flag value.
Definition: Parameters.h:185
size_t Get_u_source_many() const
Get u_source_many value.
Definition: Parameters.h:143
The header file containing the parameters of the simulation.
bool Get_BonA_scalar_flag() const
Get BonA_scalar_flag value.
Definition: Parameters.h:195
TMatrixName uz_source_input_NAME
uz_source_input variable name
Definition: MatrixNames.h:154
TMatrixName dxudxn_sgx_NAME
dxudxn_sgx variable name
Definition: MatrixNames.h:230
TMatrixName p_source_input_NAME
p_source_input variable name
Definition: MatrixNames.h:143
TMatrixName pml_z_NAME
pml_z variable name
Definition: MatrixNames.h:110
TMatrixName sensor_mask_corners_NAME
sensor_mask_corners variable name
Definition: MatrixNames.h:170
TMatrixName dzudzn_sgz_NAME
dzudzn_sgz variable name
Definition: MatrixNames.h:234
bool Get_alpha_coeff_scalar_flag() const
Get alpha_coeff_scalar_flag value.
Definition: Parameters.h:180
TMatrixName dxudxn_NAME
dxudxn variable name
Definition: MatrixNames.h:223
void CreateMatrices()
Create all matrices in the container.
TDimensionSizes GetFullDimensionSizes() const
Full dimension sizes of the simulation (real classes).
Definition: Parameters.h:95
The header file containing a class responsible for printing out info and error messages (stdout...
TMatrixName dyudyn_sgy_NAME
dyudyn_sgy variable name
Definition: MatrixNames.h:232
TMatrixName ux_source_input_NAME
ux_source_input variable name
Definition: MatrixNames.h:150
TMatrixName dyudyn_NAME
dyudyn variable name
Definition: MatrixNames.h:225
bool IsStore_u_non_staggered_raw() const
Is –u_non_staggered_raw set?
Definition: Parameters.h:252
TMatrixName c0_NAME
c0 variable name
Definition: MatrixNames.h:63
TMatrixName rho0_sgx_NAME
rho0_sgx variable name
Definition: MatrixNames.h:253
Class storing all parameters of the simulation.
Definition: Parameters.h:49
TMatrixName cufft_Y_temp_NAME
CUFFT_Y_temp variable name.
Definition: MatrixNames.h:335
size_t Get_uy_source_flag() const
Get uy_source_flag value.
Definition: Parameters.h:139
TMatrixName ddx_k_shift_neg_r_NAME
ddx_k_shift_neg_r variable name
Definition: MatrixNames.h:244
TMatrixName temp_2_real_3D_NAME
Temp_2_RS3D variable name.
Definition: MatrixNames.h:325
The header file containing routines for error messages and error messages common for both linux and w...
size_t Get_p_source_many() const
Get p_source_many value.
Definition: Parameters.h:152
size_t Get_p0_source_flag() const
Get p0_source_flag value.
Definition: Parameters.h:150
TMatrixName duxdx_NAME
duxdx variable name
Definition: MatrixNames.h:216
size_t ny
number of elements in the y direction
TMatrixName pml_x_NAME
pml_x variable name
Definition: MatrixNames.h:106
TMatrixName ddx_k_shift_pos_r_NAME
ddx_k_shift_pos_r variable name
Definition: MatrixNames.h:237
TMatrixName cufft_shift_temp_NAME
CUFFT_shift_temp variable name.
Definition: MatrixNames.h:331
TMatrixContainer()
Constructor.
size_t Get_nonlinear_flag() const
Get nonlinear_flag value.
Definition: Parameters.h:161
TErrorMessage ERR_FMT_RELOCATION_ERROR
Matrix container error message.
The class for real matrices.
Definition: RealMatrix.h:45
size_t Get_uz_source_flag() const
Get uz_source_flag value.
Definition: Parameters.h:141
TMatrixName alpha_coeff_NAME
alpha_coeff variable name
Definition: MatrixNames.h:68
TMatrixName pml_z_sgz_NAME
pml_z_sgz variable name
Definition: MatrixNames.h:103
The class for 64b unsigned integers (indices). It is used for sensor_mask_index or sensor_corners_mas...
Definition: IndexMatrix.h:46
TMatrixName uz_sgz_NAME
uz_sgz variable name
Definition: MatrixNames.h:206
TMatrixName absorb_nabla1_r_NAME
absorb_nabla1_r variable name
Definition: MatrixNames.h:264
TMatrixName delay_mask_NAME
delay_mask variable name
Definition: MatrixNames.h:178
size_t Get_transducer_source_input_size() const
Get transducer_source_input_size value.
Definition: Parameters.h:177
void CopyMatricesFromDevice()
Copy all matrices from device to host (GPU -> CPU).
size_t Get_p_source_flag() const
Get p_source_flag value.
Definition: Parameters.h:148
size_t Get_transducer_source_flag() const
Get transducer_source_flag value.
Definition: Parameters.h:163
TMatrixName ux_sgx_NAME
ux_sgx variable name
Definition: MatrixNames.h:202
TMatrixName dzudzn_NAME
dzudzn variable name
Definition: MatrixNames.h:227
TMatrixName p0_source_input_NAME
p0_source_input variable name
Definition: MatrixNames.h:176
TMatrixName x_shift_neg_r_NAME
x_shift_neg_r variable name
Definition: MatrixNames.h:78
size_t GetCompressionLevel() const
Get compression level.
Definition: Parameters.h:218
TErrorMessage ERR_FMT_BAD_MATRIX_DISTRIBUTION_TYPE
Matrix container error message.
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:126
The header file containing the matrix container and the related matrix record class.
void CopyMatricesToDevice()
Copy all matrices from host to device (CPU -> GPU).
TMatrixName ux_shifted_NAME
ux_shifted variable name
Definition: MatrixNames.h:85
TMatrixName absorb_nabla2_r_NAME
absorb_nabla2_r variable name
Definition: MatrixNames.h:266
TMatrixName cufft_z_temp_NAME
CUFFT_Z_temp variable name.
Definition: MatrixNames.h:337
size_t Get_p_source_index_size() const
Get p_source_index_size value.
Definition: Parameters.h:175
TMatrixName rhoz_NAME
rhoz variable name
Definition: MatrixNames.h:192
bool Get_rho0_scalar_flag() const
Get rho0_scalar_flag value.
Definition: Parameters.h:200
size_t Get_absorbing_flag() const
Get absorbing_flag value.
Definition: Parameters.h:159
void StoreDataIntoCheckpointFile(THDF5_File &checkpointFile)
Store selected matrices into the checkpoint file.
TMatrixName z_shift_neg_r_NAME
z_shift_neg_r variable name
Definition: MatrixNames.h:82
size_t Get_nonuniform_grid_flag() const
Get nonuniform_grid_flag value.
Definition: Parameters.h:157
size_t nz
number of elements in the z direction
TMatrixName kappa_r_NAME
kappa_r variable name
Definition: MatrixNames.h:182
The class for complex matrices.
Definition: ComplexMatrix.h:54
TMatrixName pml_x_sgx_NAME
pml_x_sgx variable name
Definition: MatrixNames.h:99
TMatrixName rho0_sgy_NAME
rho0_sgy variable name
Definition: MatrixNames.h:255
TMatrixName cufft_X_temp_NAME
CUFFT_X_temp variable name.
Definition: MatrixNames.h:333
Class implementing 3D Real-To-Complex and Complex-To-Real transforms using CUDA FFT interface...
TSensorMaskType Get_sensor_mask_type() const
Get sensor mask type (linear or corners).
Definition: Parameters.h:166
TMatrixName ddz_k_shift_pos_NAME
ddz_k_shift_pos variable name
Definition: MatrixNames.h:241
TMatrixName rho0_NAME
rho0 variable name
Definition: MatrixNames.h:251
Class wrapping the HDF5 routines.
Definition: HDF5_File.h:500
TMatrixName p_NAME
p variable name
Definition: MatrixNames.h:186
Structure with 4D dimension sizes (3 in space and 1 in time).
TMatrixName duzdz_NAME
duzdz variable name
Definition: MatrixNames.h:220