Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <cstddef>
7 : #include <cstdint>
8 : #include <optional>
9 :
10 : #include "DataStructures/TaggedVariant.hpp"
11 : #include "Time/StepperErrorEstimate.hpp"
12 : #include "Time/TimeStepId.hpp"
13 : #include "Time/TimeSteppers/LtsTimeStepper.hpp"
14 :
15 : /// \cond
16 : class StepperErrorTolerances;
17 : class TimeDelta;
18 : namespace PUP {
19 : class er;
20 : } // namespace PUP
21 : namespace TimeSteppers {
22 : template <typename T>
23 : class BoundaryHistoryEvaluator;
24 : class ConstBoundaryHistoryTimes;
25 : template <typename T>
26 : class ConstUntypedHistory;
27 : class MutableBoundaryHistoryTimes;
28 : template <typename T>
29 : class MutableUntypedHistory;
30 : } // namespace TimeSteppers
31 : namespace gsl {
32 : template <class T>
33 : class not_null;
34 : } // namespace gsl
35 : /// \endcond
36 :
37 : namespace TimeSteppers {
38 :
39 : /*!
40 : * \ingroup TimeSteppersGroup
41 : *
42 : * Class used to allow compiling LTS code with GTS time steppers. All
43 : * methods error at runtime.
44 : */
45 1 : class LtsError : public LtsTimeStepper {
46 : public:
47 0 : LtsError() = default;
48 0 : LtsError(const LtsError&) = default;
49 0 : LtsError& operator=(const LtsError&) = default;
50 0 : LtsError(LtsError&&) = default;
51 0 : LtsError& operator=(LtsError&&) = default;
52 0 : ~LtsError() override = default;
53 :
54 : [[noreturn]] variants::TaggedVariant<Tags::FixedOrder, Tags::VariableOrder>
55 1 : order() const override;
56 :
57 1 : [[noreturn]] uint64_t number_of_substeps() const override;
58 :
59 1 : [[noreturn]] uint64_t number_of_substeps_for_error() const override;
60 :
61 1 : [[noreturn]] size_t number_of_past_steps() const override;
62 :
63 1 : [[noreturn]] double stable_step() const override;
64 :
65 1 : [[noreturn]] bool monotonic() const override;
66 :
67 1 : [[noreturn]] bool dense_output_uses_fsal() const override;
68 :
69 1 : [[noreturn]] TimeStepId next_time_id(
70 : const TimeStepId& current_id, const TimeDelta& time_step) const override;
71 :
72 1 : [[noreturn]] TimeStepId next_time_id_for_error(
73 : const TimeStepId& current_id, const TimeDelta& time_step) const override;
74 :
75 1 : [[noreturn]] bool neighbor_data_required(
76 : const TimeStepId& next_substep_id,
77 : const TimeStepId& neighbor_data_id) const override;
78 :
79 1 : [[noreturn]] bool neighbor_data_required(
80 : double dense_output_time,
81 : const TimeStepId& neighbor_data_id) const override;
82 :
83 : #if defined(__clang__)
84 : #pragma GCC diagnostic push
85 : #pragma GCC diagnostic ignored "-Wmissing-noreturn"
86 : #endif
87 0 : WRAPPED_PUPable_decl_template(LtsError); // NOLINT
88 : #if defined(__clang__)
89 : #pragma GCC diagnostic pop
90 : #endif
91 :
92 0 : explicit LtsError(CkMigrateMessage* /*unused*/) {}
93 :
94 0 : [[noreturn]] void pup(PUP::er& p) override;
95 :
96 : private:
97 : template <typename T>
98 0 : [[noreturn]] void update_u_impl(gsl::not_null<T*> u,
99 : const ConstUntypedHistory<T>& history,
100 : const TimeDelta& time_step) const;
101 :
102 : template <typename T>
103 0 : [[noreturn]] std::optional<StepperErrorEstimate> update_u_impl(
104 : gsl::not_null<T*> u, const ConstUntypedHistory<T>& history,
105 : const TimeDelta& time_step,
106 : const StepperErrorTolerances& tolerances) const;
107 :
108 : template <typename T>
109 0 : [[noreturn]] void clean_history_impl(
110 : const MutableUntypedHistory<T>& history) const;
111 :
112 : template <typename T>
113 0 : [[noreturn]] bool dense_update_u_impl(gsl::not_null<T*> u,
114 : const ConstUntypedHistory<T>& history,
115 : double time) const;
116 :
117 : template <typename T>
118 0 : [[noreturn]] bool can_change_step_size_impl(
119 : const TimeStepId& time_id, const ConstUntypedHistory<T>& history) const;
120 :
121 : template <typename T>
122 0 : [[noreturn]] void add_boundary_delta_impl(
123 : gsl::not_null<T*> result,
124 : const TimeSteppers::ConstBoundaryHistoryTimes& local_times,
125 : const TimeSteppers::ConstBoundaryHistoryTimes& remote_times,
126 : const TimeSteppers::BoundaryHistoryEvaluator<T>& coupling,
127 : const TimeDelta& time_step) const;
128 :
129 0 : [[noreturn]] void clean_boundary_history_impl(
130 : const TimeSteppers::MutableBoundaryHistoryTimes& local_times,
131 : const TimeSteppers::MutableBoundaryHistoryTimes& remote_times)
132 : const override;
133 :
134 : template <typename T>
135 0 : [[noreturn]] void boundary_dense_output_impl(
136 : gsl::not_null<T*> result,
137 : const TimeSteppers::ConstBoundaryHistoryTimes& local_times,
138 : const TimeSteppers::ConstBoundaryHistoryTimes& remote_times,
139 : const TimeSteppers::BoundaryHistoryEvaluator<T>& coupling,
140 : double time) const;
141 :
142 : #if defined(__GNUC__) and not defined(__clang__)
143 : #pragma GCC diagnostic push
144 : #pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn"
145 : #endif
146 : TIME_STEPPER_DECLARE_OVERLOADS
147 : LTS_TIME_STEPPER_DECLARE_OVERLOADS
148 : #if defined(__GNUC__) and not defined(__clang__)
149 : #pragma GCC diagnostic pop
150 : #endif
151 : };
152 : } // namespace TimeSteppers
|