pure-cpp 1.0.0
A C++ physics simulation benchmark comparing performance with Python implementations
CmdLine::CmdLineArgs Struct Reference

Holds and parses command-line arguments. More...

#include <cmd_line_parser.hpp>

Collaboration diagram for CmdLine::CmdLineArgs:
Collaboration graph

Public Member Functions

Configuration::SimulationConfig toSimulationConfig () const
 Creates a SimulationConfig object from the parsed arguments. More...
 
void validate (const std::function< QString(const char *)> &tr_func) const
 Validates the parsed command-line arguments. More...
 

Static Public Member Functions

static std::unique_ptr< CmdLineArgsparse (const QStringList &q_args, const std::function< QString(const char *)> &tr_func)
 Parses and validates command-line arguments. More...
 

Public Attributes

std::size_t n_iter_
 The number of iterations to run the simulation. More...
 
std::size_t n_bodies_
 The number of bodies in the simulation. More...
 
double dens_
 The density of the bodies. More...
 
double dt_
 The time step for each simulation iteration. More...
 
double G_
 The universal gravitational constant. More...
 
double epsilon_
 The numerical precision for floating-point comparisons. More...
 
unsigned int seed_
 The seed for the random number generator. More...
 
bool debug_console_
 Flag to enable diagnostic output. More...
 
std::string debug_file_
 File path for logging. More...
 
std::string debug_syslog_
 Identifier for syslog logging. More...
 
LogLevel log_level_
 Log level filter. More...
 
std::size_t log_freq_
 Frequency of energy log output. More...
 
double restitution_
 Coefficient of restitution for collisions. More...
 
double friction_
 Coefficient of kinetic (sliding) friction. More...
 
double static_friction_
 Coefficient of static friction. More...
 
double linear_damping_
 Damping factor for linear velocity. More...
 
double angular_damping_
 Damping factor for angular velocity. More...
 
bool show_torque_arrow_
 Flag to display torque vectors in the UI. More...
 
bool show_alpha_arrow_
 Flag to display angular acceleration vectors in the UI. More...
 
std::string cleanup_mode_
 Cleanup strategy: "fast" (deferred) or "strict" (sync). More...
 

Detailed Description

Holds and parses command-line arguments.

This struct inherits from QObject to gain access to the tr() function for internationalisation.

Definition at line 177 of file cmd_line_parser.hpp.

Member Function Documentation

◆ parse()

static std::unique_ptr< CmdLineArgs > CmdLine::CmdLineArgs::parse ( const QStringList &  q_args,
const std::function< QString(const char *)> &  tr_func 
)
inlinestatic

Parses and validates command-line arguments.

Parameters
argcThe argument count from main().
argvThe argument vector from main().
Returns
A unique_ptr to a CmdLineArgs struct on success, or nullptr if –help or –version was requested, or if an error occurred.

Definition at line 375 of file cmd_line_parser.hpp.

Here is the caller graph for this function:

◆ toSimulationConfig()

Configuration::SimulationConfig CmdLine::CmdLineArgs::toSimulationConfig ( ) const
inline

Creates a SimulationConfig object from the parsed arguments.

Returns
A populated SimulationConfig struct.

Definition at line 244 of file cmd_line_parser.hpp.

◆ validate()

void CmdLine::CmdLineArgs::validate ( const std::function< QString(const char *)> &  tr_func) const
inline

Validates the parsed command-line arguments.

Exceptions
po::validation_errorif any argument is invalid.

Definition at line 270 of file cmd_line_parser.hpp.

Here is the call graph for this function:

Member Data Documentation

◆ angular_damping_

double CmdLine::CmdLineArgs::angular_damping_

Damping factor for angular velocity.

Definition at line 228 of file cmd_line_parser.hpp.

◆ cleanup_mode_

std::string CmdLine::CmdLineArgs::cleanup_mode_

Cleanup strategy: "fast" (deferred) or "strict" (sync).

Definition at line 237 of file cmd_line_parser.hpp.

◆ debug_console_

bool CmdLine::CmdLineArgs::debug_console_

Flag to enable diagnostic output.

Definition at line 201 of file cmd_line_parser.hpp.

◆ debug_file_

std::string CmdLine::CmdLineArgs::debug_file_

File path for logging.

Definition at line 204 of file cmd_line_parser.hpp.

◆ debug_syslog_

std::string CmdLine::CmdLineArgs::debug_syslog_

Identifier for syslog logging.

Definition at line 207 of file cmd_line_parser.hpp.

◆ dens_

double CmdLine::CmdLineArgs::dens_

The density of the bodies.

Definition at line 186 of file cmd_line_parser.hpp.

◆ dt_

double CmdLine::CmdLineArgs::dt_

The time step for each simulation iteration.

Definition at line 189 of file cmd_line_parser.hpp.

◆ epsilon_

double CmdLine::CmdLineArgs::epsilon_

The numerical precision for floating-point comparisons.

Definition at line 195 of file cmd_line_parser.hpp.

◆ friction_

double CmdLine::CmdLineArgs::friction_

Coefficient of kinetic (sliding) friction.

Definition at line 219 of file cmd_line_parser.hpp.

◆ G_

double CmdLine::CmdLineArgs::G_

The universal gravitational constant.

Definition at line 192 of file cmd_line_parser.hpp.

◆ linear_damping_

double CmdLine::CmdLineArgs::linear_damping_

Damping factor for linear velocity.

Definition at line 225 of file cmd_line_parser.hpp.

◆ log_freq_

std::size_t CmdLine::CmdLineArgs::log_freq_

Frequency of energy log output.

Definition at line 213 of file cmd_line_parser.hpp.

◆ log_level_

LogLevel CmdLine::CmdLineArgs::log_level_

Log level filter.

Definition at line 210 of file cmd_line_parser.hpp.

◆ n_bodies_

std::size_t CmdLine::CmdLineArgs::n_bodies_

The number of bodies in the simulation.

Definition at line 183 of file cmd_line_parser.hpp.

◆ n_iter_

std::size_t CmdLine::CmdLineArgs::n_iter_

The number of iterations to run the simulation.

Definition at line 180 of file cmd_line_parser.hpp.

◆ restitution_

double CmdLine::CmdLineArgs::restitution_

Coefficient of restitution for collisions.

Definition at line 216 of file cmd_line_parser.hpp.

◆ seed_

unsigned int CmdLine::CmdLineArgs::seed_

The seed for the random number generator.

Definition at line 198 of file cmd_line_parser.hpp.

◆ show_alpha_arrow_

bool CmdLine::CmdLineArgs::show_alpha_arrow_

Flag to display angular acceleration vectors in the UI.

Definition at line 234 of file cmd_line_parser.hpp.

◆ show_torque_arrow_

bool CmdLine::CmdLineArgs::show_torque_arrow_

Flag to display torque vectors in the UI.

Definition at line 231 of file cmd_line_parser.hpp.

◆ static_friction_

double CmdLine::CmdLineArgs::static_friction_

Coefficient of static friction.

Definition at line 222 of file cmd_line_parser.hpp.


The documentation for this struct was generated from the following file: