kspaceFirstOrder3D-OMP  1.1
The C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
 All Classes Files Functions Variables Typedefs Enumerations Friends Pages
MatrixContainer.cpp
Go to the documentation of this file.
1 /**
2  * @file MatrixContainer.cpp
3  * @author Jiri Jaros \n
4  * Faculty of Information Technology\n
5  * Brno University of Technology \n
6  * jarosjir@fit.vutbr.cz
7  *
8  * @brief The implementation file containing the matrix container.
9  *
10  * @version kspaceFirstOrder3D 2.15
11  * @date 12 July 2012, 10:27 (created) \n
12  * 26 September 2014, 17:09 (revised)
13  *
14  * @section License
15  * This file is part of the C++ extension of the k-Wave Toolbox (http://www.k-wave.org).\n
16  * Copyright (C) 2014 Jiri Jaros and Bradley Treeby
17  *
18  * This file is part of k-Wave. k-Wave is free software: you can redistribute it
19  * and/or modify it under the terms of the GNU Lesser General Public License as
20  * published by the Free Software Foundation, either version 3 of the License,
21  * or (at your option) any later version.
22  *
23  * k-Wave is distributed in the hope that it will be useful, but
24  * WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
26  * See the GNU Lesser General Public License for more details.
27  *
28  * You should have received a copy of the GNU Lesser General Public License
29  * along with k-Wave. If not, see <http://www.gnu.org/licenses/>.
30  */
31 
32 #include <stdexcept>
33 
36 
37 #include <Parameters/Parameters.h>
38 #include <Utils/ErrorMessages.h>
39 
40 //----------------------------------------------------------------------------//
41 //----------------------------- CONSTANTS ------------------------------------//
42 //----------------------------------------------------------------------------//
43 
44 
45 
46 
47 //============================================================================//
48 // TMatrixRecord //
49 //============================================================================//
50 
51 //----------------------------------------------------------------------------//
52 //--------------------------- Public methods ---------------------------------//
53 //----------------------------------------------------------------------------//
54 
55 
56 /**
57  * Copy constructor of TMatrixRecord.
58  * @param [in] src
59  */
61  MatrixPtr(src.MatrixPtr),
62  MatrixDataType(src.MatrixDataType),
63  DimensionSizes(src.DimensionSizes),
64  LoadData(src.LoadData),
65  Checkpoint(src.Checkpoint),
66  HDF5MatrixName(src.HDF5MatrixName)
67 {
68 
69 }// end of TMatrixRecord
70 //------------------------------------------------------------------------------
71 
72 
73 /**
74  * operator = of TMatrixRecord
75  * @param [in] src
76  * @return this
77  */
79 {
80  if (this != &src)
81  {
82  MatrixPtr = src.MatrixPtr;
85  LoadData = src.LoadData;
86  Checkpoint = src.Checkpoint;
88  }
89 
90  return *this;
91 }// end of operator =
92 //------------------------------------------------------------------------------
93 
94 
95 
96 /**
97  * Set all values for the record
98  * @param [in] MatrixPtr - Pointer to the MatrixClass object
99  * @param [in] MatrixDataType - Matrix data type
100  * @param [in] DimensionSizes - Dimension sizes
101  * @param [in] LoadData - Load data from file?
102  * @param [in] Checkpoint - Checkpoint this matrix?
103  * @param [in] HDF5MatrixName - HDF5 matrix name
104  */
106  const TMatrixDataType MatrixDataType,
107  const TDimensionSizes DimensionSizes,
108  const bool LoadData,
109  const bool Checkpoint,
110  const string HDF5MatrixName)
111 {
112  this->MatrixPtr = MatrixPtr;
113  this->MatrixDataType = MatrixDataType;
114  this->DimensionSizes = DimensionSizes;
115  this->LoadData = LoadData;
116  this->Checkpoint = Checkpoint;
117  this->HDF5MatrixName = HDF5MatrixName;
118 }// end of SetAllValues
119 //------------------------------------------------------------------------------
120 
121 
122 //----------------------------------------------------------------------------//
123 //------------------------- Protected methods --------------------------------//
124 //----------------------------------------------------------------------------//
125 
126 //----------------------------------------------------------------------------//
127 //-------------------------- Private methods ---------------------------------//
128 //----------------------------------------------------------------------------//
129 
130 
131 
132 //============================================================================//
133 // TMatrixContainer //
134 //============================================================================//
135 
136 //----------------------------------------------------------------------------//
137 //--------------------------- Public methods ---------------------------------//
138 //----------------------------------------------------------------------------//
139 
140 
141 /**
142  * Destructor of TMatrixContainer.
143  */
145 {
146  MatrixContainer.clear();
147 }// end of ~TMatrixContainer
148 //------------------------------------------------------------------------------
149 
150 
151 /**
152  * Create all matrix objects in the container.
153  * @throw errors cause an exception bad_alloc.
154  */
156 {
157  for (TMatrixRecordContainer::iterator it = MatrixContainer.begin(); it != MatrixContainer.end(); it++)
158  {
159  if (it->second.MatrixPtr != NULL)
160  {
162  it->second.HDF5MatrixName,
163  __FILE__,__LINE__);
164  }
165 
166  switch (it->second.MatrixDataType)
167  {
168  case TMatrixRecord::mdtReal:
169  {
170  it->second.MatrixPtr = new TRealMatrix(it->second.DimensionSizes);
171  break;
172  }
173 
174  case TMatrixRecord::mdtComplex:
175  {
176  it->second.MatrixPtr = new TComplexMatrix(it->second.DimensionSizes);
177  break;
178  }
179 
180  case TMatrixRecord::mdtIndex:
181  {
182  it->second.MatrixPtr = new TIndexMatrix(it->second.DimensionSizes);
183  break;
184  }
185 
186  case TMatrixRecord::mdtFFTW:
187  {
188  it->second.MatrixPtr = new TFFTWComplexMatrix(it->second.DimensionSizes);
189  break;
190  }
191 
192  case TMatrixRecord::mdtUxyz:
193  {
194  it->second.MatrixPtr = new Tuxyz_sgxyzMatrix(it->second.DimensionSizes);
195  break;
196  }
197 
198  default:
199  {
201  it->second.HDF5MatrixName,
202  __FILE__,__LINE__);
203  break;
204  }
205  }// switch
206  }// end for
207 }// end of CreateAllObjects
208 //-----------------------------------------------------------------------------
209 
210 
211 /**
212  * Load all marked matrices from the HDF5 file.
213  * @param [in] HDF5_File - HDF5 file handle
214  */
216 {
217  for (TMatrixRecordContainer::iterator it = MatrixContainer.begin(); it != MatrixContainer.end(); it++)
218  {
219  if (it->second.LoadData)
220  {
221  it->second.MatrixPtr->ReadDataFromHDF5File(HDF5_File, it->second.HDF5MatrixName.c_str());
222  }
223  }
224 }// end of LoadMatricesDataFromDisk
225 //------------------------------------------------------------------------------
226 
227 
228 /**
229  * Load selected matrices from checkpoint HDF5 file.
230  * @param [in] HDF5_File - HDF5 file handle
231  */
233 {
234  for (TMatrixRecordContainer::iterator it = MatrixContainer.begin(); it != MatrixContainer.end(); it++)
235  {
236  if (it->second.Checkpoint)
237  {
238  it->second.MatrixPtr->ReadDataFromHDF5File(HDF5_File, it->second.HDF5MatrixName.c_str());
239  }
240  }
241 }// end of LoadDataFromCheckpointHDF5File
242 //------------------------------------------------------------------------------
243 
244 /**
245  * Store selected matrices into the checkpoint file.
246  * @param [in] HDF5_File
247  */
249 {
250  for (TMatrixRecordContainer::iterator it = MatrixContainer.begin(); it != MatrixContainer.end(); it++)
251  {
252  if (it->second.Checkpoint)
253  {
254  it->second.MatrixPtr->WriteDataToHDF5File(HDF5_File,
255  it->second.HDF5MatrixName.c_str(),
257  }
258  }
259 }// end of StoreDataIntoCheckpointHDF5File
260 //------------------------------------------------------------------------------
261 
262 
263 /**
264  * Free all matrix objects.
265  *
266  */
268 {
269  for (TMatrixRecordContainer::iterator it = MatrixContainer.begin(); it != MatrixContainer.end(); it++)
270  {
271  if (it->second.MatrixPtr)
272  {
273  delete it->second.MatrixPtr;
274  it->second.MatrixPtr = NULL;
275  }
276  }
277 }// end of FreeAllMatrices
278 //------------------------------------------------------------------------------
279 
280 
281 
282 
283 /**
284  * This function defines common matrices in K-Wave.
285  * All matrices records are created here.
286  */
288 {
289 
291 
292  TDimensionSizes FullDims = Params->GetFullDimensionSizes();
293  TDimensionSizes ReducedDims = Params->GetReducedDimensionSizes();
294 
295  const bool LOAD = true;
296  const bool NOLOAD = false;
297  const bool CHECKPOINT = true;
298  const bool NOCHECKPOINT = false;
299 
300 
301  //----------------------Allocate all matrices ----------------------------//
302 
303  MatrixContainer[kappa] .SetAllValues(NULL ,TMatrixRecord::mdtReal, ReducedDims, NOLOAD, NOCHECKPOINT, kappa_r_Name);
304  if (!Params->Get_c0_scalar_flag())
305  {
306  MatrixContainer[c2] .SetAllValues(NULL ,TMatrixRecord::mdtReal, FullDims , LOAD, NOCHECKPOINT, c0_Name);
307  }
308  MatrixContainer[p] .SetAllValues(NULL ,TMatrixRecord::mdtReal, FullDims , NOLOAD, CHECKPOINT, p_Name);
309 
310  MatrixContainer[rhox] .SetAllValues(NULL ,TMatrixRecord::mdtReal, FullDims , NOLOAD, CHECKPOINT, rhox_Name);
311  MatrixContainer[rhoy] .SetAllValues(NULL ,TMatrixRecord::mdtReal, FullDims , NOLOAD, CHECKPOINT, rhoy_Name);
312  MatrixContainer[rhoz] .SetAllValues(NULL ,TMatrixRecord::mdtReal, FullDims , NOLOAD, CHECKPOINT, rhoz_Name);
313 
314  MatrixContainer[ux_sgx].SetAllValues(NULL ,TMatrixRecord::mdtReal, FullDims , NOLOAD, CHECKPOINT, ux_sgx_Name);
315  MatrixContainer[uy_sgy].SetAllValues(NULL ,TMatrixRecord::mdtReal, FullDims , NOLOAD, CHECKPOINT, uy_sgy_Name);
316  MatrixContainer[uz_sgz].SetAllValues(NULL ,TMatrixRecord::mdtReal, FullDims , NOLOAD, CHECKPOINT, uz_sgz_Name);
317 
318  MatrixContainer[duxdx] .SetAllValues(NULL ,TMatrixRecord::mdtReal, FullDims , NOLOAD, NOCHECKPOINT, duxdx_Name);
319  MatrixContainer[duydy] .SetAllValues(NULL ,TMatrixRecord::mdtReal, FullDims , NOLOAD, NOCHECKPOINT, duydy_Name);
320  MatrixContainer[duzdz] .SetAllValues(NULL ,TMatrixRecord::mdtReal, FullDims , NOLOAD, NOCHECKPOINT, duzdz_Name);
321 
322  if (!Params->Get_rho0_scalar_flag())
323  {
324  MatrixContainer[rho0] .SetAllValues(NULL,TMatrixRecord::mdtReal, FullDims, LOAD, NOCHECKPOINT, rho0_Name);
325  MatrixContainer[dt_rho0_sgx].SetAllValues(NULL,TMatrixRecord::mdtReal, FullDims, LOAD, NOCHECKPOINT, rho0_sgx_Name);
326  MatrixContainer[dt_rho0_sgy].SetAllValues(NULL,TMatrixRecord::mdtReal, FullDims, LOAD, NOCHECKPOINT, rho0_sgy_Name);
327  MatrixContainer[dt_rho0_sgz].SetAllValues(NULL,TMatrixRecord::mdtReal, FullDims, LOAD, NOCHECKPOINT, rho0_sgz_Name);
328  }
329 
330 
331  MatrixContainer[ddx_k_shift_pos].SetAllValues(NULL,TMatrixRecord::mdtComplex, TDimensionSizes(ReducedDims.X, 1, 1), LOAD, NOCHECKPOINT, ddx_k_shift_pos_r_Name);
332  MatrixContainer[ddy_k_shift_pos].SetAllValues(NULL,TMatrixRecord::mdtComplex, TDimensionSizes(1, ReducedDims.Y, 1), LOAD, NOCHECKPOINT, ddy_k_shift_pos_Name);
333  MatrixContainer[ddz_k_shift_pos].SetAllValues(NULL,TMatrixRecord::mdtComplex, TDimensionSizes(1, 1, ReducedDims.Z), LOAD, NOCHECKPOINT, ddz_k_shift_pos_Name);
334 
335  MatrixContainer[ddx_k_shift_neg].SetAllValues(NULL,TMatrixRecord::mdtComplex, TDimensionSizes(ReducedDims.X ,1, 1), LOAD, NOCHECKPOINT, ddx_k_shift_neg_r_Name);
336  MatrixContainer[ddy_k_shift_neg].SetAllValues(NULL,TMatrixRecord::mdtComplex, TDimensionSizes(1, ReducedDims.Y, 1), LOAD, NOCHECKPOINT, ddy_k_shift_neg_Name);
337  MatrixContainer[ddz_k_shift_neg].SetAllValues(NULL,TMatrixRecord::mdtComplex, TDimensionSizes(1, 1, ReducedDims.Z), LOAD, NOCHECKPOINT, ddz_k_shift_neg_Name);
338 
339 
340  MatrixContainer[pml_x_sgx] .SetAllValues(NULL,TMatrixRecord::mdtReal, TDimensionSizes(FullDims.X, 1, 1), LOAD, NOCHECKPOINT, pml_x_sgx_Name);
341  MatrixContainer[pml_y_sgy] .SetAllValues(NULL,TMatrixRecord::mdtReal, TDimensionSizes(1, FullDims.Y, 1), LOAD, NOCHECKPOINT, pml_y_sgy_Name);
342  MatrixContainer[pml_z_sgz] .SetAllValues(NULL,TMatrixRecord::mdtReal, TDimensionSizes(1, 1, FullDims.Z), LOAD, NOCHECKPOINT, pml_z_sgz_Name);
343 
344  MatrixContainer[pml_x] .SetAllValues(NULL,TMatrixRecord::mdtReal, TDimensionSizes(FullDims.X, 1, 1), LOAD, NOCHECKPOINT, pml_x_Name);
345  MatrixContainer[pml_y] .SetAllValues(NULL,TMatrixRecord::mdtReal, TDimensionSizes(1, FullDims.Y, 1), LOAD, NOCHECKPOINT, pml_y_Name);
346  MatrixContainer[pml_z] .SetAllValues(NULL,TMatrixRecord::mdtReal, TDimensionSizes(1, 1, FullDims.Z), LOAD, NOCHECKPOINT, pml_z_Name);
347 
348  if (Params->Get_nonlinear_flag())
349  {
350  if (! Params->Get_BonA_scalar_flag())
351  {
352  MatrixContainer[BonA] .SetAllValues (NULL,TMatrixRecord::mdtReal, FullDims , LOAD, NOCHECKPOINT, BonA_Name);
353  }
354  }
355 
356  if (Params->Get_absorbing_flag() != 0)
357  {
358  if (!((Params->Get_c0_scalar_flag()) && (Params->Get_alpha_coeff_scallar_flag())))
359  {
360  MatrixContainer[absorb_tau].SetAllValues (NULL,TMatrixRecord::mdtReal, FullDims , NOLOAD, NOCHECKPOINT, absorb_tau_Name);
361  MatrixContainer[absorb_eta].SetAllValues (NULL,TMatrixRecord::mdtReal, FullDims , NOLOAD, NOCHECKPOINT, absorb_eta_Name);
362  }
363  MatrixContainer[absorb_nabla1].SetAllValues(NULL,TMatrixRecord::mdtReal, ReducedDims, NOLOAD, NOCHECKPOINT, absorb_nabla1_r_Name);
364  MatrixContainer[absorb_nabla2].SetAllValues(NULL,TMatrixRecord::mdtReal, ReducedDims, NOLOAD, NOCHECKPOINT, absorb_nabla2_r_Name);
365  }
366 
367  // linear sensor mask
368  if (Params->Get_sensor_mask_type() == TParameters::smt_index)
369  {
370  MatrixContainer[sensor_mask_index].SetAllValues(NULL,TMatrixRecord::mdtIndex,
372  LOAD, NOCHECKPOINT, sensor_mask_index_Name);
373  }
374 
375  // cuboid sensor mask
376  if (Params->Get_sensor_mask_type() == TParameters::smt_corners)
377  {
378  MatrixContainer[sensor_mask_corners].SetAllValues(NULL,TMatrixRecord::mdtIndex,
380  LOAD, NOCHECKPOINT, sensor_mask_corners_Name);
381  }
382 
383 
384  // if p0 source flag
385  if (Params->Get_p0_source_flag() == 1)
386  {
387  MatrixContainer[p0_source_input].SetAllValues(NULL,TMatrixRecord::mdtReal, FullDims, LOAD, NOCHECKPOINT, p0_source_input_Name);
388  }
389 
390 
391  // us_index
392  if ((Params->Get_transducer_source_flag() != 0) ||
393  (Params->Get_ux_source_flag() != 0) ||
394  (Params->Get_uy_source_flag() != 0) ||
395  (Params->Get_uz_source_flag() != 0))
396  {
397  MatrixContainer[u_source_index].SetAllValues(NULL,TMatrixRecord::mdtIndex,
398  TDimensionSizes(1 ,1, Params->Get_u_source_index_size()),
399  LOAD, NOCHECKPOINT, u_source_index_Name);
400  }
401 
402  //transducer source flag defined
403  if (Params->Get_transducer_source_flag() != 0)
404  {
405  MatrixContainer[delay_mask] .SetAllValues(NULL,TMatrixRecord::mdtIndex,TDimensionSizes(1 ,1, Params->Get_u_source_index_size()) ,
406  LOAD, NOCHECKPOINT, delay_mask_Name);
407  MatrixContainer[transducer_source_input].SetAllValues(NULL,TMatrixRecord::mdtReal ,TDimensionSizes(1 ,1, Params->Get_transducer_source_input_size()),
408  LOAD, NOCHECKPOINT, transducer_source_input_Name);
409  }
410 
411  // p variables
412  if (Params->Get_p_source_flag() != 0)
413  {
414  if (Params->Get_p_source_many() == 0)
415  { // 1D case
416  MatrixContainer[p_source_input].SetAllValues(NULL,TMatrixRecord::mdtReal,
417  TDimensionSizes(1 ,1, Params->Get_p_source_flag()),
418  LOAD, NOCHECKPOINT, p_source_input_Name);
419  }
420  else
421  { // 2D case
422  MatrixContainer[p_source_input].SetAllValues(NULL,TMatrixRecord::mdtReal,
424  LOAD, NOCHECKPOINT, p_source_input_Name);
425  }
426 
427  MatrixContainer[p_source_index].SetAllValues(NULL,TMatrixRecord::mdtIndex,
428  TDimensionSizes(1 ,1, Params->Get_p_source_index_size()),
429  LOAD, NOCHECKPOINT, p_source_index_Name);
430  }
431 
432 
433 
434  //----------------------------uxyz source flags---------------------------//
435  if (Params->Get_ux_source_flag() != 0)
436  {
437  if (Params->Get_u_source_many() == 0)
438  { // 1D
439  MatrixContainer[ux_source_input].SetAllValues(NULL,TMatrixRecord::mdtReal,
440  TDimensionSizes(1 ,1, Params->Get_ux_source_flag()),
441  LOAD, NOCHECKPOINT, ux_source_input_Name);
442  }
443  else
444  { // 2D
445  MatrixContainer[ux_source_input].SetAllValues(NULL,TMatrixRecord::mdtReal,
447  LOAD, NOCHECKPOINT, ux_source_input_Name);
448  }
449  }// ux_source_input
450 
451 
452  if (Params->Get_uy_source_flag() != 0)
453  {
454  if (Params->Get_u_source_many() == 0)
455  { // 1D
456  MatrixContainer[uy_source_input].SetAllValues(NULL,TMatrixRecord::mdtReal,
457  TDimensionSizes(1 ,1, Params->Get_uy_source_flag()),
458  LOAD, NOCHECKPOINT, uy_source_input_Name);
459  }
460  else
461  { // 2D
462  MatrixContainer[uy_source_input].SetAllValues(NULL,TMatrixRecord::mdtReal,
464  LOAD, NOCHECKPOINT, uy_source_input_Name);
465  }
466  }// uy_source_input
467 
468  if (Params->Get_uz_source_flag() != 0)
469  {
470  if (Params->Get_u_source_many() == 0)
471  { // 1D
472  MatrixContainer[uz_source_input].SetAllValues(NULL,TMatrixRecord::mdtReal,
473  TDimensionSizes(1 ,1, Params->Get_uz_source_flag()),
474  LOAD, NOCHECKPOINT, uz_source_input_Name);
475  }
476  else
477  { // 2D
478  MatrixContainer[uz_source_input].SetAllValues(NULL,TMatrixRecord::mdtReal,
480  LOAD, NOCHECKPOINT, uz_source_input_Name);
481  }
482  }// uz_source_input
483 
484 
485  //-- Nonlinear grid
486  if (Params->Get_nonuniform_grid_flag()!= 0)
487  {
488  MatrixContainer[dxudxn] .SetAllValues(NULL,TMatrixRecord::mdtReal, TDimensionSizes(FullDims.X, 1, 1), LOAD, NOCHECKPOINT, dxudxn_Name);
489  MatrixContainer[dyudyn] .SetAllValues(NULL,TMatrixRecord::mdtReal, TDimensionSizes(1, FullDims.Y, 1), LOAD, NOCHECKPOINT, dyudyn_Name);
490  MatrixContainer[dzudzn] .SetAllValues(NULL,TMatrixRecord::mdtReal, TDimensionSizes(1 ,1, FullDims.Z), LOAD, NOCHECKPOINT, dzudzn_Name);
491 
492  MatrixContainer[dxudxn_sgx].SetAllValues(NULL,TMatrixRecord::mdtReal, TDimensionSizes(FullDims.X, 1, 1), LOAD, NOCHECKPOINT, dxudxn_sgx_Name);
493  MatrixContainer[dyudyn_sgy].SetAllValues(NULL,TMatrixRecord::mdtReal, TDimensionSizes(1, FullDims.Y, 1), LOAD, NOCHECKPOINT, dyudyn_sgy_Name);
494  MatrixContainer[dzudzn_sgz].SetAllValues(NULL,TMatrixRecord::mdtReal, TDimensionSizes(1 ,1, FullDims.Z), LOAD, NOCHECKPOINT, dzudzn_sgz_Name);
495  }
496 
497  //-- u_non_staggered_raw
498  if (Params->IsStore_u_non_staggered_raw())
499  {
500  TDimensionSizes ShiftDims = FullDims;
501 
502  size_t X_2 = FullDims.X / 2 + 1;
503  size_t Y_2 = FullDims.Y / 2 + 1;
504  size_t Z_2 = FullDims.Z / 2 + 1;
505 
506  size_t XCutSize = X_2 * FullDims.Y * FullDims.Z;
507  size_t YCutSize = FullDims.X * Y_2 * FullDims.Z;
508  size_t ZCutSize = FullDims.X * FullDims.Y * Z_2;
509 
510  if ((XCutSize >= YCutSize) && (XCutSize >= ZCutSize))
511  { // X cut is the biggest
512  ShiftDims.X = X_2;
513  }
514  else if ((YCutSize >= XCutSize) && (YCutSize >= ZCutSize))
515  { // Y cut is the biggest
516  ShiftDims.Y = Y_2;
517  }
518  else if ((ZCutSize >= XCutSize) && (ZCutSize >= YCutSize))
519  { // Z cut is the biggest
520  ShiftDims.Z = Z_2;
521  }
522  else
523  { //all are the same
524  ShiftDims.X = X_2;
525  }
526 
527  MatrixContainer[FFT_shift_temp].SetAllValues(NULL, TMatrixRecord::mdtFFTW, ShiftDims, NOLOAD, NOCHECKPOINT, "");
528 
529  // these three are necessary only for u_non_staggered calculation now
530  MatrixContainer[ux_shifted].SetAllValues(NULL, TMatrixRecord::mdtReal, FullDims, NOLOAD, NOCHECKPOINT, "");
531  MatrixContainer[uy_shifted].SetAllValues(NULL, TMatrixRecord::mdtReal, FullDims, NOLOAD, NOCHECKPOINT, "");
532  MatrixContainer[uz_shifted].SetAllValues(NULL, TMatrixRecord::mdtReal, FullDims, NOLOAD, NOCHECKPOINT, "");
533 
534  // shifts from the input file
535  MatrixContainer[x_shift_neg_r].SetAllValues(NULL, TMatrixRecord::mdtComplex, TDimensionSizes(X_2, 1 , 1 ), LOAD, NOCHECKPOINT, x_shift_neg_r_Name);
536  MatrixContainer[y_shift_neg_r].SetAllValues(NULL, TMatrixRecord::mdtComplex, TDimensionSizes(1 , Y_2, 1 ), LOAD, NOCHECKPOINT, y_shift_neg_r_Name);
537  MatrixContainer[z_shift_neg_r].SetAllValues(NULL, TMatrixRecord::mdtComplex, TDimensionSizes(1 , 1 , Z_2), LOAD, NOCHECKPOINT, z_shift_neg_r_Name);
538  }// u_non_staggered
539 
540 
541  //------------------------------------------------------------------------//
542  //--------------------- Temporary matrices -------------------------------//
543  //------------------------------------------------------------------------//
544  // this matrix used to load alpha_coeff for absorb_tau pre-calculation
545 
546  if ((Params->Get_absorbing_flag() != 0) && (!Params->Get_alpha_coeff_scallar_flag()))
547  {
548  MatrixContainer[Temp_1_RS3D].SetAllValues(NULL,TMatrixRecord::mdtReal, FullDims , LOAD, NOCHECKPOINT, alpha_coeff_Name);
549  }
550  else
551  {
552  MatrixContainer[Temp_1_RS3D].SetAllValues(NULL,TMatrixRecord::mdtReal, FullDims , NOLOAD, NOCHECKPOINT, "");
553  }
554 
555  MatrixContainer[Temp_2_RS3D].SetAllValues(NULL,TMatrixRecord::mdtReal, FullDims , NOLOAD, NOCHECKPOINT, "");
556  MatrixContainer[Temp_3_RS3D].SetAllValues(NULL,TMatrixRecord::mdtReal, FullDims , NOLOAD, NOCHECKPOINT, "");
557 
558  MatrixContainer[FFT_X_temp].SetAllValues(NULL, TMatrixRecord::mdtFFTW, ReducedDims, NOLOAD, NOCHECKPOINT, "");
559  MatrixContainer[FFT_Y_temp].SetAllValues(NULL, TMatrixRecord::mdtFFTW, ReducedDims, NOLOAD, NOCHECKPOINT, "");
560  MatrixContainer[FFT_Z_temp].SetAllValues(NULL, TMatrixRecord::mdtFFTW, ReducedDims, NOLOAD, NOCHECKPOINT, "");
561 }// end of InitMatrixContainer
562 //------------------------------------------------------------------------------
563 
564 
565 //----------------------------------------------------------------------------//
566 //------------------------- Protected methods --------------------------------//
567 //----------------------------------------------------------------------------//
568 
569 
570 //----------------------------------------------------------------------------//
571 //-------------------------- Private methods ---------------------------------//
572 //----------------------------------------------------------------------------//
573 
574 
575 /**
576  * Print error and and throw an exception.
577  * @throw bad_alloc
578  *
579  * @param [in] FMT - format of error
580  * @param [in] HDF5MatrixName - HDF5 dataset name
581  * @param [in] File - File of error
582  * @param [in] Line - Line of error
583  *
584  */
586  const string HDF5MatrixName,
587  const char * File,
588  const int Line)
589 {
590  fprintf(stderr,FMT, HDF5MatrixName.c_str(), File, Line);
591  throw bad_alloc();
592 }// end of PrintErrorAndAbort
593 //------------------------------------------------------------------------------
594 
595 
596 
597 //============================================================================//
598 // TOutputStreamContainer //
599 //============================================================================//
600 
601 //----------------------------------------------------------------------------//
602 //--------------------------- Public methods ---------------------------------//
603 //----------------------------------------------------------------------------//
604 
605 
606 /**
607  * Destructor
608  */
610 {
611  OutputStreamContainer.clear();
612 }// end of Destructor
613 //------------------------------------------------------------------------------
614 
615 /**
616  * Add all streams in simulation in the container, set all streams records here!
617  * Please note, the Matrixcontainer has to be populated before calling this routine.
618  *
619  * @param [in] MatrixContainer - matrix container to link the steams with
620  * sampled matrices and sensor masks
621  */
623 {
624 
626 
627  float * TempBufferX = MatrixContainer.GetMatrix<TRealMatrix>(Temp_1_RS3D).GetRawData();
628  float * TempBufferY = MatrixContainer.GetMatrix<TRealMatrix>(Temp_2_RS3D).GetRawData();
629  float * TempBufferZ = MatrixContainer.GetMatrix<TRealMatrix>(Temp_3_RS3D).GetRawData();
630 
631  //--------------------- Pressure ------------------/
632  if (Params->IsStore_p_raw())
633  {
634  OutputStreamContainer[p_sensor_raw] = CreateNewOutputStream(MatrixContainer,
635  p,
636  p_Name,
637  TBaseOutputHDF5Stream::roNONE,
638  TempBufferX);
639  }// IsStore_p_raw
640 
641  if (Params->IsStore_p_rms())
642  {
643  OutputStreamContainer[p_sensor_rms] = CreateNewOutputStream(MatrixContainer,
644  p,
645  p_rms_Name,
646  TBaseOutputHDF5Stream::roRMS);
647  }
648 
649  if (Params->IsStore_p_max())
650  {
651  OutputStreamContainer[p_sensor_max] = CreateNewOutputStream(MatrixContainer,
652  p,
653  p_max_Name,
654  TBaseOutputHDF5Stream::roMAX);
655  }
656 
657  if (Params->IsStore_p_min())
658  {
659  OutputStreamContainer[p_sensor_min] = CreateNewOutputStream(MatrixContainer,
660  p,
661  p_min_Name,
662  TBaseOutputHDF5Stream::roMIN);
663  }
664 
665  if (Params->IsStore_p_max_all())
666  {
667  OutputStreamContainer[p_sensor_max_all] =
670  MatrixContainer.GetMatrix<TRealMatrix>(p),
671  TBaseOutputHDF5Stream::roMAX);
672  }
673 
674  if (Params->IsStore_p_min_all())
675  {
676  OutputStreamContainer[p_sensor_min_all] =
679  MatrixContainer.GetMatrix<TRealMatrix>(p),
680  TBaseOutputHDF5Stream::roMIN);
681  }
682 
683  //--------------------- Velocity ------------------/
684  if (Params->IsStore_u_raw())
685  {
686  OutputStreamContainer[ux_sensor_raw] = CreateNewOutputStream(MatrixContainer,
687  ux_sgx,
688  ux_Name,
689  TBaseOutputHDF5Stream::roNONE,
690  TempBufferX);
691  OutputStreamContainer[uy_sensor_raw] = CreateNewOutputStream(MatrixContainer,
692  uy_sgy,
693  uy_Name,
694  TBaseOutputHDF5Stream::roNONE,
695  TempBufferY);
696  OutputStreamContainer[uz_sensor_raw] = CreateNewOutputStream(MatrixContainer,
697  uz_sgz,
698  uz_Name,
699  TBaseOutputHDF5Stream::roNONE,
700  TempBufferZ);
701  }
702 
703  if (Params->IsStore_u_non_staggered_raw())
704  {
705  OutputStreamContainer[ux_shifted_sensor_raw] = CreateNewOutputStream(MatrixContainer,
706  ux_shifted,
708  TBaseOutputHDF5Stream::roNONE,
709  TempBufferX);
710  OutputStreamContainer[uy_shifted_sensor_raw] = CreateNewOutputStream(MatrixContainer,
711  uy_shifted,
713  TBaseOutputHDF5Stream::roNONE,
714  TempBufferY);
715  OutputStreamContainer[uz_shifted_sensor_raw] = CreateNewOutputStream(MatrixContainer,
716  uz_shifted,
718  TBaseOutputHDF5Stream::roNONE,
719  TempBufferZ);
720  }
721 
722  if (Params->IsStore_u_rms())
723  {
724  OutputStreamContainer[ux_sensor_rms] = CreateNewOutputStream(MatrixContainer,
725  ux_sgx,
726  ux_rms_Name,
727  TBaseOutputHDF5Stream::roRMS);
728  OutputStreamContainer[uy_sensor_rms] = CreateNewOutputStream(MatrixContainer,
729  uy_sgy,
730  uy_rms_Name,
731  TBaseOutputHDF5Stream::roRMS);
732  OutputStreamContainer[uz_sensor_rms] = CreateNewOutputStream(MatrixContainer,
733  uz_sgz,
734  uz_rms_Name,
735  TBaseOutputHDF5Stream::roRMS);
736  }
737 
738  if (Params->IsStore_u_max())
739  {
740  OutputStreamContainer[ux_sensor_max] = CreateNewOutputStream(MatrixContainer,
741  ux_sgx,
742  ux_max_Name,
743  TBaseOutputHDF5Stream::roMAX);
744  OutputStreamContainer[uy_sensor_max] = CreateNewOutputStream(MatrixContainer,
745  uy_sgy,
746  uy_max_Name,
747  TBaseOutputHDF5Stream::roMAX);
748  OutputStreamContainer[uz_sensor_max] = CreateNewOutputStream(MatrixContainer,
749  uz_sgz,
750  uz_max_Name,
751  TBaseOutputHDF5Stream::roMAX);
752  }
753 
754  if (Params->IsStore_u_min())
755  {
756  OutputStreamContainer[ux_sensor_min] = CreateNewOutputStream(MatrixContainer,
757  ux_sgx,
758  ux_min_Name,
759  TBaseOutputHDF5Stream::roMIN);
760  OutputStreamContainer[uy_sensor_min] = CreateNewOutputStream(MatrixContainer,
761  uy_sgy,
762  uy_min_Name,
763  TBaseOutputHDF5Stream::roMIN);
764  OutputStreamContainer[uz_sensor_min] = CreateNewOutputStream(MatrixContainer,
765  uz_sgz,
766  uz_min_Name,
767  TBaseOutputHDF5Stream::roMIN);
768  }
769 
770  if (Params->IsStore_u_max_all())
771  {
772  OutputStreamContainer[ux_sensor_max_all] =
775  MatrixContainer.GetMatrix<TRealMatrix>(ux_sgx),
776  TBaseOutputHDF5Stream::roMAX);
777  OutputStreamContainer[uy_sensor_max_all] =
780  MatrixContainer.GetMatrix<TRealMatrix>(uy_sgy),
781  TBaseOutputHDF5Stream::roMAX);
782  OutputStreamContainer[uz_sensor_max_all] =
785  MatrixContainer.GetMatrix<TRealMatrix>(uz_sgz),
786  TBaseOutputHDF5Stream::roMAX);
787  }
788 
789  if (Params->IsStore_u_min_all())
790  {
791  OutputStreamContainer[ux_sensor_min_all] =
794  MatrixContainer.GetMatrix<TRealMatrix>(ux_sgx),
795  TBaseOutputHDF5Stream::roMIN);
796  OutputStreamContainer[uy_sensor_min_all] =
799  MatrixContainer.GetMatrix<TRealMatrix>(uy_sgy),
800  TBaseOutputHDF5Stream::roMIN);
801  OutputStreamContainer[uz_sensor_min_all] =
804  MatrixContainer.GetMatrix<TRealMatrix>(uz_sgz),
805  TBaseOutputHDF5Stream::roMIN);
806  }
807 }// end of AddStreamsdIntoContainer
808 //------------------------------------------------------------------------------
809 
810 /**
811  * Create all streams.
812  */
814 {
815  for (TOutputStreamMap::iterator it = OutputStreamContainer.begin(); it != OutputStreamContainer.end(); it++)
816  {
817  if (it->second)
818  {
819  (it->second)->Create();
820  }
821  }
822 }// end of CreateStreams
823 //------------------------------------------------------------------------------
824 
825 /**
826  * Reopen all streams after restarting form checkpoint.
827  */
829 {
830  for (TOutputStreamMap::iterator it = OutputStreamContainer.begin(); it != OutputStreamContainer.end(); it++)
831  {
832  if (it->second)
833  {
834  (it->second)->Reopen();
835  }
836  }
837 }// end of CreateStreams
838 //------------------------------------------------------------------------------
839 
840 
841 /**
842  * Sample all streams.
843  */
845 {
846  for (TOutputStreamMap::iterator it = OutputStreamContainer.begin(); it != OutputStreamContainer.end(); it++)
847  {
848  if (it->second)
849  {
850  (it->second)->Sample();
851  }
852  }
853 }// end of CloseStreams
854 //------------------------------------------------------------------------------
855 
856 
857 /**
858  * Checkpoint streams without post-processing (flush to the file).
859  */
861 {
862  for (TOutputStreamMap::iterator it = OutputStreamContainer.begin(); it != OutputStreamContainer.end(); it++)
863  {
864  if (it->second)
865  {
866  (it->second)->Checkpoint();
867  }
868  }
869 }// end of CheckpointStreams
870 //------------------------------------------------------------------------------
871 
872 /**
873  * /// Post-process all streams and flush them to the file.
874  */
876 {
877  for (TOutputStreamMap::iterator it = OutputStreamContainer.begin(); it != OutputStreamContainer.end(); it++)
878  {
879  if (it->second)
880  {
881  (it->second)->PostProcess();
882  }
883  }
884 }// end of CheckpointStreams
885 //------------------------------------------------------------------------------
886 
887 
888 /**
889  * Close all streams (apply post-processing if necessary, flush data and close).
890  */
892 {
893  for (TOutputStreamMap::iterator it = OutputStreamContainer.begin(); it != OutputStreamContainer.end(); it++)
894  {
895  if (it->second)
896  {
897  (it->second)->Close();
898  }
899  }
900 }// end of CloseStreams
901 //------------------------------------------------------------------------------
902 
903 /**
904  * Free all streams- destroy them.
905  */
907 {
908  for (TOutputStreamMap::iterator it = OutputStreamContainer.begin(); it != OutputStreamContainer.end(); it++)
909  {
910  if (it->second)
911  {
912  delete it->second;
913  }
914  }
915  OutputStreamContainer.clear();
916 }// end of FreeAllStreams
917 //------------------------------------------------------------------------------
918 
919 
920 //----------------------------------------------------------------------------//
921 //--------------------------- Protected methods ------------------------------//
922 //----------------------------------------------------------------------------//
923 
924 
925 /**
926  * Create a new output stream.
927  * @param [in] MatrixContainer - name of the HDF5 dataset or group
928  * @param [in] SampledMatrixID - code id of the matrix
929  * @param [in] HDF5_DatasetName - name of the HDF5 dataset or group
930  * @param [in] ReductionOp - reduction operator
931  * @param [in] BufferToReuse - buffer to reuse
932  * @return new output stream with defined links.
933  */
935  const TMatrixID SampledMatrixID,
936  const char * HDF5_DatasetName,
938  float * BufferToReuse)
939 {
941 
942  TBaseOutputHDF5Stream * Stream = NULL;
943 
944  if (Params->Get_sensor_mask_type() == TParameters::smt_index)
945  {
946  Stream = new TIndexOutputHDF5Stream(Params->HDF5_OutputFile,
947  HDF5_DatasetName,
948  MatrixContainer.GetMatrix<TRealMatrix>(SampledMatrixID),
949  MatrixContainer.GetMatrix<TIndexMatrix>(sensor_mask_index),
950  ReductionOp,
951  BufferToReuse);
952  }
953  else
954  {
955  Stream = new TCuboidOutputHDF5Stream(Params->HDF5_OutputFile,
956  HDF5_DatasetName,
957  MatrixContainer.GetMatrix<TRealMatrix>(SampledMatrixID),
958  MatrixContainer.GetMatrix<TIndexMatrix>(sensor_mask_corners),
959  ReductionOp,
960  BufferToReuse);
961  }
962 
963  return Stream;
964 }// end of CreateNewOutputStream
965 //------------------------------------------------------------------------------
966 
967 //----------------------------------------------------------------------------//
968 //--------------------------- Private methods --------------------------------//
969 //----------------------------------------------------------------------------//
const char *const transducer_source_input_Name
transducer_source_input variable name
Definition: MatrixNames.h:159
size_t Z
Z dimension size.
TDimensionSizes GetReducedDimensionSizes() const
Reduced dimension sizes of the simulation (complex classes).
Definition: Parameters.h:86
const char *const pml_x_Name
pml_x variable name
Definition: MatrixNames.h:92
bool LoadData
Is the matrix content loaded from the HDF5 file.
size_t Get_sensor_mask_index_size() const
Get sensor_mask_index_size value.
Definition: Parameters.h:158
void AddStreamsIntoContainer(TMatrixContainer &MatrixContainer)
Create all streams in container (no file manipulation).
size_t Get_u_source_index_size() const
Get u_source_index_size value.
Definition: Parameters.h:163
void StoreDataIntoCheckpointHDF5File(THDF5_File &HDF5_File)
Store selected matrices into the checkpoint file.
TReductionOperator
How to aggregate data.
const char *const ux_rms_Name
ux_rms variable name
Definition: MatrixNames.h:268
const char *const ux_max_Name
ux_max variable name
Definition: MatrixNames.h:275
const char *const x_shift_neg_r_Name
x_shift_neg_r variable name
Definition: MatrixNames.h:71
const char *const p_rms_Name
p_rms variable name
Definition: MatrixNames.h:255
THDF5_File HDF5_OutputFile
Handle to the output HDF5 file.
Definition: Parameters.h:264
const char *const duxdx_Name
duxdx variable name
Definition: MatrixNames.h:202
Abstract base class, the common ancestor defining the common interface and allowing derived classes t...
Definition: BaseMatrix.h:52
TMatrixRecordContainer MatrixContainer
Map holding the container.
Output stream for quantities sampled in the whole domain.
const char *const pml_z_Name
pml_z variable name
Definition: MatrixNames.h:96
const char *const p_max_all_Name
p_max_all variable name
Definition: MatrixNames.h:261
const char *const uy_Name
uy variable name
Definition: MatrixNames.h:183
Output stream for quantities sampled by a cuboid corner sensor mask.
const char *const uy_min_Name
uy_min variable name
Definition: MatrixNames.h:283
const char *const delay_mask_Name
delay_mask variable name
Definition: MatrixNames.h:164
const char *const uy_max_all_Name
uy_max_all variable name
Definition: MatrixNames.h:290
const char *const ddx_k_shift_neg_r_Name
ddx_k_shift_neg_r variable name
Definition: MatrixNames.h:230
size_t Get_ux_source_flag() const
Get ux_source_flag value.
Definition: Parameters.h:127
const char *const pml_y_Name
pml_y variable name
Definition: MatrixNames.h:94
bool IsStore_u_min() const
Is –u_min specified at the command line?
Definition: Parameters.h:248
TSenosrMaskType Get_sensor_mask_type() const
Get sensor mask type (linear or corners).
Definition: Parameters.h:156
void FreeAllStreams()
Free all streams - destroy them.
bool IsStore_u_raw() const
Is -u or –u_raw specified at the command line?
Definition: Parameters.h:240
virtual ~TMatrixContainer()
Destructor.
size_t Get_sensor_mask_corners_size() const
Get number of cubes in the mask.
Definition: Parameters.h:160
const char *const z_shift_neg_r_Name
z_shift_neg_r variable name
Definition: MatrixNames.h:75
const char *const rho0_Name
rho0 variable name
Definition: MatrixNames.h:237
const char *const BonA_Name
BonA variable name.
Definition: MatrixNames.h:170
const char *const ddz_k_shift_pos_Name
ddz_k_shift_pos variable name
Definition: MatrixNames.h:227
const char *const p_source_input_Name
p_source_input variable name
Definition: MatrixNames.h:129
const char *const absorb_nabla2_r_Name
absorb_nabla2_r variable name
Definition: MatrixNames.h:252
const char *const uz_max_all_Name
uz_max_all variable name
Definition: MatrixNames.h:292
bool Checkpoint
Is the matrix necessary to be preserver when checkpoint is enabled.
bool Get_c0_scalar_flag() const
Get c0_scalar_flag value.
Definition: Parameters.h:175
const char *const ddx_k_shift_pos_r_Name
ddx_k_shift_pos_r variable name
Definition: MatrixNames.h:223
const char *const uz_non_staggered_Name
uz_non_staggered variable name
Definition: MatrixNames.h:199
const char *const y_shift_neg_r_Name
y_shift_neg_r variable name
Definition: MatrixNames.h:73
size_t X
X dimension size.
size_t Get_u_source_many() const
Get u_source_many value.
Definition: Parameters.h:133
const char *const p_min_Name
p_min variable name
Definition: MatrixNames.h:259
The header file containing the parameters of the simulation.
bool Get_BonA_scalar_flag() const
Get BonA_scalar_flag value.
Definition: Parameters.h:185
const char *const alpha_coeff_Name
alpha_coeff variable name
Definition: MatrixNames.h:61
const char *const rhox_Name
rhox variable name
Definition: MatrixNames.h:174
const char *const ddy_k_shift_pos_Name
ddy_k_shift_pos variable name
Definition: MatrixNames.h:225
const char *const absorb_tau_Name
absorb_tau variable name
Definition: MatrixNames.h:246
const char *const duydy_Name
duydy variable name
Definition: MatrixNames.h:204
const char *const ddy_k_shift_neg_Name
ddy_k_shift_neg variable name
Definition: MatrixNames.h:232
const char *const uy_source_input_Name
uy_source_input variable name
Definition: MatrixNames.h:138
const char *const absorb_eta_Name
absorb_eta variable name
Definition: MatrixNames.h:248
Class implementing 3D Real-To-Complex and Complex-To-Real transforms using FFTW interface.
const char *const c0_Name
c0 variable name
Definition: MatrixNames.h:56
const char *const uy_rms_Name
uy_rms variable name
Definition: MatrixNames.h:270
TMatrixDataType MatrixDataType
Matrix data type.
const char *const dzudzn_sgz_Name
dzudzn_sgz variable name
Definition: MatrixNames.h:220
const char *const p_max_Name
p_max variable name
Definition: MatrixNames.h:257
const char *const rho0_sgy_Name
rho0_sgy variable name
Definition: MatrixNames.h:241
bool IsStore_u_rms() const
Is –u_raw specified at the command line?
Definition: Parameters.h:244
void FreeAllMatrices()
Free all matrices - destroy them.
TDimensionSizes GetFullDimensionSizes() const
Full dimension sizes of the simulation (real classes).
Definition: Parameters.h:84
bool IsStore_p_raw() const
Is -p or –p_raw specified at the command line?
Definition: Parameters.h:225
bool IsStore_p_rms() const
Is –p_rms specified at the command line?
Definition: Parameters.h:227
bool IsStore_p_min_all() const
Is –p_min_all specified at the command line?
Definition: Parameters.h:235
TMatrixRecord & operator=(const TMatrixRecord &src)
operator =
bool IsStore_p_min() const
Is –p_min specified at the command line?
Definition: Parameters.h:231
Output stream for quantities sampled by an index sensor mask.
The header file of classes responsible for storing output quantities into the output HDF5 file...
const char *const pml_y_sgy_Name
pml_y_sgy variable name
Definition: MatrixNames.h:87
bool IsStore_u_non_staggered_raw() const
Is –u_non_staggered_raw set?
Definition: Parameters.h:242
bool IsStore_u_min_all() const
Is –u_min_all specified at the command line?
Definition: Parameters.h:252
Class storing all parameters of the simulation.
Definition: Parameters.h:51
size_t Get_uy_source_flag() const
Get uy_source_flag value.
Definition: Parameters.h:129
const char *const uz_max_Name
uz_max variable name
Definition: MatrixNames.h:279
TBaseOutputHDF5Stream * CreateNewOutputStream(TMatrixContainer &MatrixContainer, const TMatrixID SampledMatrixID, const char *HDF5_DatasetName, const TBaseOutputHDF5Stream::TReductionOperator ReductionOp, float *BufferToReuse=NULL)
const char *const dxudxn_Name
dxudxn variable name
Definition: MatrixNames.h:209
TMatrixID
Matrix identifers of all matrices in the k-space code.
void SampleStreams()
Sample all streams.
void LoadDataFromInputHDF5File(THDF5_File &HDF5_File)
Load all matrices from the HDF5 file.
const char *const p_min_all_Name
p_min_all variable name
Definition: MatrixNames.h:263
string HDF5MatrixName
HDF5 matrix name.
The header file containing all error messages of the project.
size_t Get_p_source_many() const
Get p_source_many value.
Definition: Parameters.h:142
size_t Get_p0_source_flag() const
Get p0_source_flag value.
Definition: Parameters.h:140
void ReopenStreams()
Reopen streams after checkpoint file (datasets).
const char *const dzudzn_Name
dzudzn variable name
Definition: MatrixNames.h:213
const char *const ux_source_input_Name
ux_source_input variable name
Definition: MatrixNames.h:136
Abstract base class for output data streams (sampled data).
Class implementing the matrix container.
const char *const uy_max_Name
uy_max variable name
Definition: MatrixNames.h:277
TBaseMatrix * MatrixPtr
Pointer to the matrix object.
size_t Get_nonlinear_flag() const
Get nonlinear_flag value.
Definition: Parameters.h:151
TDimensionSizes DimensionSizes
Matrix dimension sizes.
The class for real matrices.
Definition: RealMatrix.h:48
size_t Y
Y dimension size.
const char *const uy_non_staggered_Name
uy_non_staggered variable name
Definition: MatrixNames.h:197
A structure storing details about the matrix. The matrix container stores this structures.
const char *const uz_source_input_Name
uz_source_input variable name
Definition: MatrixNames.h:140
const char *const rhoz_Name
rhoz variable name
Definition: MatrixNames.h:178
TOutputStreamMap OutputStreamContainer
Map with output streams.
size_t Get_uz_source_flag() const
Get uz_source_flag value.
Definition: Parameters.h:131
bool IsStore_p_max_all() const
Is –p_max_all specified at the command line?
Definition: Parameters.h:233
const char *const ux_min_all_Name
ux_min_all variable name
Definition: MatrixNames.h:294
const char *const uz_rms_Name
uz_rms variable name
Definition: MatrixNames.h:272
const char *const MatrixContainer_ERR_FMT_ReloactaionError
Matrix container error message.
Definition: ErrorMessages.h:99
const char *const uy_sgy_Name
uy_sgy variable name
Definition: MatrixNames.h:190
void SetAllValues(TBaseMatrix *MatrixPtr, const TMatrixDataType MatrixDataType, const TDimensionSizes DimensionSizes, const bool LoadData, const bool Checkpoint, const string HDF5MatrixName)
Set all values of the record.
const char *const sensor_mask_corners_Name
sensor_mask_corners variable name
Definition: MatrixNames.h:156
void CheckpointStreams()
Checkpoint streams.
The class for 64b unsigned integers (indices). It is used for sensor_mask_index or sensor_corners_mas...
Definition: IndexMatrix.h:50
const char *const absorb_nabla1_r_Name
absorb_nabla1_r variable name
Definition: MatrixNames.h:250
const char *const uz_sgz_Name
uz_sgz variable name
Definition: MatrixNames.h:192
size_t Get_transducer_source_input_size() const
Get transducer_source_input_size value.
Definition: Parameters.h:167
const char *const kappa_r_Name
kappa_r variable name
Definition: MatrixNames.h:168
const char *const uz_min_Name
uz_min variable name
Definition: MatrixNames.h:285
size_t Get_p_source_flag() const
Get p_source_flag value.
Definition: Parameters.h:138
TMatrixDataType
All possible types of the matrix.
size_t Get_transducer_source_flag() const
Get transducer_source_flag value.
Definition: Parameters.h:153
virtual ~TOutputStreamContainer()
Destructor.
const char *const ux_min_Name
ux_min variable name
Definition: MatrixNames.h:281
const char *const dyudyn_Name
dyudyn variable name
Definition: MatrixNames.h:211
size_t GetCompressionLevel() const
Get compression level.
Definition: Parameters.h:208
const char *const MatrixContainer_ERR_FMT_RecordUnknownDistributionType
Matrix container error message.
Definition: ErrorMessages.h:94
bool Get_alpha_coeff_scallar_flag() const
Get alpha_coeff_scallar_flag value.
Definition: Parameters.h:170
const char *const dxudxn_sgx_Name
dxudxn_sgx variable name
Definition: MatrixNames.h:216
The header file containing the matrix container.
const char *const duzdz_Name
duzdz variable name
Definition: MatrixNames.h:206
const char *const pml_z_sgz_Name
pml_z_sgz variable name
Definition: MatrixNames.h:89
bool IsStore_u_max() const
Is –u_max specified at the command line?
Definition: Parameters.h:246
const char *const u_source_index_Name
u_source_index variable name
Definition: MatrixNames.h:134
bool IsStore_u_max_all() const
Is –u_max_all specified at the command line.
Definition: Parameters.h:250
const char *const rho0_sgz_Name
rho0_sgz variable name
Definition: MatrixNames.h:243
const char *const ux_max_all_Name
ux_max_all variable name
Definition: MatrixNames.h:288
const char *const dyudyn_sgy_Name
dyudyn_sgy variable name
Definition: MatrixNames.h:218
bool IsStore_p_max() const
Is –p_max specified at the command line?
Definition: Parameters.h:229
size_t Get_p_source_index_size() const
Get p_source_index_size value.
Definition: Parameters.h:165
const char *const uz_min_all_Name
uz_min_all variable name
Definition: MatrixNames.h:298
void CreateStreams()
Create all streams - opens the datasets.
const char *const pml_x_sgx_Name
pml_x_sgx variable name
Definition: MatrixNames.h:85
T & GetMatrix(const TMatrixID MatrixID)
Get the matrix with a specific type from the container.
bool Get_rho0_scalar_flag() const
Get rho0_scalar_flag value.
Definition: Parameters.h:190
const char *const p0_source_input_Name
p0_source_input variable name
Definition: MatrixNames.h:162
size_t Get_absorbing_flag() const
Get absorbing_flag value.
Definition: Parameters.h:149
void AddMatricesIntoContainer()
Set all matrices recored - populate the container.
void LoadDataFromCheckpointHDF5File(THDF5_File &HDF5_File)
Load all matrices from the HDF5 file.
const char *const rho0_sgx_Name
rho0_sgx variable name
Definition: MatrixNames.h:239
const char *const uz_Name
uz variable name
Definition: MatrixNames.h:185
size_t Get_nonuniform_grid_flag() const
Get nonuniform_grid_flag value.
Definition: Parameters.h:147
const char *const p_source_index_Name
p_source_index variable name
Definition: MatrixNames.h:131
The velocity matrix.
The class for complex matrices.
Definition: ComplexMatrix.h:64
const char *const rhoy_Name
rhoy variable name
Definition: MatrixNames.h:176
const char *const sensor_mask_index_Name
sensor_mask_index variable name
Definition: MatrixNames.h:152
const char *const ux_sgx_Name
ux_sgx variable name
Definition: MatrixNames.h:188
const char *const uy_min_all_Name
uy_min_all variable name
Definition: MatrixNames.h:296
void PrintErrorAndThrowException(const char *FMT, const string HDF5MatrixName, const char *File, const int Line)
Print error and throw an exception.
void CloseStreams()
Close all streams.
TMatrixRecord()
Default constructor.
const char *const ddz_k_shift_neg_Name
ddz_k_shift_neg variable name
Definition: MatrixNames.h:234
const char *const ux_non_staggered_Name
ux_non_staggered variable name
Definition: MatrixNames.h:195
void CreateAllObjects()
Create instances of all objects in the container.
Class wrapping the HDF5 routines.
Definition: HDF5_File.h:506
Structure with 4D dimension sizes (3 in space and 1 in time).
const char *const ux_Name
ux variable name
Definition: MatrixNames.h:181
void PostProcessStreams()
Post-process all streams and flush them to the file.
static TParameters * GetInstance()
Get instance of the singleton class.
Definition: Parameters.cpp:74
const char *const p_Name
p variable name
Definition: MatrixNames.h:172