Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <typeindex>
7 : #include <unordered_map>
8 :
9 : #include "Time/StepperErrorTolerances.hpp"
10 :
11 : /// \ingroup TimeGroup
12 : /// Base class for requesting time stepper error tolerances.
13 1 : struct RequestsStepperErrorTolerances {
14 : public:
15 : /// A map from the type of a variables tag to the tolerances for
16 : /// that variable.
17 : ///
18 : /// \note The use of `std::type_index` is stable in this situation
19 : /// because while `name()`, `before()`, and `hash()` are
20 : /// implementation defined or unspecified, the C++ standard
21 : /// guarantees that two `std::type_index` are equal only if the
22 : /// underlying types are equal and they are not equal if the types
23 : /// are different. This means we can use this safely in a
24 : /// `std::unordered_map`.
25 : virtual std::unordered_map<std::type_index, StepperErrorTolerances>
26 1 : tolerances() const = 0;
27 :
28 : protected:
29 0 : RequestsStepperErrorTolerances() = default;
30 0 : ~RequestsStepperErrorTolerances() = default;
31 : };
|