Loading [MathJax]/extensions/MathMenu.js
OGS
TimeIncrement.h
Go to the documentation of this file.
1
10#pragma once
11
12#include <algorithm>
13#include <cmath>
14#include <compare>
15#include <iomanip>
16#include <limits>
17
18#include "MathLib/KahanSum.h"
19
20namespace NumLib
21{
22struct TimeIncrement;
23}
24
25template <>
26struct fmt::formatter<NumLib::TimeIncrement> : fmt::ostream_formatter
27{
28};
29
30namespace NumLib
31{
33{
34 constexpr explicit TimeIncrement(double const dt) : value_{dt} {}
35
36 constexpr double operator()() const { return value_; }
37
38 friend inline std::ostream& operator<<(std::ostream& os,
39 TimeIncrement const& dt)
40 {
41 auto const precision = os.precision();
42 return os << std::setprecision(
43 std::numeric_limits<double>::max_digits10)
44 << dt.value_ << std::setprecision(precision);
45 }
46
47private:
48 double value_;
49};
50
51} // namespace NumLib
friend std::ostream & operator<<(std::ostream &os, TimeIncrement const &dt)
constexpr double operator()() const
constexpr TimeIncrement(double const dt)