76 if(!ParametersInstanceFlag)
79 ParametersInstanceFlag =
true;
80 return ParametersSingleInstance;
84 return ParametersSingleInstance;
96 CommandLinesParameters.ParseCommandLine(argc, argv);
98 if (CommandLinesParameters.IsVersion())
103 ReadScalarsFromHDF5InputFile(HDF5_InputFile);
105 if (CommandLinesParameters.IsBenchmarkFlag())
107 Nt = CommandLinesParameters.GetBenchmarkTimeStepsCount();
110 if ((Nt <= (
size_t) CommandLinesParameters.GetStartTimeIndex()) ||
111 ( 0 > CommandLinesParameters.GetStartTimeIndex()) )
114 CommandLinesParameters.PrintUsageAndExit();
135 HDF5_InputFile.
Open(CommandLinesParameters.GetInputFileName().c_str());
137 catch (ios::failure e)
139 fprintf(stderr,
"%s", e.what());
144 HDF5_FileHeader.ReadHeaderFromInputFile(HDF5_InputFile);
147 if (HDF5_FileHeader.GetFileType() != THDF5_FileHeader::hdf5_ft_input)
149 char ErrorMessage[256] =
"";
151 throw ios::failure(ErrorMessage);
155 if (!HDF5_FileHeader.CheckMajorFileVersion())
157 char ErrorMessage[256] =
"";
159 HDF5_FileHeader.GetCurrentHDF5_MajorVersion().c_str());
160 throw ios::failure(ErrorMessage);
163 if (!HDF5_FileHeader.CheckMinorFileVersion())
165 char ErrorMessage[256] =
"";
167 HDF5_FileHeader.GetCurrentHDF5_MinorVersion().c_str());
168 throw ios::failure(ErrorMessage);
171 const hid_t HDF5RootGroup = HDF5_InputFile.
GetRootGroup();
195 FullDimensionSizes.X = X;
196 FullDimensionSizes.Y = Y;
197 FullDimensionSizes.Z = Z;
199 ReducedDimensionSizes.X = ((X / 2) + 1);
200 ReducedDimensionSizes.Y = Y;
201 ReducedDimensionSizes.Z = Z;
204 if (HDF5_FileHeader.GetFileVersion() == THDF5_FileHeader::hdf5_fv_10)
209 if (IsStore_u_non_staggered_raw())
216 if (HDF5_FileHeader.GetFileVersion() == THDF5_FileHeader::hdf5_fv_11)
220 size_t SensorMaskTypeNumericalue = 0;
224 switch (SensorMaskTypeNumericalue)
226 case 0: sensor_mask_type = smt_index;
228 case 1: sensor_mask_type = smt_corners;
238 switch (sensor_mask_type)
271 if (transducer_source_flag == 0)
273 transducer_source_input_size = 0;
280 if ((transducer_source_flag > 0) || (ux_source_flag > 0) || (uy_source_flag > 0) || (uz_source_flag > 0))
287 if ((ux_source_flag > 0) || (uy_source_flag > 0) || (uz_source_flag > 0))
299 if (p_source_flag != 0)
310 p_source_index_size = 0;
315 if (absorbing_flag != 0)
318 if (alpha_power == 1.0f)
325 if (alpha_coeff_scalar_flag)
341 if (BonA_scalar_flag)
348 if (rho0_scalar_flag)
364 const hid_t HDF5RootGroup = HDF5_OutputFile.
GetRootGroup();
402 if ((ux_source_flag > 0) || (uy_source_flag > 0) || (uz_source_flag > 0))
409 if (p_source_flag != 0)
416 if (absorbing_flag != 0)
422 if (IsCopySensorMask())
424 size_t SensorMaskTypeNumericValue = 0;
426 switch (sensor_mask_type)
428 case smt_index: SensorMaskTypeNumericValue = 0;
430 case smt_corners: SensorMaskTypeNumericValue = 1;
451 HDF5_InputFile(), HDF5_OutputFile(), HDF5_CheckpointFile(), HDF5_FileHeader(),
452 CommandLinesParameters(),
453 Nt(0), t_index(0), dt(0.0f),
454 dx(0.0f), dy(0.0f), dz(0.0f),
455 c_ref(0.0f), alpha_power(0.0f),
456 FullDimensionSizes(0,0,0), ReducedDimensionSizes(0,0,0),
457 sensor_mask_ind_size (0), u_source_index_size(0), p_source_index_size(0), transducer_source_input_size(0),
458 ux_source_flag(0), uy_source_flag(0), uz_source_flag(0),
459 p_source_flag(0), p0_source_flag(0), transducer_source_flag(0),
460 u_source_many(0), u_source_mode(0), p_source_mode(0), p_source_many(0),
461 nonuniform_grid_flag(0), absorbing_flag(0), nonlinear_flag(0),
462 pml_x_size(0), pml_y_size(0), pml_z_size(0),
463 alpha_coeff_scalar_flag(false), alpha_coeff_scalar(0.0f),
464 c0_scalar_flag(false), c0_scalar(0.0f),
465 absorb_eta_scalar(0.0f), absorb_tau_scalar (0.0f),
466 BonA_scalar_flag(false), BonA_scalar (0.0f),
467 rho0_scalar_flag(false), rho0_scalar(0.0f), rho0_sgx_scalar(0.0f), rho0_sgy_scalar(0.0f), rho0_sgz_scalar(0.0f)
void ParseCommandLine(int argc, char **argv)
Parse command line.
const char *const transducer_source_input_Name
transducer_source_input variable name
void PrintUsageAndExit()
Print usage and exit.
const char *const u_source_many_Name
u_source_many variable name
const char *const uz_source_flag_Name
uz_source_flag variable name
const char *const Parameters_ERR_FMT_IncorrectMajorHDF5FileVersion
Command line parameters error message.
void SaveScalarsToHDF5File(THDF5_File &HDF5_OutputFile)
Save scalars into the output HDF5 file.
const char *const Parameters_ERR_FMT_WrongSensorMaskType
Command line parameters error message.
const char *const uy_source_flag_Name
uy_source_flag variable name
void WriteScalarValue(const hid_t ParentGroup, const char *DatasetName, const float Value)
Write the scalar value under a specified group - float value.
const char *const p_source_flag_Name
p_source_flag variable name
const char *const Parameters_ERR_FMT_UNonStaggeredNotSupportedForFile10
Command line parameters error message.
const char *const pml_x_size_Name
pml_x_size variable name
const char *const Ny_Name
Ny variable name.
const char *const rho0_Name
rho0 variable name
const char *const Parameters_ERR_FMT_IncorrectInputFileFormat
Command line parameters error message.
bool IsOpened() const
Is the file opened?
const char *const BonA_Name
BonA variable name.
void ReadScalarValue(const hid_t ParentGroup, const char *DatasetName, float &Value)
Read the scalar value under a specified group - float value.
TCommandLineParameters CommandLinesParameters
Class with commandline parameters.
static TParameters * ParametersSingleInstance
singleton instance.
const char *const absorbing_flag_Name
absorbing_flag variable name
The header file containing the parameters of the simulation.
const char *const pml_y_size_Name
pml_y_size variable name
TDimensionSizes GetDatasetDimensionSizes(const hid_t ParentGroup, const char *DatasetName)
Get dimension sizes of the dataset under a specified group.
const char *const alpha_coeff_Name
alpha_coeff variable name
size_t GetDatasetElementCount(const hid_t ParentGroup, const char *DatasetName)
Get dataset element count under a specified group.
const char *const c0_Name
c0 variable name
const char *const Nx_Name
Nx variable name.
const char *const rho0_sgy_Name
rho0_sgy variable name
TParameters()
Constructor not allowed for public.
const char *const dz_Name
dz variable name
const char *const p_source_mode_Name
p_source_mode variable name
const char *const pml_z_alpha_Name
pml_z_alpha variable name
Class storing all parameters of the simulation.
const char *const u_source_mode_Name
u_source_mode variable name
hid_t GetRootGroup() const
Get handle to the root group.
The header file storing names of all variables.
const char *const dt_Name
dt variable name
The header file containing all error messages of the project.
void Open(const char *FileName, unsigned int Flags=H5F_ACC_RDONLY)
Open the file.
const char *const pml_y_alpha_Name
pml_y_alpha variable name
const char *const nonlinear_flag_Name
nonlinear_flag variable name
const char *const transducer_source_flag_Name
transducer_source_flag variable name
const char *const Parameters_ERR_FMT_Illegal_alpha_power_value
Command line parameters error message.
const char *const pml_z_size_Name
pml_z_size variable name
static bool ParametersInstanceFlag
singleton flag.
size_t Y
Y dimension size.
const char *const c_ref_Name
c_ref variable name
const char *const nonuniform_grid_flag_Name
nonuniform_grid_flag variable name
const char *const dx_Name
dx variable name
const char *const sensor_mask_corners_Name
sensor_mask_corners variable name
const char *const p_source_many_Name
p_source_many variable name
const char *const dy_Name
dy variable name
void ReadScalarsFromHDF5InputFile(THDF5_File &HDF5_InputFile)
Read scalar values from the input HDF5 file.
void PrintUsageAndExit()
Print usage and exit.
const char *const u_source_index_Name
u_source_index variable name
const char *const Parameters_ERR_FMT_IncorrectMinorHDF5FileVersion
Command line parameters error message.
const char *const rho0_sgz_Name
rho0_sgz variable name
const char *const rho0_sgx_Name
rho0_sgx variable name
const char *const p_source_index_Name
p_source_index variable name
const char *const Nz_Name
Nz variable name.
const char *const sensor_mask_index_Name
sensor_mask_index variable name
const char *const Nt_Name
Nt variable name.
const char *const p0_source_flag_Name
p0_source_flag variable name
const char *const ux_source_flag_Name
ux_source_flag variable name
const char *const pml_x_alpha_Name
pml_x_alpha variable name
const char *const sensor_mask_type_Name
sensor_mask_type variable name
Class wrapping the HDF5 routines.
Structure with 4D dimension sizes (3 in space and 1 in time).
const char *const Parameters_ERR_FMT_Illegal_StartTime_value
Command line parameters error message.
const char *const alpha_power_Name
alpha_power variable name
static TParameters * GetInstance()
Get instance of the singleton class.