Molecular Dynamics Simulation  1.0
ProgressBarInterceptor.h
Go to the documentation of this file.
1 #pragma once
2 #include <chrono>
3 
4 #include "particles/Particle.h"
6 
8  public:
15  void onSimulationStart(Simulation& simulation) override;
16 
24  void operator()(size_t iteration, Simulation& simulation) override;
25 
33  void onSimulationEnd(size_t iteration, Simulation& simulation) override;
34 
43  explicit operator std::string() const override;
44 
48  void logSummary(int depth) const override;
49 
50  private:
52  std::chrono::high_resolution_clock::time_point t_start;
53  std::chrono::high_resolution_clock::time_point t_end;
54  std::chrono::high_resolution_clock::time_point t_prev;
55  size_t last_particle_count = 0;
56  size_t last_iteration = 0;
59 };
std::chrono::high_resolution_clock::time_point t_end
void logSummary(int depth) const override
Logs the summary of the progress bar.
void onSimulationEnd(size_t iteration, Simulation &simulation) override
This function is empty as the progress bar doesnt need to do anything at the end of the simulation.
void operator()(size_t iteration, Simulation &simulation) override
This function is called on every nth iteration. It prints a progress bar to the console and updates t...
std::chrono::high_resolution_clock::time_point t_start
std::chrono::high_resolution_clock::time_point t_prev
void onSimulationStart(Simulation &simulation) override
This function initalized the start time of the simulation and the previous time point.
Class to run a simulation.
Definition: Simulation.h:20