40 #include <GetoptWin64/Getopt.h> 119 string sampledQuantitiesList =
"";
124 sampledQuantitiesList +=
"p_raw, ";
128 sampledQuantitiesList +=
"p_rms, ";
132 sampledQuantitiesList +=
"p_max, ";
136 sampledQuantitiesList +=
"p_min, ";
140 sampledQuantitiesList +=
"p_max_all, ";
144 sampledQuantitiesList +=
"p_min_all, ";
148 sampledQuantitiesList +=
"p_final, ";
154 sampledQuantitiesList +=
"u_raw, ";
158 sampledQuantitiesList +=
"u_rms, ";
162 sampledQuantitiesList +=
"u_max, ";
166 sampledQuantitiesList +=
"u_min, ";
170 sampledQuantitiesList +=
"u_max_all, ";
174 sampledQuantitiesList +=
"u_min_all, ";
178 sampledQuantitiesList +=
"u_final, ";
183 sampledQuantitiesList +=
"u_non_staggered_raw, ";
187 if (sampledQuantitiesList.length() > 0)
189 sampledQuantitiesList.pop_back();
190 sampledQuantitiesList.pop_back();
214 bool checkpointFlag =
false;
216 constexpr
int errorLineIndent = 9;
221 const char* shortOpts =
"i:o:r:c:t:puhs:";
223 const char* shortOpts =
"i:o:r:c:puhs:";
226 const struct option longOpts[] =
228 {
"benchmark", required_argument,
nullptr, 1 },
229 {
"copy_sensor_mask", no_argument,
nullptr, 2 },
230 {
"checkpoint_file" , required_argument,
nullptr, 3 },
231 {
"checkpoint_interval", required_argument,
nullptr, 4 },
232 {
"help", no_argument,
nullptr,
'h'},
233 {
"verbose", required_argument,
nullptr, 5 },
234 {
"version", no_argument,
nullptr, 6 },
236 {
"p_raw", no_argument,
nullptr,
'p' },
237 {
"p_rms", no_argument,
nullptr, 10 },
238 {
"p_max", no_argument,
nullptr, 11 },
239 {
"p_min", no_argument,
nullptr, 12 },
240 {
"p_max_all", no_argument,
nullptr, 13 },
241 {
"p_min_all", no_argument,
nullptr, 14 },
242 {
"p_final", no_argument,
nullptr, 15 },
244 {
"u_raw", no_argument,
nullptr,
'u' },
245 {
"u_rms", no_argument,
nullptr, 20},
246 {
"u_max", no_argument,
nullptr, 21},
247 {
"u_min", no_argument,
nullptr, 22},
248 {
"u_max_all", no_argument,
nullptr, 23},
249 {
"u_min_all", no_argument,
nullptr, 24},
250 {
"u_final", no_argument,
nullptr, 25},
251 {
"u_non_staggered_raw", no_argument,
nullptr, 26},
253 {
nullptr, no_argument,
nullptr, 0}
261 while ((c = getopt_long (argc, argv, shortOpts, longOpts, &longIndex )) != -1)
269 if ((optarg !=
nullptr) &&
270 ((strlen(optarg) > 0) && (optarg[0] !=
'-')))
286 if ((optarg !=
nullptr) &&
287 ((strlen(optarg) > 0) && (optarg[0] !=
'-')))
303 int convertedValue = std::stoi(optarg);
304 if ((convertedValue < 1) || (convertedValue > 100))
306 throw std::invalid_argument(
"-r");
323 if (std::stoi(optarg) < 1)
325 throw std::invalid_argument(
"-t");
342 int covertedValue = std::stoi(optarg);
343 if ((covertedValue < 0) || (covertedValue > 9))
345 throw std::invalid_argument(
"-c");
367 if (std::stoll(optarg) < 1)
369 throw std::invalid_argument(
"-s");
386 if (std::stoll(optarg) <= 0)
388 throw std::invalid_argument(
"benchmark");
408 checkpointFlag =
true;
411 if ((optarg != NULL) &&
412 ((strlen(optarg) > 0) && (optarg[0] !=
'-')))
428 checkpointFlag =
true;
429 if (std::stoll(optarg) <= 0)
431 throw std::invalid_argument(
"checkpoint_interval");
447 int verboseLevel = std::stoi(optarg);
448 if ((verboseLevel < 0) || (verboseLevel > 2))
450 throw std::invalid_argument(
"verbose");
bool mStoreVelocityRmsFlag
Store RMS of velocity over the the sensor mask?
ErrorMessage kErrFmtInvalidNumberOfThreads
Command line parameters error message.
static void setLevel(const LogLevel actualLogLevel)
Set the log level.
OutputMessage kOutFmtUsagePart2
Usage massage.
static constexpr size_t kDefaultCompressionLevel
Default compression level.
OutputMessage kOutFmtUsagePart1
Usage massage.
bool mCopySensorMaskFlag
Copy sensor mask to the output file.
bool mStorePressureMinAllFlag
Store minimum of pressure over the whole domain?
ErrorMessage kErrFmtPathDelimiters
delimiters for linux paths
static void log(const LogLevel queryLevel, const std::string &format, Args ... args)
Log desired activity for a given log level, version with string format.
Advanced level of verbosity.
bool mStorePressureMinFlag
Store minimum of pressure over the sensor mask?
size_t mProgressPrintInterval
Progress interval value.
static std::string wordWrapString(const std::string &inputString, const std::string &delimiters, const int indentation=0, const int lineSize=65)
std::string mCheckpointFileName
Checkpoint file name.
OutputMessage kOutFmtCheckpointInterval
Output message.
void printUsage()
Print usage of the code.
ErrorMessage kErrFmtNoCompressionLevel
Command line parameters error message.
size_t mCheckpointInterval
Checkpoint interval in seconds.
ErrorMessage kErrFmtNoInputFile
Error message - input file was not specified.
ErrorMessage kErrFmtNoSamplingStartTimeStep
Command line parameters error message.
std::string mInputFileName
Input file name.
bool mStoreVelocityMinAllFlag
Store minimum of velocity over the whole domain?
bool mStorePressureRawFlag
Store raw time-series of pressure over the sensor mask?
bool mStorePressureRmsFlag
Store RMS of pressure over the the sensor mask?
OutputMessage kOutFmtBenchmarkTimeStep
Output message.
bool mStorePressureFinalAllFlag
Store pressure in the final time step over the whole domain?
bool mPrintVersionFlag
Print version of the code and exit.
static void errorAndTerminate(const std::string &errorMessage)
Log an error and terminate the execution.
bool mStoreVelocityMaxFlag
Store maximum of velocity over the sensor mask?
CommandLineParameters()
Default constructor - only friend class can create an instance.
ErrorMessage kErrFmtUnknownParameter
Command line parameter error message.
OutputMessage kOutFmtCheckpointFile
Output message.
The header file containing a class responsible for printing out info and error messages (stdout...
OutputMessage kOutFmtOutputFile
Output message.
bool isCheckpointEnabled() const
Is checkpoint enabled?
std::string mOutputFileName
Output file name.
bool mStoreVelocityNonStaggeredRawFlag
Store un staggered raw time-series of velocity over the sensor mask?
ErrorMessage kErrFmtNoCheckpointFile
Command line parameters error message.
OutputMessage kOutFmtSamplingStartsAt
Output message.
bool mStoreVelocityMinFlag
Store minimum of velocity over the sensor mask?
OutputMessage kOutFmtCompressionLevel
Output message.
void printComandlineParamers()
Print setup commandline parameters.
bool mStorePressureMaxFlag
Store maximum of pressure over the sensor mask?
Basic (default) level of verbosity.
size_t mCompressionLevel
Compression level value for output and checkpoint files.
OutputMessage kOutFmtSamplingFlags
Output message.
OutputMessage kOutFmtInputFile
Output message.
OutputMessage kOutFmtCopySensorMask
Output message.
bool mStoreVelocityMaxAllFlag
Store maximum of velocity over the whole domain?
bool mStorePressureMaxAllFlag
Store maximum of pressure over the whole domain?
size_t mNumberOfThreads
Number of CPU threads value.
bool mStoreVelocityFinalAllFlag
Store velocity in the final time step over the whole domain?
OutputMessage kOutFmtPrintProgressIntrerval
Output message.
ErrorMessage kErrFmtNoVerboseLevel
Command line parameters error message.
OutputMessage kOutFmtSeparator
Output message - separator.
ErrorMessage kErrFmtNoOutputFile
Command line parameters error message.
size_t mBenchmarkTimeStepCount
Number of time steps used to benchmark the code.
The header file containing the command line parameters.
size_t mSamplingStartTimeStep
StartTimeStep value.
OutputMessage kOutFmtUsageThreads
Usage massage.
void parseCommandLine(int argc, char **argv)
Parse commandline parameters.
bool mStoreVelocityRawFlag
Store raw time-series of velocity over the sensor mask?
ErrorMessage kErrFmtNoProgressPrintInterval
Command line parameters error message.
ErrorMessage kErrFmtNoBenchmarkTimeStep
Command line parameters error message.
ErrorMessage kErrFmtNoCheckpointInterval
Command line parameters error message.
ErrorMessage kErrFmtUnknownParameterOrArgument
Command line parameter error message.
bool mBenchmarkFlag
BenchmarkFlag value.
static constexpr size_t kDefaultProgressPrintInterval
Default progress print interval.