41 bool methodFound =
false;
42 bool inputFileFound =
false;
44 for (
int i = 1; i < argc; ++i) {
45 std::string arg = argv[i];
47 if ((arg ==
"--job" || arg ==
"-j") && i + 1 < argc) {
50 else if ((arg ==
"--tolerance" || arg ==
"-t") && i + 1 < argc) {
53 else if ((arg ==
"--max-iterations" || arg ==
"-m") && i + 1 < argc) {
56 else if ((arg ==
"--relaxation" || arg ==
"-r") && i + 1 < argc) {
59 else if (arg ==
"--version" || arg ==
"-v") {
62 else if (arg ==
"--help" || arg ==
"-h") {
66 else if (!inputFileFound) {
82 inputFileFound =
true;
84 else if (!methodFound) {
89 else if (arg ==
"NEWTON") {
100 LOG_MESSAGE(
"ERROR: Unexpected argument '{}'", arg);
106 if (!inputFileFound) {
107 LOG_MESSAGE(
"ERROR: Input CDF file (.txt or .cdf) is required.");
113 LOG_MESSAGE(
"ERROR: Missing required solver argument (GAUSS or NEWTON).");
123 LOG_MESSAGE(
"Warning: Relaxation coefficient ignored for method 'NEWTON'");
126 LOG_DEBUG(
"deltaFlow v{}", deltaFlow_VERSION);
127 LOG_DEBUG(
"CMake v{}, GCC v{}", CMake_VERSION, gcc_VERSION);
161 deltaFlow [OPTIONS] <input-file> <solver>
164 <input-file> Path to input file (.cdf, .txt or .raw)
165 <solver> Solver method: GAUSS | NEWTON
168 -j, --job <name> Job name
169 -t, --tolerance <value> Convergence tolerance (default: 1E-8)
170 -m, --max-iterations <int> Maximum number of iterations (default: 1024)
171 -h, --help Display help message
172 -v, --version Show program version and exit
175 GAUSS Gauss-Seidel Method
176 -r, --relaxation <value> Relaxation coefficient (default: 1.0)
178 NEWTON Newton-Raphson Method
Command-line argument parsing utilities for deltaFlow.
InputFormat
Supported input file formats.
@ IEEE
IEEE Common Data Format (.cdf, .txt)
@ PSSE
PSS/E Raw Data Format (.raw)
SolverType
Types of solvers supported by deltaFlow.
@ NewtonRaphson
Newton-Raphson iterative method.
@ GaussSeidel
Gauss-Seidel iterative method.
Display and formatting utilities for terminal and file output.
Logger utilities for deltaFlow, providing logging macros and a singleton Logger class.
#define LOG_DEBUG(msg,...)
Macro for logging a debug-level message.
#define LOG_MESSAGE(msg,...)
Macro for printing messages to stdout.
Utility functions and helpers for deltaFlow.
InputFormat getInputFormat() const noexcept
Get the input file format.
double relaxation
Relaxation coefficient ($$ \omega $$)
std::string inputFile
Path to input CDF file.
std::string jobName
Job name (defaults to input filename)
std::string getJobName() const noexcept
Get the job name.
double getTolerance() const noexcept
Get the convergence tolerance ($$ \epsilon $$).
void parse_args(int argc, char *argv[])
Parse the provided arguments.
void help() const noexcept
Print help message to stdout.
ArgumentParser(int argc, char *argv[])
Constructor: parses command-line arguments.
double tolerance
Convergence tolerance ($$ \epsilon $$)
SolverType getSolverType() const noexcept
Get the solver type.
std::string getInputFile() const noexcept
Get the input CDF file path.
double getRelaxationCoefficient() const noexcept
Get the relaxation coefficient ($$ \omega $$).
SolverType method
Solver type.
int maxIterations
Maximum number of iterations ($$ N_{max} $$)
int getMaxIterations() const noexcept
Get the maximum number of iterations ($$ N_{max} $$).
InputFormat format
Input file format.
bool isCommonDataFormat(const std::string &filePath)
Check if filepath is IEEE Common Data Format.
bool isRawFormat(const std::string &filePath)
Check if filepath is PSS/E Raw format.