42 bool methodFound =
false;
43 bool inputFileFound =
false;
45 for (
int i = 1; i < argc; ++i) {
46 std::string arg = argv[i];
48 if ((arg ==
"--job" || arg ==
"-j") && i + 1 < argc) {
51 else if ((arg ==
"--tolerance" || arg ==
"-t") && i + 1 < argc) {
54 else if ((arg ==
"--max-iterations" || arg ==
"-m") && i + 1 < argc) {
57 else if ((arg ==
"--relaxation" || arg ==
"-r") && i + 1 < argc) {
60 else if (arg ==
"--version" || arg ==
"-v") {
63 else if (arg ==
"--help" || arg ==
"-h") {
67 else if (!inputFileFound) {
83 inputFileFound =
true;
85 else if (!methodFound) {
90 else if (arg ==
"NEWTON") {
101 LOG_MESSAGE(
"ERROR: Unexpected argument '{}'", arg);
107 if (!inputFileFound) {
108 LOG_MESSAGE(
"ERROR: Input CDF file (.txt or .cdf) is required.");
114 LOG_MESSAGE(
"ERROR: Missing required solver argument (GAUSS or NEWTON).");
124 LOG_MESSAGE(
"Warning: Relaxation coefficient ignored for method 'NEWTON'");
127 LOG_DEBUG(
"deltaFlow v{}", deltaFlow_VERSION);
128 LOG_DEBUG(
"CMake v{}, GCC v{}", CMake_VERSION, gcc_VERSION);
174 deltaFlow [OPTIONS] <input-file> <solver>
177 <input-file> Path to input file (.cdf, .txt or .raw)
178 <solver> Solver method: GAUSS | NEWTON
181 -j, --job <name> Job name
182 -t, --tolerance <value> Convergence tolerance (default: 1E-8)
183 -m, --max-iterations <int> Maximum number of iterations (default: 1024)
184 -h, --help Display help message
185 -v, --version Show program version and exit
188 GAUSS Gauss-Seidel Method
189 -r, --relaxation <value> Relaxation coefficient (default: 1.0)
191 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.
Plain parsed-options data, separated from ArgumentParser's parsing logic (ISP).
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.
PowerFlowOptions getOptions() const noexcept
Get all parsed options as a plain data struct (ISP).
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.
Plain data holder for parsed command-line options.
std::string inputFile
Path to input file.
std::string jobName
Job name (defaults to input filename)
int maxIterations
Maximum number of iterations ($$ N_{max} $$)
double tolerance
Convergence tolerance ($$ \epsilon $$)
SolverType solverType
Solver type.
InputFormat inputFormat
Input file format.
double relaxation
Relaxation coefficient ($$ \omega $$)