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]] TimeStepId next_time_id( 68 : const TimeStepId& current_id, const TimeDelta& time_step) const override; 69 : 70 1 : [[noreturn]] TimeStepId next_time_id_for_error( 71 : const TimeStepId& current_id, const TimeDelta& time_step) const override; 72 : 73 1 : [[noreturn]] bool neighbor_data_required( 74 : const TimeStepId& next_substep_id, 75 : const TimeStepId& neighbor_data_id) const override; 76 : 77 1 : [[noreturn]] bool neighbor_data_required( 78 : double dense_output_time, 79 : const TimeStepId& neighbor_data_id) const override; 80 : 81 : #if defined(__clang__) 82 : #pragma GCC diagnostic push 83 : #pragma GCC diagnostic ignored "-Wmissing-noreturn" 84 : #endif 85 0 : WRAPPED_PUPable_decl_template(LtsError); // NOLINT 86 : #if defined(__clang__) 87 : #pragma GCC diagnostic pop 88 : #endif 89 : 90 0 : explicit LtsError(CkMigrateMessage* /*unused*/) {} 91 : 92 0 : [[noreturn]] void pup(PUP::er& p) override; 93 : 94 : private: 95 : template <typename T> 96 0 : [[noreturn]] void update_u_impl(gsl::not_null<T*> u, 97 : const ConstUntypedHistory<T>& history, 98 : const TimeDelta& time_step) const; 99 : 100 : template <typename T> 101 0 : [[noreturn]] std::optional<StepperErrorEstimate> update_u_impl( 102 : gsl::not_null<T*> u, const ConstUntypedHistory<T>& history, 103 : const TimeDelta& time_step, 104 : const StepperErrorTolerances& tolerances) const; 105 : 106 : template <typename T> 107 0 : [[noreturn]] void clean_history_impl( 108 : const MutableUntypedHistory<T>& history) const; 109 : 110 : template <typename T> 111 0 : [[noreturn]] bool dense_update_u_impl(gsl::not_null<T*> u, 112 : const ConstUntypedHistory<T>& history, 113 : double time) const; 114 : 115 : template <typename T> 116 0 : [[noreturn]] bool can_change_step_size_impl( 117 : const TimeStepId& time_id, const ConstUntypedHistory<T>& history) const; 118 : 119 : template <typename T> 120 0 : [[noreturn]] void add_boundary_delta_impl( 121 : gsl::not_null<T*> result, 122 : const TimeSteppers::ConstBoundaryHistoryTimes& local_times, 123 : const TimeSteppers::ConstBoundaryHistoryTimes& remote_times, 124 : const TimeSteppers::BoundaryHistoryEvaluator<T>& coupling, 125 : const TimeDelta& time_step) const; 126 : 127 0 : [[noreturn]] void clean_boundary_history_impl( 128 : const TimeSteppers::MutableBoundaryHistoryTimes& local_times, 129 : const TimeSteppers::MutableBoundaryHistoryTimes& remote_times) 130 : const override; 131 : 132 : template <typename T> 133 0 : [[noreturn]] void boundary_dense_output_impl( 134 : gsl::not_null<T*> result, 135 : const TimeSteppers::ConstBoundaryHistoryTimes& local_times, 136 : const TimeSteppers::ConstBoundaryHistoryTimes& remote_times, 137 : const TimeSteppers::BoundaryHistoryEvaluator<T>& coupling, 138 : double time) const; 139 : 140 : #if defined(__GNUC__) and not defined(__clang__) 141 : #pragma GCC diagnostic push 142 : #pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn" 143 : #endif 144 : TIME_STEPPER_DECLARE_OVERLOADS 145 : LTS_TIME_STEPPER_DECLARE_OVERLOADS 146 : #if defined(__GNUC__) and not defined(__clang__) 147 : #pragma GCC diagnostic pop 148 : #endif 149 : }; 150 : } // namespace TimeSteppers