42 #include <GetoptWin64/Getopt.h>
68 InputFileName(
""), OutputFileName (
""), CheckpointFileName(
""),
70 NumberOfThreads(omp_get_num_procs()),
74 VerboseInterval(DefaultVerboseInterval), CompressionLevel (DefaultCompressionLevel),
75 BenchmarkFlag (false), BenchmarkTimeStepsCount(0), CheckpointInterval(0),
77 Store_p_raw(false), Store_p_rms(false), Store_p_max(false), Store_p_min(false),
78 Store_p_max_all(false), Store_p_min_all(false), Store_p_final(false),
79 Store_u_raw(false), Store_u_non_staggered_raw(false),
80 Store_u_rms(false), Store_u_max(false), Store_u_min(false),
81 Store_u_max_all(false), Store_u_min_all(false), Store_u_final(false),
82 CopySensorMask(false),
94 printf(
"---------------------------------- Usage ---------------------------------\n");
95 printf(
"Mandatory parameters:\n");
96 printf(
" -i <input_file_name> : HDF5 input file\n");
97 printf(
" -o <output_file_name> : HDF5 output file\n");
99 printf(
"Optional parameters: \n");
102 printf(
" -t <num_threads> : Number of CPU threads\n");
103 printf(
" (default = %d)\n", omp_get_num_procs());
106 printf(
" -r <interval_in_%%> : Progress print interval\n");
108 printf(
" -c <comp_level> : Output file compression level <0,9>\n");
110 printf(
" --benchmark <steps> : Run a specified number of time steps\n");
112 printf(
" --checkpoint_file <file_name> : HDF5 Checkpoint file\n");
113 printf(
" --checkpoint_interval <seconds> : Stop after a given number of seconds and\n");
114 printf(
" store the actual state\n");
116 printf(
" -h : Print help\n");
117 printf(
" --help : Print help\n");
118 printf(
" --version : Print version\n");
120 printf(
"Output flags:\n");
121 printf(
" -p : Store acoustic pressure \n");
122 printf(
" (default if nothing else is on)\n");
123 printf(
" (the same as --p_raw)\n");
124 printf(
" --p_raw : Store raw time series of p (default)\n");
125 printf(
" --p_rms : Store rms of p\n");
126 printf(
" --p_max : Store max of p\n");
127 printf(
" --p_min : Store min of p\n");
128 printf(
" --p_max_all : Store max of p (whole domain)\n");
129 printf(
" --p_min_all : Store min of p (whole domain)\n");
130 printf(
" --p_final : Store final pressure field \n");
132 printf(
" -u : Store ux, uy, uz\n");
133 printf(
" (the same as --u_raw)\n");
134 printf(
" --u_raw : Store raw time series of ux, uy, uz\n");
135 printf(
" --u_non_staggered_raw : Store non-staggered raw time series of\n");
136 printf(
" ux, uy, uz \n");
137 printf(
" --u_rms : Store rms of ux, uy, uz\n");
138 printf(
" --u_max : Store max of ux, uy, uz\n");
139 printf(
" --u_min : Store min of ux, uy, uz\n");
140 printf(
" --u_max_all : Store max of ux, uy, uz (whole domain)\n");
141 printf(
" --u_min_all : Store min of ux, uy, uz (whole domain)\n");
142 printf(
" --u_final : Store final acoustic velocity\n");
144 printf(
" --copy_sensor_mask : Copy sensor mask to the output file\n");
146 printf(
" -s <timestep> : Time step when data collection begins\n");
147 printf(
" (default = 1)\n");
148 printf(
"--------------------------------------------------------------------------\n");
160 printf(
"List of enabled parameters:\n");
208 bool CheckpointFlag =
false;
211 const char * shortOpts =
"i:o:r:c:t:puhs:";
213 const char * shortOpts =
"i:o:r:c:puIhs:";
216 const struct option longOpts[] =
218 {
"benchmark", required_argument, NULL, 0},
219 {
"help", no_argument, NULL,
'h'},
220 {
"version", no_argument, NULL, 0},
221 {
"checkpoint_file" , required_argument, NULL, 0 },
222 {
"checkpoint_interval", required_argument, NULL, 0 },
224 {
"p_raw", no_argument, NULL,
'p'},
225 {
"p_rms", no_argument, NULL, 0},
226 {
"p_max", no_argument, NULL, 0},
227 {
"p_min", no_argument, NULL, 0},
228 {
"p_max_all", no_argument, NULL, 0},
229 {
"p_min_all", no_argument, NULL, 0},
230 {
"p_final", no_argument, NULL, 0},
232 {
"u_raw", no_argument, NULL,
'u'},
233 {
"u_non_staggered_raw", no_argument, NULL, 0},
234 {
"u_rms", no_argument, NULL, 0},
235 {
"u_max", no_argument, NULL, 0},
236 {
"u_min", no_argument, NULL, 0},
237 {
"u_max_all", no_argument, NULL, 0},
238 {
"u_min_all", no_argument, NULL, 0},
239 {
"u_final", no_argument, NULL, 0},
241 {
"copy_sensor_mask", no_argument, NULL, 0},
242 { NULL, no_argument, NULL, 0}
247 while ((c = getopt_long (argc, argv, shortOpts, longOpts, &longIndex )) != -1)
265 if ((optarg == NULL) || (atol(optarg) <= 0))
279 if ((optarg == NULL) || (atol(optarg) <= 0))
293 if ((optarg == NULL) || (atol(optarg) < 0) || atol(optarg) > 9)
325 if ((optarg == NULL) || (atol(optarg) < 1))
337 if( strcmp(
"benchmark", longOpts[longIndex].name ) == 0 )
340 if ((optarg == NULL) || (atol(optarg) <= 0))
350 else if( strcmp(
"checkpoint_file", longOpts[longIndex].name ) == 0 )
352 CheckpointFlag =
true;
353 if ((optarg == NULL))
363 else if( strcmp(
"checkpoint_interval", longOpts[longIndex].name ) == 0 )
365 CheckpointFlag = true ;
366 if ((optarg == NULL) || (atol(optarg) <= 0))
376 else if (strcmp(
"version", longOpts[longIndex].name) == 0)
383 else if (strcmp(
"p_rms", longOpts[longIndex].name) == 0)
387 else if (strcmp(
"p_max", longOpts[longIndex].name) == 0)
391 else if (strcmp(
"p_min", longOpts[longIndex].name) == 0)
395 else if (strcmp(
"p_max_all", longOpts[longIndex].name) == 0)
399 else if (strcmp(
"p_min_all", longOpts[longIndex].name) == 0)
403 else if (strcmp(
"p_final", longOpts[longIndex].name) == 0)
409 else if (strcmp(
"u_non_staggered_raw", longOpts[longIndex].name) == 0)
413 else if (strcmp(
"u_rms", longOpts[longIndex].name) == 0)
417 else if (strcmp(
"u_max", longOpts[longIndex].name) == 0)
421 else if (strcmp(
"u_min", longOpts[longIndex].name) == 0)
425 else if (strcmp(
"u_max_all", longOpts[longIndex].name) == 0)
429 else if (strcmp(
"u_min_all", longOpts[longIndex].name) == 0)
433 else if (strcmp(
"u_final", longOpts[longIndex].name) == 0)
438 else if (strcmp(
"copy_sensor_mask", longOpts[longIndex].name) == 0)
std::string OutputFileName
Output file name.
bool Store_u_raw
Store_u_raw value.
void PrintUsageAndExit()
Print usage and exit.
size_t CompressionLevel
CompressionLevel value.
const char *const CommandlineParameters_ERR_FMT_NoCheckpointFile
Command line parameters error message.
const char *const CommandlineParameters_ERR_FMT_NoInputFile
Command line parameters error message.
bool Store_u_min
Store_u_min value.
bool Store_u_max
Store_u_max value.
size_t VerboseInterval
VerboseInterval value.
bool Store_u_non_staggered_raw
Store_u_non_staggered_raw value.
bool Store_p_max
Store_p_max value.
bool Store_p_min_all
Store_p_min_all value.
const char *const CommandlineParameters_ERR_FMT_NoThreadNumbers
Command line parameters error message.
void PrintSetup()
Print setup.
bool Store_p_raw
Store_p_raw value.
bool Store_u_final
Store_u_final value.
const char *const CommandlineParameters_ERR_FMT_NoVerboseIntreval
Command line parameters error message.
bool Store_p_min
Store_p_min value.
The header file containing all error messages of the project.
std::string InputFileName
Input file name.
bool Store_p_max_all
Store_p_max_all value.
TCommandLineParameters()
Constructor.
bool Store_u_rms
Store_u_rms value.
bool BenchmarkFlag
BenchmarkFlag value.
bool Store_p_final
Store_p_final value.
size_t StartTimeStep
StartTimeStep value.
const char *const CommandlineParameters_ERR_FMT_NoStartTimestep
Command line parameters error message.
const char *const CommandlineParameters_ERR_FMT_NoCheckpointInterval
Command line parameters error message.
const char *const CommandlineParameters_ERR_FMT_NoOutputFile
Command line parameters error message.
bool Store_u_min_all
Store_u_min_all value.
The header file containing the command line parameters.
std::string CheckpointFileName
Checkpoint file name.
static const size_t DefaultCompressionLevel
Default compression level.
bool CopySensorMask
Copy sensor mask to the output file.
const char *const CommandlineParameters_ERR_FMT_NoBenchmarkTimeStepCount
Command line parameters error message.
bool Store_u_max_all
Store_u_max_all value.
size_t BenchmarkTimeStepsCount
BenchmarkTimeStepsCount value.
bool PrintVersion
PrintVersion value.
size_t CheckpointInterval
Checkpoint interval in seconds.
const char *const CommandlineParameters_ERR_FMT_NoCompressionLevel
Command line parameters error message.
static const size_t DefaultVerboseInterval
Default verbose interval.
bool Store_p_rms
Store_p_rms value.
void ParseCommandLine(int argc, char **argv)
Parse command line.
size_t NumberOfThreads
NumberOfThreads value.