Molecular Dynamics Simulation  1.0
ParticleUpdateCounterInterceptor.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <chrono>
4 
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 
55  [[nodiscard]] double getParticleUpdatesPerSecond() const;
56 
57  private:
58  size_t particle_updates = 0;
59  std::chrono::high_resolution_clock::time_point t_start;
60  std::chrono::high_resolution_clock::time_point t_end;
61  std::chrono::milliseconds::rep t_diff{};
63 };
double getParticleUpdatesPerSecond() const
Get the particle updates per second.
void logSummary(int depth) const override
Logs the summary of the particle update counter.
void operator()(size_t iteration, Simulation &simulation) override
This function is called on every nth iteration. It counts the number of particle updates which have b...
void onSimulationStart(Simulation &simulation) override
This function is sets the particle_updates to 0 and initializes the start time of the simulation.
std::chrono::high_resolution_clock::time_point t_end
void onSimulationEnd(size_t iteration, Simulation &simulation) override
This function is empty as the thermostat doesnt need to do anything at the end of the simulation.
std::chrono::high_resolution_clock::time_point t_start
Class to run a simulation.
Definition: Simulation.h:20