IterationId.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 /// \file
5 /// Defines class IterationId.
6 
7 #pragma once
8 
9 #include <cstddef>
10 #include <functional>
11 #include <iosfwd>
12 
13 /// \cond
14 namespace PUP {
15 class er;
16 } // namespace PUP
17 /// \endcond
18 
19 namespace LinearSolver {
20 
21 /*!
22  * \ingroup LinearSolverGroup
23  * \brief Identifies a step in the linear solver algorithm
24  */
25 struct IterationId {
26  size_t step_number{0};
27 
28  IterationId() = default;
29 
30  // To support ObservationId
31  double value() const noexcept { return static_cast<double>(step_number); }
32 
33  // clang-tidy: google-runtime-references
34  void pup(PUP::er& p) noexcept; // NOLINT
35 };
36 
37 bool operator==(const IterationId& a, const IterationId& b) noexcept;
38 bool operator!=(const IterationId& a, const IterationId& b) noexcept;
39 bool operator<(const IterationId& a, const IterationId& b) noexcept;
40 bool operator<=(const IterationId& a, const IterationId& b) noexcept;
41 bool operator>(const IterationId& a, const IterationId& b) noexcept;
42 bool operator>=(const IterationId& a, const IterationId& b) noexcept;
43 
44 std::ostream& operator<<(std::ostream& s, const IterationId& id) noexcept;
45 
46 size_t hash_value(const IterationId& id) noexcept;
47 
48 } // namespace LinearSolver
49 
50 namespace std {
51 template <>
52 struct hash<LinearSolver::IterationId> {
53  size_t operator()(const LinearSolver::IterationId& id) const noexcept;
54 };
55 } // namespace std
Definition: Strahlkorper.hpp:14
Functionality for solving linear systems of equations.
Definition: TerminateIfConverged.hpp:22
bool operator>(const Slab &a, const Slab &b) noexcept
Slab comparison operators give the time ordering. Overlapping unequal slabs should not be compared (a...
Definition: Slab.hpp:122
bool operator<=(const Slab &a, const Slab &b) noexcept
Slab comparison operators give the time ordering. Overlapping unequal slabs should not be compared (a...
Definition: Slab.hpp:125
Identifies a step in the linear solver algorithm.
Definition: IterationId.hpp:25
bool operator>=(const Slab &a, const Slab &b) noexcept
Slab comparison operators give the time ordering. Overlapping unequal slabs should not be compared (a...
Definition: Slab.hpp:128
bool operator<(const Slab &a, const Slab &b) noexcept
Slab comparison operators give the time ordering. Overlapping unequal slabs should not be compared (a...
Definition: Slab.hpp:117