deltaFlow
Argparse.H
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Saud Zahir
3 *
4 * This file is part of deltaFlow.
5 *
6 * deltaFlow is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
10 *
11 * deltaFlow is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with deltaFlow. If not, see
18 * <https://www.gnu.org/licenses/>.
19 */
20
29#ifndef ARGPARSE_H
30#define ARGPARSE_H
31
32#include <string>
33
41enum class SolverType {
44};
45
50enum class InputFormat {
51 IEEE,
52 PSSE
53};
54
62class ArgumentParser final {
63 public:
69 ArgumentParser(int argc, char* argv[]);
70
74 ~ArgumentParser() = default;
75
76 // Deleted copy/move semantics
79 ArgumentParser(const ArgumentParser&&) = delete;
81
86 std::string getInputFile() const noexcept;
87
92 std::string getJobName() const noexcept;
93
98 double getTolerance() const noexcept;
99
104 int getMaxIterations() const noexcept;
105
110 double getRelaxationCoefficient() const noexcept;
111
116 SolverType getSolverType() const noexcept;
117
122 InputFormat getInputFormat() const noexcept;
123
124 private:
125 std::string inputFile;
126 std::string jobName;
127 double tolerance = 1E-8;
128 int maxIterations = 1024;
129 double relaxation = 1.0;
132
138 void parse_args(int argc, char* argv[]);
139
143 void help() const noexcept;
144
145};
146
147#endif
InputFormat
Supported input file formats.
Definition Argparse.H:50
@ IEEE
IEEE Common Data Format (.cdf, .txt)
@ PSSE
PSS/E Raw Data Format (.raw)
SolverType
Types of solvers supported by deltaFlow.
Definition Argparse.H:41
@ NewtonRaphson
Newton-Raphson iterative method.
@ GaussSeidel
Gauss-Seidel iterative method.
Parses and stores command-line arguments for deltaFlow.
Definition Argparse.H:62
~ArgumentParser()=default
Destructor (default).
InputFormat getInputFormat() const noexcept
Get the input file format.
Definition Argparse.C:154
double relaxation
Relaxation coefficient ($$ \omega $$)
Definition Argparse.H:129
std::string inputFile
Path to input CDF file.
Definition Argparse.H:125
std::string jobName
Job name (defaults to input filename)
Definition Argparse.H:126
ArgumentParser & operator=(const ArgumentParser &)=delete
ArgumentParser & operator=(ArgumentParser &&)=delete
std::string getJobName() const noexcept
Get the job name.
Definition Argparse.C:134
double getTolerance() const noexcept
Get the convergence tolerance ($$ \epsilon $$).
Definition Argparse.C:138
void parse_args(int argc, char *argv[])
Parse the provided arguments.
Definition Argparse.C:40
void help() const noexcept
Print help message to stdout.
Definition Argparse.C:158
double tolerance
Convergence tolerance ($$ \epsilon $$)
Definition Argparse.H:127
ArgumentParser(const ArgumentParser &&)=delete
SolverType getSolverType() const noexcept
Get the solver type.
Definition Argparse.C:150
std::string getInputFile() const noexcept
Get the input CDF file path.
Definition Argparse.C:130
double getRelaxationCoefficient() const noexcept
Get the relaxation coefficient ($$ \omega $$).
Definition Argparse.C:146
ArgumentParser(const ArgumentParser &)=delete
SolverType method
Solver type.
Definition Argparse.H:130
int maxIterations
Maximum number of iterations ($$ N_{max} $$)
Definition Argparse.H:128
int getMaxIterations() const noexcept
Get the maximum number of iterations ($$ N_{max} $$).
Definition Argparse.C:142
InputFormat format
Input file format.
Definition Argparse.H:131