Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <array>
7 : #include <cstddef>
8 : #include <optional>
9 :
10 : #include "Time/Time.hpp"
11 :
12 : /// \cond
13 : namespace PUP {
14 : class er;
15 : } // namespace PUP
16 : /// \endcond
17 :
18 : /// \ingroup TimeGroup
19 : /// Estimate of the TimeStepper truncation error.
20 1 : struct StepperErrorEstimate {
21 : /// Start of the step the estimate is for.
22 1 : Time step_time{};
23 : /// Size of the step the estimate is for.
24 1 : TimeDelta step_size{};
25 : /// Order of accuracy of the primary estimate.
26 1 : size_t order{};
27 : /// Error estimates. The entry `errors[order]`, with `order` the
28 : /// previous member of this struct, is the estimated error of the
29 : /// time step, and has a convenience accessor `step_error()`. Other
30 : /// entries are estimations of the error if the order of a
31 : /// variable-order stepper were to be changed. The error
32 : /// `errors[i]` should scale approximately as $(\Delta t)^{i + 1}$.
33 1 : std::array<std::optional<double>, 8> errors{};
34 :
35 0 : StepperErrorEstimate() = default;
36 0 : StepperErrorEstimate(Time step_time_in, TimeDelta step_size_in,
37 : size_t order_in, double step_error_in);
38 :
39 : /// Convenience accessor for `errors[order].value()`.
40 1 : double step_error() const;
41 :
42 0 : void pup(PUP::er& p);
43 : };
|