Molecular Dynamics Simulation  1.0
Functions
MolSim.cpp File Reference
#include "io/cli/CLIParser.h"
#include "io/input/FileInputHandler.h"
#include "simulation/Simulation.h"
#include "simulation/SimulationParams.h"
Include dependency graph for MolSim.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argsv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argsv[] 
)

Definition at line 6 of file MolSim.cpp.

6  {
7  // Parse CLI arguments
8  CLIParams params_cli = parse_arguments(argc, argsv);
9 
10  // Parse input file
11  auto [initial_particles, simulation_arguments] = FileInputHandler::readFile(params_cli.input_file_path, params_cli.fresh);
12 
13  // Combine parameters from CLI and input file
14  SimulationParams params = merge_parameters(params_cli, simulation_arguments);
15  params.num_particles = initial_particles.size();
16 
17  // Initialize simulation
18  Simulation simulation{initial_particles, params};
19 
20  // Print simulation info
21  params.logSummary();
22 
23  auto overview = simulation.runSimulation();
24 
25  // Print simulation overview
26  overview.logSummary();
27 
28  // Save performance data to csv file
29  overview.savePerformanceDataCSV();
30 
31  return 0;
32 }
CLIParams parse_arguments(int argc, char *argsv[])
Parses the command line arguments.
Definition: CLIParser.cpp:9
SimulationParams merge_parameters(const CLIParams &params_cli, const std::optional< SimulationParams > &file_params)
Merges the simulation parameters retrieved via the command line with the ones from the XML file....
Definition: CLIParser.cpp:69
static std::tuple< std::vector< Particle >, std::optional< SimulationParams > > readFile(const std::filesystem::path &input_file_path, bool fresh=false, bool allow_recursion=true)
Reads the input file and stores the particles in the given ParticleContainer. Other simulation parame...
Contains all parameters needed to run a simulation.
size_t num_particles
Number of particles in the simulation.
void logSummary(int depth=0) const
Prints a summary of the simulation parameters to the console.
Class to run a simulation.
Definition: Simulation.h:20
std::filesystem::path input_file_path
Definition: CLIParams.h:9
bool fresh
Definition: CLIParams.h:14