PrintWallTimeMixin.h
Go to the documentation of this file.
1 // This file is part of the MercuryDPM project (https://www.mercurydpm.org).
2 // Copyright (c), The MercuryDPM Developers Team. All rights reserved.
3 // License: BSD 3-Clause License; see the LICENSE file in the root directory.
4 
5 #ifndef MERCURYDPM_PRINTWALLTIMEMIXIN_H
6 #define MERCURYDPM_PRINTWALLTIMEMIXIN_H
7 
8 #include <chrono>
9 #include "DPMBase.h"
10 
20 class PrintWallTimeMixin : virtual public DPMBase {
21 public:
22 
27 
33  void printTime() const override;
34 
35 private:
40 
44  std::chrono::system_clock::time_point initialWallTime;
45 
50 
54  mutable std::chrono::system_clock::time_point lastWallTime;
55 
62  static std::string formatTime(const std::chrono::system_clock::time_point tp);
63 
70  static std::string formatDuration(const std::chrono::system_clock::duration duration);
71 
77  std::chrono::system_clock::time_point getCurrentWallTime() const;
78 
84  std::chrono::system_clock::duration estimateRemainingWallTime() const;
85 
91  std::chrono::system_clock::duration deadReckoningEstimateRemainingWallTime() const;
92 };
93 
94 #endif //MERCURYDPM_PRINTWALLTIMEMIXIN_H
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:56
A mixin class for printing wall time during simulations.
Definition: PrintWallTimeMixin.h:20
PrintWallTimeMixin()
Default constructor.
Definition: PrintWallTimeMixin.cc:12
std::chrono::system_clock::time_point getCurrentWallTime() const
Gets the current wall time.
Definition: PrintWallTimeMixin.cc:105
std::chrono::system_clock::time_point lastWallTime
Last wall time. Mutable so it can be modified in the const method printTime.
Definition: PrintWallTimeMixin.h:54
std::chrono::system_clock::duration deadReckoningEstimateRemainingWallTime() const
Estimates the remaining wall time for the simulation using dead reckoning.
Definition: PrintWallTimeMixin.cc:132
Mdouble initialSimulationTime
Initial simulation time.
Definition: PrintWallTimeMixin.h:39
Mdouble lastSimulationTime
Last simulation time. Mutable so it can be modified in the const method printTime.
Definition: PrintWallTimeMixin.h:49
std::chrono::system_clock::time_point initialWallTime
wall time (imagine a clock on the wall)
Definition: PrintWallTimeMixin.h:44
static std::string formatDuration(const std::chrono::system_clock::duration duration)
Formats a duration for display.
Definition: PrintWallTimeMixin.cc:72
std::chrono::system_clock::duration estimateRemainingWallTime() const
Estimates the remaining wall time for the simulation.
Definition: PrintWallTimeMixin.cc:116
static std::string formatTime(const std::chrono::system_clock::time_point tp)
Formats a time point for display.
Definition: PrintWallTimeMixin.cc:57
void printTime() const override
Prints the current wall time.
Definition: PrintWallTimeMixin.cc:24
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286