| kspaceFirstOrder3D-CUDA 1.1 The CUDA/C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Parameters.cpp
Go to the documentation of this file.
1 /**
2 * @file Parameters.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 parameters of the simulation.
10 *
11 * @version kspaceFirstOrder3D 3.4
12 *
13 * @date 09 August 2012, 13:39 (created) \n
14 * 10 August 2016, 12:57 (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 #ifdef _OPENMP
33 #include <omp.h>
34 #endif
35
36 #include <iostream>
37 #include <string>
38 #include <exception>
39 #include <stdexcept>
40
41 #include <Parameters/Parameters.h>
42 #include <Parameters/CUDAParameters.h>
43 #include <Utils/MatrixNames.h>
44 #include <Logger/Logger.h>
45
46
47 using std::ios;
48 using std::string;
49
50 //------------------------------------------------------------------------------------------------//
51 //------------------------------------------ Constants -------------------------------------------//
52 //------------------------------------------------------------------------------------------------//
53
54
55 //------------------------------------------------------------------------------------------------//
56 //------------------------------------------ VARIABLES -------------------------------------------//
57 //------------------------------------------------------------------------------------------------//
58
59 bool TParameters::parametersInstanceFlag = false;
60
61 TParameters* TParameters::parametersSingleInstance = NULL;
62
63 //------------------------------------------------------------------------------------------------//
64 //--------------------------------------- Public methods -----------------------------------------//
65 //------------------------------------------------------------------------------------------------//
66
67 /**
68 * Get instance of singleton class.
69 */
70 TParameters& TParameters::GetInstance()
71 {
72 if(!parametersInstanceFlag)
73 {
74 parametersSingleInstance = new TParameters();
75 parametersInstanceFlag = true;
76 return *parametersSingleInstance;
77 }
78 else
79 {
80 return *parametersSingleInstance;
81 }
82 }// end of GetInstance()
83 //--------------------------------------------------------------------------------------------------
84
85 /**
86 * Destructor.
87 */
88 TParameters::~TParameters()
89 {
90 parametersInstanceFlag = false;
91 if (parametersSingleInstance)
92 {
93 delete parametersSingleInstance;
94 }
95 parametersSingleInstance = nullptr;
96 };
97 //--------------------------------------------------------------------------------------------------
98
99 /**
100 * Parse command line and read scalar values from the input file to initialise the class and
101 * the simulation.
102 *
103 * @param [in] argc - Number of commandline parameters
104 * @param [in] argv - Commandline parameters
105 */
106 void TParameters::Init(int argc, char** argv)
107 {
108 commandLineParameters.ParseCommandLine(argc, argv);
109
110 if (GetGitHash() != "")
111 {
112 TLogger::Log(TLogger::FULL, OUT_FMT_GIT_HASH_LEFT, GetGitHash().c_str());
113 TLogger::Log(TLogger::FULL, OUT_FMT_SEPARATOR);
114 }
115 if (commandLineParameters.IsVersion())
116 {
117 return;
118 }
119
120 TLogger::Log(TLogger::BASIC, OUT_FMT_READING_CONFIGURATION);
121 ReadScalarsFromInputFile(inputFile);
122
123 if (commandLineParameters.IsBenchmarkFlag())
124 {
125 nt = commandLineParameters.GetBenchmarkTimeStepsCount();
126 }
127
128 if ((nt <= commandLineParameters.GetStartTimeIndex()) ||
129 (0 > commandLineParameters.GetStartTimeIndex()))
130 {
131 throw std::invalid_argument(TLogger::FormatMessage(ERR_FMT_ILLEGAL_START_TIME_VALUE,
132 1l,
133 nt));
134 }
135
136 TLogger::Log(TLogger::BASIC, OUT_FMT_DONE);
137 }// end of ParseCommandLine
138 //--------------------------------------------------------------------------------------------------
139
140
141 /**
142 * Select a GPU device for execution.
143 */
144 void TParameters::SelectDevice()
145 {
146 TLogger::Log(TLogger::BASIC,
147 OUT_FMT_SELECTED_DEVICE);
148 TLogger::Flush(TLogger::BASIC);
149
150 int deviceIdx = commandLineParameters.GetCUDADeviceIdx();
151 cudaParameters.SelectDevice(deviceIdx); // throws an exception when wrong
152
153 TLogger::Log(TLogger::BASIC,
154 OUT_FMT_DEVICE_ID,
155 cudaParameters.GetDeviceIdx());
156
157 TLogger::Log(TLogger::BASIC,
158 OUT_FMT_DEVICE_NAME,
159 cudaParameters.GetDeviceName().c_str());
160 }// end of SelectDevice
161 //--------------------------------------------------------------------------------------------------
162
163
164 /**
165 * Print parameters of the simulation, based in the actual level of verbosity.
166 */
167 void TParameters::PrintSimulatoinSetup()
168 {
169 TLogger::Log(TLogger::BASIC,
170 OUT_FMT_NUMBER_OF_THREADS,
171 GetNumberOfThreads());
172
173 TLogger::Log(TLogger::BASIC, OUT_FMT_SIMULATION_DETAIL_TITLE);
174
175
176 const string domainsSizes = TLogger::FormatMessage(OUT_FMT_DOMAIN_SIZE_FORMAT,
177 GetFullDimensionSizes().nx,
178 GetFullDimensionSizes().ny,
179 GetFullDimensionSizes().nz);
180 // Print simulation size
181 TLogger::Log(TLogger::BASIC, OUT_FMT_DOMAIN_SIZE, domainsSizes.c_str());
182
183 TLogger::Log(TLogger::BASIC, OUT_FMT_SIMULATION_LENGTH, Get_nt());
184
185 // Print all command line parameters
186 commandLineParameters.PrintComandlineParamers();
187
188 if (Get_sensor_mask_type() == INDEX)
189 {
190 TLogger::Log(TLogger::ADVANCED, OUT_FMT_SENSOR_MASK_INDEX);
191 }
192 if (Get_sensor_mask_type() == CORNERS)
193 {
194 TLogger::Log(TLogger::ADVANCED, OUT_FMT_SENSOR_MASK_CUBOID);
195 }
196 }// end of PrintParametersOfTask
197 //--------------------------------------------------------------------------------------------------
198
199
200 /**
201 * Read scalar values from the input HDF5 file.
202 *
203 * @param [in] inputFile - Handle to an opened input file.
204 *
205 * @throw ios:failure if the file cannot be open or is of a wrong type or version.
206 */
207 void TParameters::ReadScalarsFromInputFile(THDF5_File& inputFile)
208 {
209 TDimensionSizes scalarSizes(1,1,1);
210
211 if (!inputFile.IsOpen())
212 {
213 // Open file -- exceptions handled in main
214 inputFile.Open(commandLineParameters.GetInputFileName());
215 }
216
217 fileHeader.ReadHeaderFromInputFile(inputFile);
218
219 // check file type
220 if (fileHeader.GetFileType() != THDF5_FileHeader::INPUT)
221 {
222 throw ios::failure(TLogger::FormatMessage(ERR_FMT_BAD_INPUT_FILE_FORMAT,
223 GetInputFileName().c_str()));
224 }
225
226 // check version
227 if (!fileHeader.CheckMajorFileVersion())
228 {
229 throw ios::failure(TLogger::FormatMessage(ERR_FMT_BAD_MAJOR_File_Version,
230 GetInputFileName().c_str(),
231 fileHeader.GetCurrentHDF5_MajorVersion().c_str()));
232 }
233
234 if (!fileHeader.CheckMinorFileVersion())
235 {
236 throw ios::failure(TLogger::FormatMessage(ERR_FMT_BAD_MINOR_FILE_VERSION,
237 GetInputFileName().c_str(),
238 fileHeader.GetCurrentHDF5_MinorVersion().c_str()));
239 }
240
241 const hid_t rootGroup = inputFile.GetRootGroup();
242
243 inputFile.ReadScalarValue(rootGroup, Nt_NAME, nt);
244
245 inputFile.ReadScalarValue(rootGroup, dt_NAME, dt);
246 inputFile.ReadScalarValue(rootGroup, dx_NAME, dx);
247 inputFile.ReadScalarValue(rootGroup, dy_NAME, dy);
248 inputFile.ReadScalarValue(rootGroup, dz_NAME, dz);
249
250 inputFile.ReadScalarValue(rootGroup, c_ref_NAME, c_ref);
251 inputFile.ReadScalarValue(rootGroup, pml_x_size_NAME, pml_x_size);
252 inputFile.ReadScalarValue(rootGroup, pml_y_size_NAME, pml_y_size);
253 inputFile.ReadScalarValue(rootGroup, pml_z_size_NAME, pml_z_size);
254
255 inputFile.ReadScalarValue(rootGroup, pml_x_alpha_NAME, pml_x_alpha);
256 inputFile.ReadScalarValue(rootGroup, pml_y_alpha_NAME, pml_y_alpha);
257 inputFile.ReadScalarValue(rootGroup, pml_z_alpha_NAME, pml_z_alpha);
258
259 size_t x, y, z;
260 inputFile.ReadScalarValue(rootGroup, Nx_NAME, x);
261 inputFile.ReadScalarValue(rootGroup, Ny_NAME, y);
262 inputFile.ReadScalarValue(rootGroup, Nz_NAME, z);
263
264
265 fullDimensionSizes.nx = x;
266 fullDimensionSizes.ny = y;
267 fullDimensionSizes.nz = z;
268
269 reducedDimensionSizes.nx = ((x/2) + 1);
270 reducedDimensionSizes.ny = y;
271 reducedDimensionSizes.nz = z;
272
273 // if the file is of version 1.0, there must be a sensor mask index (backward compatibility)
274 if (fileHeader.GetFileVersion() == THDF5_FileHeader::VERSION_10)
275 {
276 sensor_mask_ind_size = inputFile.GetDatasetElementCount(rootGroup, sensor_mask_index_NAME);
277
278 //if -u_non_staggered_raw enabled, throw an error - not supported
279 if (IsStore_u_non_staggered_raw())
280 {
281 throw ios::failure(ERR_FMT_U_NON_STAGGERED_NOT_SUPPORTED_FILE_VERSION);
282 }
283 }// version 1.0
284
285 // This is the current version 1.1
286 if (fileHeader.GetFileVersion() == THDF5_FileHeader::VERSION_11)
287 {
288 // read sensor mask type as a size_t value to enum
289 size_t sensorMaskTypeNumericValue = 0;
290 inputFile.ReadScalarValue(rootGroup, sensor_mask_type_NAME, sensorMaskTypeNumericValue);
291
292 // convert the long value on
293 switch (sensorMaskTypeNumericValue)
294 {
295 case 0:
296 {
297 sensor_mask_type = INDEX;
298 break;
299 }
300 case 1:
301 {
302 sensor_mask_type = CORNERS;
303 break;
304 }
305 default:
306 {
307 throw ios::failure(ERR_FMT_BAD_SENSOR_MASK_TYPE);
308 break;
309 }
310 }//case
311
312 // read the input mask size
313 switch (sensor_mask_type)
314 {
315 case INDEX:
316 {
317 sensor_mask_ind_size = inputFile.GetDatasetElementCount(rootGroup, sensor_mask_index_NAME);
318 break;
319 }
320 case CORNERS:
321 {
322 // mask dimensions are [6, N, 1] - I want to know N
323 sensor_mask_corners_size = inputFile.GetDatasetDimensionSizes(rootGroup, sensor_mask_corners_NAME).ny;
324 break;
325 }
326 }// switch
327 }// version 1.1
328
329 // flags
330 inputFile.ReadScalarValue(rootGroup, ux_source_flag_NAME, ux_source_flag);
331 inputFile.ReadScalarValue(rootGroup, uy_source_flag_NAME, uy_source_flag);
332 inputFile.ReadScalarValue(rootGroup, uz_source_flag_NAME, uz_source_flag);
333 inputFile.ReadScalarValue(rootGroup, transducer_source_flag_NAME, transducer_source_flag);
334
335 inputFile.ReadScalarValue(rootGroup, p_source_flag_NAME, p_source_flag);
336 inputFile.ReadScalarValue(rootGroup, p0_source_flag_NAME,p0_source_flag);
337
338 inputFile.ReadScalarValue(rootGroup, nonuniform_grid_flag_NAME, nonuniform_grid_flag);
339 inputFile.ReadScalarValue(rootGroup, absorbing_flag_NAME, absorbing_flag);
340 inputFile.ReadScalarValue(rootGroup, nonlinear_flag_NAME, nonlinear_flag);
341
342 // Vector sizes.
343 if (transducer_source_flag == 0)
344 {
345 transducer_source_input_size = 0;
346 }
347 else
348 {
349 transducer_source_input_size =inputFile.GetDatasetElementCount(rootGroup, transducer_source_input_NAME);
350 }
351
352 if ((transducer_source_flag > 0) || (ux_source_flag > 0) || (uy_source_flag > 0) || (uz_source_flag > 0))
353 {
354 u_source_index_size = inputFile.GetDatasetElementCount(rootGroup, u_source_index_NAME);
355 }
356
357 // uxyz_source_flags.
358 if ((ux_source_flag > 0) || (uy_source_flag > 0) || (uz_source_flag > 0))
359 {
360 inputFile.ReadScalarValue(rootGroup, u_source_many_NAME, u_source_many);
361 inputFile.ReadScalarValue(rootGroup, u_source_mode_NAME, u_source_mode);
362 }
363 else
364 {
365 u_source_many = 0;
366 u_source_mode = 0;
367 }
368
369 // p_source_flag
370 if (p_source_flag != 0)
371 {
372 inputFile.ReadScalarValue(rootGroup, p_source_many_NAME, p_source_many);
373 inputFile.ReadScalarValue(rootGroup, p_source_mode_NAME, p_source_mode);
374
375 p_source_index_size = inputFile.GetDatasetElementCount(rootGroup, p_source_index_NAME);
376 }
377 else
378 {
379 p_source_mode = 0;
380 p_source_many = 0;
381 p_source_index_size = 0;
382 }
383
384 // absorb flag.
385 if (absorbing_flag != 0)
386 {
387 inputFile.ReadScalarValue(rootGroup, alpha_power_NAME, alpha_power);
388 if (alpha_power == 1.0f)
389 {
390 throw std::invalid_argument(ERR_FMT_ILLEGAL_ALPHA_POWER_VALUE);
391 }
392
393 alpha_coeff_scalar_flag = inputFile.GetDatasetDimensionSizes(rootGroup, alpha_coeff_NAME) == scalarSizes;
394
395 if (alpha_coeff_scalar_flag)
396 {
397 inputFile.ReadScalarValue(rootGroup, alpha_coeff_NAME, alpha_coeff_scalar);
398 }
399 }
400
401 c0_scalar_flag = inputFile.GetDatasetDimensionSizes(rootGroup, c0_NAME) == scalarSizes;
402 if (c0_scalar_flag)
403 {
404 inputFile.ReadScalarValue(rootGroup, c0_NAME, c0_scalar);
405 }
406
407 if (nonlinear_flag)
408 {
409 BonA_scalar_flag = inputFile.GetDatasetDimensionSizes(rootGroup, BonA_NAME) == scalarSizes;
410 if (BonA_scalar_flag)
411 {
412 inputFile.ReadScalarValue(rootGroup, BonA_NAME, BonA_scalar);
413 }
414 }
415
416 rho0_scalar_flag = inputFile.GetDatasetDimensionSizes(rootGroup, rho0_NAME) == scalarSizes;
417 if (rho0_scalar_flag)
418 {
419 inputFile.ReadScalarValue(rootGroup, rho0_NAME, rho0_scalar);
420 inputFile.ReadScalarValue(rootGroup, rho0_sgx_NAME, rho0_sgx_scalar);
421 inputFile.ReadScalarValue(rootGroup, rho0_sgy_NAME, rho0_sgy_scalar);
422 inputFile.ReadScalarValue(rootGroup, rho0_sgz_NAME, rho0_sgz_scalar);
423 }
424 }// end of ReadScalarsFromInputFile
425 //--------------------------------------------------------------------------------------------------
426
427 /**
428 * Save scalars into the output HDF5 file.
429 *
430 * @param [in] outputFile - Handle to an opened output file where to store
431 */
432 void TParameters::SaveScalarsToFile(THDF5_File& outputFile)
433 {
434 const hid_t HDF5RootGroup = outputFile.GetRootGroup();
435
436 // Write dimension sizes
437 outputFile.WriteScalarValue(HDF5RootGroup, Nx_NAME, fullDimensionSizes.nx);
438 outputFile.WriteScalarValue(HDF5RootGroup, Ny_NAME, fullDimensionSizes.ny);
439 outputFile.WriteScalarValue(HDF5RootGroup, Nz_NAME, fullDimensionSizes.nz);
440
441 outputFile.WriteScalarValue(HDF5RootGroup, Nt_NAME, nt);
442
443 outputFile.WriteScalarValue(HDF5RootGroup, dt_NAME, dt);
444 outputFile.WriteScalarValue(HDF5RootGroup, dx_NAME, dx);
445 outputFile.WriteScalarValue(HDF5RootGroup, dy_NAME, dy);
446 outputFile.WriteScalarValue(HDF5RootGroup, dz_NAME, dz);
447
448 outputFile.WriteScalarValue(HDF5RootGroup, c_ref_NAME, c_ref);
449
450 outputFile.WriteScalarValue(HDF5RootGroup, pml_x_size_NAME, pml_x_size);
451 outputFile.WriteScalarValue(HDF5RootGroup, pml_y_size_NAME, pml_y_size);
452 outputFile.WriteScalarValue(HDF5RootGroup, pml_z_size_NAME, pml_z_size);
453
454 outputFile.WriteScalarValue(HDF5RootGroup, pml_x_alpha_NAME, pml_x_alpha);
455 outputFile.WriteScalarValue(HDF5RootGroup, pml_y_alpha_NAME, pml_y_alpha);
456 outputFile.WriteScalarValue(HDF5RootGroup, pml_z_alpha_NAME, pml_z_alpha);
457
458 outputFile.WriteScalarValue(HDF5RootGroup, ux_source_flag_NAME, ux_source_flag);
459 outputFile.WriteScalarValue(HDF5RootGroup, uy_source_flag_NAME, uy_source_flag);
460 outputFile.WriteScalarValue(HDF5RootGroup, uz_source_flag_NAME, uz_source_flag);
461 outputFile.WriteScalarValue(HDF5RootGroup, transducer_source_flag_NAME, transducer_source_flag);
462
463 outputFile.WriteScalarValue(HDF5RootGroup, p_source_flag_NAME, p_source_flag);
464 outputFile.WriteScalarValue(HDF5RootGroup, p0_source_flag_NAME, p0_source_flag);
465
466 outputFile.WriteScalarValue(HDF5RootGroup, nonuniform_grid_flag_NAME, nonuniform_grid_flag);
467 outputFile.WriteScalarValue(HDF5RootGroup, absorbing_flag_NAME, absorbing_flag);
468 outputFile.WriteScalarValue(HDF5RootGroup, nonlinear_flag_NAME, nonlinear_flag);
469
470 // uxyz_source_flags.
471 if ((ux_source_flag > 0) || (uy_source_flag > 0) || (uz_source_flag > 0))
472 {
473 outputFile.WriteScalarValue(HDF5RootGroup, u_source_many_NAME, u_source_many);
474 outputFile.WriteScalarValue(HDF5RootGroup, u_source_mode_NAME, u_source_mode);
475 }
476
477 // p_source_flag.
478 if (p_source_flag != 0)
479 {
480 outputFile.WriteScalarValue(HDF5RootGroup, p_source_many_NAME, p_source_many);
481 outputFile.WriteScalarValue(HDF5RootGroup, p_source_mode_NAME, p_source_mode);
482
483 }
484
485 // absorb flag
486 if (absorbing_flag != 0)
487 {
488 outputFile.WriteScalarValue(HDF5RootGroup, alpha_power_NAME, alpha_power);
489 }
490
491 // if copy sensor mask, then copy the mask type
492 if (IsCopySensorMask())
493 {
494 size_t SensorMaskTypeNumericValue = 0;
495
496 switch (sensor_mask_type)
497 {
498 case INDEX: SensorMaskTypeNumericValue = 0;
499 break;
500 case CORNERS: SensorMaskTypeNumericValue = 1;
501 break;
502 }// switch
503
504 outputFile.WriteScalarValue(HDF5RootGroup, sensor_mask_type_NAME, SensorMaskTypeNumericValue);
505 }
506 }// end of SaveScalarsToFile
507 //--------------------------------------------------------------------------------------------------
508
509 /**
510 * Get GitHash of the code
511 * @return githash
512 */
513 string TParameters::GetGitHash() const
514 {
515 #if (defined (__KWAVE_GIT_HASH__))
516 return string(__KWAVE_GIT_HASH__);
517 #else
518 return "";
519 #endif
520 }// end of GetGitHash
521 //--------------------------------------------------------------------------------------------------
522
523
524
525 //------------------------------------------------------------------------------------------------//
526 //-------------------------------------- Protected methods ---------------------------------------//
527 //------------------------------------------------------------------------------------------------//
528
529
530 /**
531 * Constructor.
532 */
533 TParameters::TParameters() :
534 cudaParameters(),
535 commandLineParameters(),
536 inputFile(), outputFile(), checkpointFile(), fileHeader(),
537 nt(0), t_index(0), dt(0.0f),
538 dx(0.0f), dy(0.0f), dz(0.0f),
539 c_ref(0.0f), alpha_power(0.0f),
540 fullDimensionSizes(0,0,0), reducedDimensionSizes(0,0,0),
541 sensor_mask_ind_size (0), u_source_index_size(0), p_source_index_size(0),
542 transducer_source_input_size(0),
543 ux_source_flag(0), uy_source_flag(0), uz_source_flag(0),
544 p_source_flag(0), p0_source_flag(0), transducer_source_flag(0),
545 u_source_many(0), u_source_mode(0), p_source_mode(0), p_source_many(0),
546 nonuniform_grid_flag(0), absorbing_flag(0), nonlinear_flag(0),
547 pml_x_size(0), pml_y_size(0), pml_z_size(0),
548 alpha_coeff_scalar_flag(false), alpha_coeff_scalar(0.0f),
549 c0_scalar_flag(false), c0_scalar(0.0f),
550 absorb_eta_scalar(0.0f), absorb_tau_scalar (0.0f),
551 BonA_scalar_flag(false), BonA_scalar (0.0f),
552 rho0_scalar_flag(false), rho0_scalar(0.0f),
553 rho0_sgx_scalar(0.0f), rho0_sgy_scalar(0.0f), rho0_sgz_scalar(0.0f)
554 {
555
556 }// end of TParameters()
557 //--------------------------------------------------------------------------------------------------
558
559
c_ref_NAME
TMatrixName c_ref_NAME
c_ref variable name
Definition: MatrixNames.h:61
alpha_power_NAME
TMatrixName alpha_power_NAME
alpha_power variable name
Definition: MatrixNames.h:66
TDimensionSizes::nx
size_t nx
number of elements in the x direction
Definition: DimensionSizes.h:145
ERR_FMT_ILLEGAL_START_TIME_VALUE
TErrorMessage ERR_FMT_ILLEGAL_START_TIME_VALUE
Command line parameters error message.
Definition: ErrorMessages.h:198
TParameters::transducer_source_flag
size_t transducer_source_flag
transducer_source_flag value.
Definition: Parameters.h:344
TParameters::cudaParameters
TCUDAParameters cudaParameters
Class with CUDA Parameters (runtime setup)
Definition: Parameters.h:280
OUT_FMT_DEVICE_NAME
TOutputMessage OUT_FMT_DEVICE_NAME
Output message.
Definition: OutputMessagesLinux.h:147
TParameters::parametersInstanceFlag
static bool parametersInstanceFlag
singleton flag
Definition: Parameters.h:409
TParameters::transducer_source_input_size
size_t transducer_source_input_size
transducer_source_input_size value.
Definition: Parameters.h:330
TParameters::c_ref
float c_ref
c_ref value.
Definition: Parameters.h:309
TParameters::BonA_scalar_flag
bool BonA_scalar_flag
BonA_scalar_flag value.
Definition: Parameters.h:393
OUT_FMT_SENSOR_MASK_INDEX
TOutputMessage OUT_FMT_SENSOR_MASK_INDEX
Output message.
Definition: OutputMessagesLinux.h:161
TParameters::p_source_flag
size_t p_source_flag
p_source_flag value.
Definition: Parameters.h:340
TParameters::GetNumberOfThreads
size_t GetNumberOfThreads() const
Get number of threads.
Definition: Parameters.h:220
p_source_index_NAME
TMatrixName p_source_index_NAME
p_source_index variable name
Definition: MatrixNames.h:145
p_source_flag_NAME
TMatrixName p_source_flag_NAME
p_source_flag variable name
Definition: MatrixNames.h:133
TParameters::ReadScalarsFromInputFile
void ReadScalarsFromInputFile(THDF5_File &inputFile)
Read scalar values from the input HDF5 file.
Definition: Parameters.cpp:207
THDF5_File::Open
void Open(const std::string &fileName, unsigned int flags=H5F_ACC_RDONLY)
Open a file.
Definition: HDF5_File.cpp:127
dt_NAME
TMatrixName dt_NAME
dt variable name
Definition: MatrixNames.h:52
TParameters::u_source_mode
size_t u_source_mode
u_source_mode value.
Definition: Parameters.h:349
TParameters::ux_source_flag
size_t ux_source_flag
ux_source_flag value.
Definition: Parameters.h:333
TCommandLineParameters::GetInputFileName
const std::string & GetInputFileName() const
Get input file name.
Definition: CommandLineParameters.h:223
TParameters::alpha_coeff_scalar_flag
bool alpha_coeff_scalar_flag
alpha_coeff_scalar_flag value.
Definition: Parameters.h:378
CUDAParameters.h
The header file for the class for setting CUDA kernel parameters.
TParameters::pml_x_alpha
float pml_x_alpha
pml_x_alpha value.
Definition: Parameters.h:371
sensor_mask_index_NAME
TMatrixName sensor_mask_index_NAME
sensor_mask_index variable name
Definition: MatrixNames.h:166
OUT_FMT_SIMULATION_DETAIL_TITLE
TOutputMessage OUT_FMT_SIMULATION_DETAIL_TITLE
Output message.
Definition: OutputMessagesLinux.h:78
transducer_source_input_NAME
TMatrixName transducer_source_input_NAME
transducer_source_input variable name
Definition: MatrixNames.h:173
u_source_mode_NAME
TMatrixName u_source_mode_NAME
u_source_mode variable name
Definition: MatrixNames.h:138
OUT_FMT_SIMULATION_LENGTH
TOutputMessage OUT_FMT_SIMULATION_LENGTH
Output message.
Definition: OutputMessagesLinux.h:158
rho0_sgz_NAME
TMatrixName rho0_sgz_NAME
rho0_sgz variable name
Definition: MatrixNames.h:257
BonA_NAME
TMatrixName BonA_NAME
BonA variable name.
Definition: MatrixNames.h:184
TParameters::reducedDimensionSizes
TDimensionSizes reducedDimensionSizes
Reduced 3D dimension sizes.
Definition: Parameters.h:316
TCommandLineParameters::PrintComandlineParamers
void PrintComandlineParamers()
Print setup.
Definition: CommandLineParameters.cpp:119
pml_z_size_NAME
TMatrixName pml_z_size_NAME
pml_z_size variable name
Definition: MatrixNames.h:96
dy_NAME
TMatrixName dy_NAME
dy variable name
Definition: MatrixNames.h:56
transducer_source_flag_NAME
TMatrixName transducer_source_flag_NAME
transducer_source_flag variable name
Definition: MatrixNames.h:164
TParameters::GetInstance
static TParameters & GetInstance()
Get instance of the singleton class.
Definition: Parameters.cpp:70
TParameters::absorb_eta_scalar
float absorb_eta_scalar
absorb_eta_scalar value.
Definition: Parameters.h:388
TParameters::c0_scalar_flag
bool c0_scalar_flag
c0_scalar_flag value.
Definition: Parameters.h:383
TParameters::nonlinear_flag
size_t nonlinear_flag
nonlinear_flag value.
Definition: Parameters.h:361
TParameters::p_source_mode
size_t p_source_mode
p_source_mode value.
Definition: Parameters.h:352
OUT_FMT_DOMAIN_SIZE
TOutputMessage OUT_FMT_DOMAIN_SIZE
Output message.
Definition: OutputMessagesLinux.h:150
THDF5_FileHeader::GetCurrentHDF5_MinorVersion
static std::string GetCurrentHDF5_MinorVersion()
Get string version of current Minor version.
Definition: HDF5_File.h:831
ERR_FMT_U_NON_STAGGERED_NOT_SUPPORTED_FILE_VERSION
TErrorMessage ERR_FMT_U_NON_STAGGERED_NOT_SUPPORTED_FILE_VERSION
Command line parameters error message.
Definition: ErrorMessages.h:214
TParameters::GetInputFileName
std::string GetInputFileName() const
Get input file name.
Definition: Parameters.h:211
nonlinear_flag_NAME
TMatrixName nonlinear_flag_NAME
nonlinear_flag variable name
Definition: MatrixNames.h:161
TParameters::u_source_index_size
size_t u_source_index_size
u_source_index_size value.
Definition: Parameters.h:326
TParameters::dz
float dz
dz value.
Definition: Parameters.h:306
pml_y_alpha_NAME
TMatrixName pml_y_alpha_NAME
pml_y_alpha variable name
Definition: MatrixNames.h:116
Ny_NAME
TMatrixName Ny_NAME
Ny variable name.
Definition: MatrixNames.h:73
THDF5_File::WriteScalarValue
void WriteScalarValue(const hid_t parentGroup, TMatrixName &datasetName, const float value)
Write the scalar value under a specified group, float value.
Definition: HDF5_File.cpp:748
TParameters::pml_z_alpha
float pml_z_alpha
pml_z_alpha value.
Definition: Parameters.h:375
u_source_index_NAME
TMatrixName u_source_index_NAME
u_source_index variable name
Definition: MatrixNames.h:148
absorbing_flag_NAME
TMatrixName absorbing_flag_NAME
absorbing_flag variable name
Definition: MatrixNames.h:159
p_source_mode_NAME
TMatrixName p_source_mode_NAME
p_source_mode variable name
Definition: MatrixNames.h:140
TParameters::BonA_scalar
float BonA_scalar
BonA_scalar value.
Definition: Parameters.h:395
TParameters::alpha_power
float alpha_power
alpha_power value.
Definition: Parameters.h:311
TParameters::parametersSingleInstance
static TParameters * parametersSingleInstance
singleton instance
Definition: Parameters.h:411
OUT_FMT_GIT_HASH_LEFT
TOutputMessage OUT_FMT_GIT_HASH_LEFT
Output message.
Definition: OutputMessagesLinux.h:167
Parameters.h
The header file containing the parameters of the simulation.
THDF5_File::IsOpen
bool IsOpen() const
Is the file opened?
Definition: HDF5_File.h:545
pml_y_size_NAME
TMatrixName pml_y_size_NAME
pml_y_size variable name
Definition: MatrixNames.h:94
TParameters::nonuniform_grid_flag
size_t nonuniform_grid_flag
nonuniform_grid_flag value.
Definition: Parameters.h:357
ux_source_flag_NAME
TMatrixName ux_source_flag_NAME
ux_source_flag variable name
Definition: MatrixNames.h:121
TParameters::dt
float dt
dt value.
Definition: Parameters.h:300
TLogger::FULL
Full level of verbosity.
Definition: Logger.h:67
THDF5_File::GetDatasetDimensionSizes
TDimensionSizes GetDatasetDimensionSizes(const hid_t parentGroup, TMatrixName &datasetName)
Get dimension sizes of the dataset under a specified group.
Definition: HDF5_File.cpp:949
TParameters::uz_source_flag
size_t uz_source_flag
uz_source_flag value.
Definition: Parameters.h:337
sensor_mask_corners_NAME
TMatrixName sensor_mask_corners_NAME
sensor_mask_corners variable name
Definition: MatrixNames.h:170
THDF5_FileHeader::GetCurrentHDF5_MajorVersion
static std::string GetCurrentHDF5_MajorVersion()
Get string version of current Major version.
Definition: HDF5_File.h:821
TParameters::inputFile
THDF5_File inputFile
Handle to the input HDF5 file.
Definition: Parameters.h:285
p0_source_flag_NAME
TMatrixName p0_source_flag_NAME
p0_source_flag variable name
Definition: MatrixNames.h:135
TParameters::pml_y_alpha
float pml_y_alpha
pml_y_alpha value.
Definition: Parameters.h:373
TCUDAParameters::GetDeviceName
std::string GetDeviceName() const
Get the name of the device used.
Definition: CUDAParameters.cpp:73
ERR_FMT_ILLEGAL_ALPHA_POWER_VALUE
TErrorMessage ERR_FMT_ILLEGAL_ALPHA_POWER_VALUE
Command line parameters error message.
Definition: ErrorMessages.h:195
TCUDAParameters::SelectDevice
void SelectDevice(const int DeviceIdx=DEFAULT_DEVICE_IDX)
Select cuda device for execution.
Definition: CUDAParameters.cpp:90
TParameters::absorbing_flag
size_t absorbing_flag
absorbing_flag value.
Definition: Parameters.h:359
TCommandLineParameters::GetCUDADeviceIdx
int GetCUDADeviceIdx() const
Get GPU device ID specified by the user (not necessary the one the code runs on). ...
Definition: CommandLineParameters.h:230
TParameters::~TParameters
virtual ~TParameters()
Destructor.
Definition: Parameters.cpp:88
dx_NAME
TMatrixName dx_NAME
dx variable name
Definition: MatrixNames.h:54
TParameters::GetFullDimensionSizes
TDimensionSizes GetFullDimensionSizes() const
Full dimension sizes of the simulation (real classes).
Definition: Parameters.h:95
TParameters::outputFile
THDF5_File outputFile
Handle to the output HDF5 file.
Definition: Parameters.h:287
TParameters::TParameters
TParameters()
Constructor.
Definition: Parameters.cpp:533
Logger.h
The header file containing a class responsible for printing out info and error messages (stdout...
TCommandLineParameters::IsBenchmarkFlag
bool IsBenchmarkFlag() const
Is –benchmark flag set?
Definition: CommandLineParameters.h:233
pml_z_alpha_NAME
TMatrixName pml_z_alpha_NAME
pml_z_alpha variable name
Definition: MatrixNames.h:118
TLogger::Flush
static void Flush(const TLogLevel queryLevel)
Flush output messages.
Definition: Logger.cpp:109
TParameters::sensor_mask_ind_size
size_t sensor_mask_ind_size
sensor_mask_ind_size value.
Definition: Parameters.h:321
TParameters::c0_scalar
float c0_scalar
c0_scalar value.
Definition: Parameters.h:385
TParameters::sensor_mask_corners_size
size_t sensor_mask_corners_size
sensor_mask_corners_size - how many cuboids are in the mask.
Definition: Parameters.h:323
THDF5_File::ReadScalarValue
void ReadScalarValue(const hid_t parentGroup, TMatrixName &datasetName, float &value)
Read the scalar value under a specified group, float value.
Definition: HDF5_File.cpp:855
TParameters::SelectDevice
void SelectDevice()
Select cuda device for execution.
Definition: Parameters.cpp:144
TParameters::IsStore_u_non_staggered_raw
bool IsStore_u_non_staggered_raw() const
Is –u_non_staggered_raw set?
Definition: Parameters.h:252
c0_NAME
TMatrixName c0_NAME
c0 variable name
Definition: MatrixNames.h:63
rho0_sgx_NAME
TMatrixName rho0_sgx_NAME
rho0_sgx variable name
Definition: MatrixNames.h:253
THDF5_FileHeader::ReadHeaderFromInputFile
void ReadHeaderFromInputFile(THDF5_File &inputFile)
Read header from the input file.
Definition: HDF5_File.cpp:1241
TParameters::dx
float dx
dx value.
Definition: Parameters.h:302
TParameters
Class storing all parameters of the simulation.
Definition: Parameters.h:49
TParameters::nt
size_t nt
Nt value.
Definition: Parameters.h:295
TParameters::PrintSimulatoinSetup
void PrintSimulatoinSetup()
Print the simulation setup (all parameters)
Definition: Parameters.cpp:167
TParameters::rho0_sgz_scalar
float rho0_sgz_scalar
rho0_sgz_scalar value.
Definition: Parameters.h:406
ERR_FMT_BAD_INPUT_FILE_FORMAT
TErrorMessage ERR_FMT_BAD_INPUT_FILE_FORMAT
Command line parameters error message.
Definition: ErrorMessages.h:202
TParameters::uy_source_flag
size_t uy_source_flag
uy_source_flag value.
Definition: Parameters.h:335
THDF5_File::GetRootGroup
hid_t GetRootGroup() const
Get handle to the root group.
Definition: HDF5_File.h:573
MatrixNames.h
The header file storing names of all variables/matrices/output streams used in the simulation...
TCommandLineParameters::GetBenchmarkTimeStepsCount
size_t GetBenchmarkTimeStepsCount() const
Get benchmark time step count.
Definition: CommandLineParameters.h:237
OUT_FMT_SELECTED_DEVICE
TOutputMessage OUT_FMT_SELECTED_DEVICE
Output message.
Definition: OutputMessagesLinux.h:141
dz_NAME
TMatrixName dz_NAME
dz variable name
Definition: MatrixNames.h:58
TDimensionSizes::ny
size_t ny
number of elements in the y direction
Definition: DimensionSizes.h:147
uy_source_flag_NAME
TMatrixName uy_source_flag_NAME
uy_source_flag variable name
Definition: MatrixNames.h:123
uz_source_flag_NAME
TMatrixName uz_source_flag_NAME
uz_source_flag variable name
Definition: MatrixNames.h:125
Nz_NAME
TMatrixName Nz_NAME
Nz variable name.
Definition: MatrixNames.h:75
TParameters::t_index
size_t t_index
actual time index (time step of the simulation).
Definition: Parameters.h:297
TCUDAParameters::GetDeviceIdx
int GetDeviceIdx() const
Get Idx of the device being used.
Definition: CUDAParameters.h:57
OUT_FMT_NUMBER_OF_THREADS
TOutputMessage OUT_FMT_NUMBER_OF_THREADS
Output message.
Definition: OutputMessagesLinux.h:75
TLogger::BASIC
Basic (default) level of verbosity.
Definition: Logger.h:63
u_source_many_NAME
TMatrixName u_source_many_NAME
u_source_many variable name
Definition: MatrixNames.h:128
TParameters::pml_x_size
size_t pml_x_size
pml_x_size value.
Definition: Parameters.h:364
pml_x_alpha_NAME
TMatrixName pml_x_alpha_NAME
pml_x_alpha variable name
Definition: MatrixNames.h:114
Nx_NAME
TMatrixName Nx_NAME
Nx variable name.
Definition: MatrixNames.h:71
pml_x_size_NAME
TMatrixName pml_x_size_NAME
pml_x_size variable name
Definition: MatrixNames.h:92
TParameters::dy
float dy
dy value.
Definition: Parameters.h:304
alpha_coeff_NAME
TMatrixName alpha_coeff_NAME
alpha_coeff variable name
Definition: MatrixNames.h:68
TParameters::SaveScalarsToFile
void SaveScalarsToFile(THDF5_File &outputFile)
Save scalar values into the output HDF5 file.
Definition: Parameters.cpp:432
THDF5_FileHeader::CheckMajorFileVersion
bool CheckMajorFileVersion()
Check major file version.
Definition: HDF5_File.h:862
TParameters::fileHeader
THDF5_FileHeader fileHeader
Handle to file header.
Definition: Parameters.h:292
OUT_FMT_DEVICE_ID
TOutputMessage OUT_FMT_DEVICE_ID
Output message.
Definition: OutputMessagesLinux.h:144
ERR_FMT_BAD_MINOR_FILE_VERSION
TErrorMessage ERR_FMT_BAD_MINOR_FILE_VERSION
Command line parameters error message.
Definition: ErrorMessages.h:208
THDF5_FileHeader::CheckMinorFileVersion
bool CheckMinorFileVersion()
Check minor file version.
Definition: HDF5_File.h:872
OUT_FMT_READING_CONFIGURATION
TOutputMessage OUT_FMT_READING_CONFIGURATION
Output message.
Definition: OutputMessagesLinux.h:138
THDF5_FileHeader::GetFileType
THDF5_FileHeader::TFileType GetFileType()
Get File type.
Definition: HDF5_File.cpp:1472
TParameters::p0_source_flag
size_t p0_source_flag
p0_source_flag value.
Definition: Parameters.h:342
TParameters::Init
void Init(int argc, char **argv)
Parse command line and read scalar values to init the class.
Definition: Parameters.cpp:106
THDF5_FileHeader::GetFileVersion
TFileVersion GetFileVersion()
Set major file version in a string.
Definition: HDF5_File.cpp:1447
TParameters::pml_z_size
size_t pml_z_size
pml_z_size value.
Definition: Parameters.h:368
TParameters::rho0_scalar
float rho0_scalar
rho0_scalar value.
Definition: Parameters.h:400
TParameters::rho0_sgx_scalar
float rho0_sgx_scalar
rho0_sgx_scalar value.
Definition: Parameters.h:402
TParameters::sensor_mask_type
TSensorMaskType sensor_mask_type
sensor mask type (0 = index, 1 = corners).
Definition: Parameters.h:319
TLogger::FormatMessage
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
TParameters::p_source_index_size
size_t p_source_index_size
p_source_index_size value.
Definition: Parameters.h:328
TParameters::rho0_scalar_flag
bool rho0_scalar_flag
rho0_scalar_flag value.
Definition: Parameters.h:398
TParameters::checkpointFile
THDF5_File checkpointFile
Handle to the checkpoint HDF5 file.
Definition: Parameters.h:289
TParameters::absorb_tau_scalar
float absorb_tau_scalar
absorb_tau_scalar value.
Definition: Parameters.h:390
ERR_FMT_BAD_MAJOR_File_Version
TErrorMessage ERR_FMT_BAD_MAJOR_File_Version
Command line parameters error message.
Definition: ErrorMessages.h:205
nonuniform_grid_flag_NAME
TMatrixName nonuniform_grid_flag_NAME
nonuniform_grid_flag variable name
Definition: MatrixNames.h:157
p_source_many_NAME
TMatrixName p_source_many_NAME
p_source_many variable name
Definition: MatrixNames.h:130
TLogger::ADVANCED
Advanced level of verbosity.
Definition: Logger.h:65
TParameters::commandLineParameters
TCommandLineParameters commandLineParameters
Class with command line parameters.
Definition: Parameters.h:282
TParameters::fullDimensionSizes
TDimensionSizes fullDimensionSizes
Full 3D dimension sizes.
Definition: Parameters.h:314
TParameters::p_source_many
size_t p_source_many
p_source_many value.
Definition: Parameters.h:354
TDimensionSizes::nz
size_t nz
number of elements in the z direction
Definition: DimensionSizes.h:149
TLogger::Log
static void Log(const TLogLevel queryLevel, const std::string &format, Args...args)
Log desired activity for a given log level, version with string format.
Definition: Logger.h:85
OUT_FMT_SEPARATOR
TOutputMessage OUT_FMT_SEPARATOR
Output message - separator.
Definition: OutputMessagesLinux.h:49
OUT_FMT_DOMAIN_SIZE_FORMAT
TOutputMessage OUT_FMT_DOMAIN_SIZE_FORMAT
Output message.
Definition: OutputMessagesLinux.h:153
ERR_FMT_BAD_SENSOR_MASK_TYPE
TErrorMessage ERR_FMT_BAD_SENSOR_MASK_TYPE
Command line parameters error message.
Definition: ErrorMessages.h:211
THDF5_File::GetDatasetElementCount
size_t GetDatasetElementCount(const hid_t parentGroup, TMatrixName &datasetName)
Get dataset element count under a specified group.
Definition: HDF5_File.cpp:1006
TParameters::u_source_many
size_t u_source_many
u_source_many value.
Definition: Parameters.h:347
OUT_FMT_SENSOR_MASK_CUBOID
TOutputMessage OUT_FMT_SENSOR_MASK_CUBOID
Output message.
Definition: OutputMessagesLinux.h:164
TCommandLineParameters::IsVersion
bool IsVersion() const
Is –version flag set?
Definition: CommandLineParameters.h:235
TParameters::rho0_sgy_scalar
float rho0_sgy_scalar
rho0_sgy_scalar value.
Definition: Parameters.h:404
TParameters::pml_y_size
size_t pml_y_size
pml_y_size value.
Definition: Parameters.h:366
rho0_sgy_NAME
TMatrixName rho0_sgy_NAME
rho0_sgy variable name
Definition: MatrixNames.h:255
TCommandLineParameters::GetStartTimeIndex
size_t GetStartTimeIndex() const
Get start time index when sensor data collection begins.
Definition: CommandLineParameters.h:246
TParameters::Get_nt
size_t Get_nt() const
Get Nt value.
Definition: Parameters.h:100
TParameters::GetGitHash
std::string GetGitHash() const
Get Git hash of the code.
Definition: Parameters.cpp:513
TParameters::alpha_coeff_scalar
float alpha_coeff_scalar
alpha_coeff_scalar value.
Definition: Parameters.h:380
TParameters::Get_sensor_mask_type
TSensorMaskType Get_sensor_mask_type() const
Get sensor mask type (linear or corners).
Definition: Parameters.h:166
TParameters::IsCopySensorMask
bool IsCopySensorMask() const
is –copy_mask set
Definition: Parameters.h:267
rho0_NAME
TMatrixName rho0_NAME
rho0 variable name
Definition: MatrixNames.h:251
TCommandLineParameters::ParseCommandLine
void ParseCommandLine(int argc, char **argv)
Parse command line.
Definition: CommandLineParameters.cpp:256
THDF5_File
Class wrapping the HDF5 routines.
Definition: HDF5_File.h:500
Nt_NAME
TMatrixName Nt_NAME
Nt variable name.
Definition: MatrixNames.h:48
TDimensionSizes
Structure with 4D dimension sizes (3 in space and 1 in time).
Definition: DimensionSizes.h:66
OUT_FMT_DONE
TOutputMessage OUT_FMT_DONE
Output message - Done with two spaces.
Definition: OutputMessagesLinux.h:59
sensor_mask_type_NAME
TMatrixName sensor_mask_type_NAME
sensor_mask_type variable name
Definition: MatrixNames.h:168