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 <limits>
16
17#include "MathLib/KahanSum.h"
18
19namespace NumLib
20{
21struct TimeIncrement;
22}
23
24template <>
25struct fmt::formatter<NumLib::TimeIncrement> : fmt::ostream_formatter
26{
27};
28
29namespace NumLib
30{
32{
33 constexpr explicit TimeIncrement(double const dt) : value_{dt} {}
34
35 constexpr double operator()() const { return value_; }
36
37 friend inline std::ostream& operator<<(std::ostream& os,
38 TimeIncrement const& dt)
39 {
40 auto const precision = os.precision();
41 return os << std::setprecision(
42 std::numeric_limits<double>::max_digits10)
43 << dt.value_ << std::setprecision(precision);
44 }
45
46private:
47 double value_;
48};
49
50} // namespace NumLib
friend std::ostream & operator<<(std::ostream &os, TimeIncrement const &dt)
constexpr double operator()() const
constexpr TimeIncrement(double const dt)