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 <optional> 8 : #include <type_traits> 9 : 10 : #include "Time/Tags/StepperErrorTolerancesCompute.hpp" 11 : #include "Time/Tags/StepperErrors.hpp" 12 : #include "Utilities/TMPL.hpp" 13 : #include "Utilities/TypeTraits/IsA.hpp" 14 : 15 : /// \cond 16 : struct StepperErrorEstimate; 17 : struct StepperErrorTolerances; 18 : class TimeDelta; 19 : class TimeStepId; 20 : class TimeStepper; 21 : namespace Tags { 22 : template <typename Tag> 23 : struct HistoryEvolvedVariables; 24 : template <typename Tag> 25 : struct Next; 26 : struct StepperErrorEstimatesEnabled; 27 : template <typename Tag> 28 : struct StepperErrorTolerances; 29 : struct TimeStep; 30 : struct TimeStepId; 31 : template <typename StepperInterface> 32 : struct TimeStepper; 33 : } // namespace Tags 34 : namespace TimeSteppers { 35 : template <typename Vars> 36 : class History; 37 : } // namespace TimeSteppers 38 : namespace gsl { 39 : template <class T> 40 : class not_null; 41 : } // namespace gsl 42 : /// \endcond 43 : 44 : /// \ingroup TimeGroup 45 : /// \brief Perform variable updates for one substep 46 : /// @{ 47 : template <typename System, bool LocalTimeStepping, 48 : template <typename> typename CacheTagPrefix = std::type_identity_t, 49 : typename = tmpl::conditional_t< 50 : tt::is_a_v<tmpl::list, typename System::variables_tag>, 51 : typename System::variables_tag, 52 : tmpl::list<typename System::variables_tag>>> 53 1 : struct UpdateU; 54 : 55 : template <typename System, bool LocalTimeStepping, 56 : template <typename> typename CacheTagPrefix, 57 : typename... VariablesTags> 58 0 : struct UpdateU<System, LocalTimeStepping, CacheTagPrefix, 59 : tmpl::list<VariablesTags...>> { 60 0 : using simple_tags = tmpl::list<::Tags::StepperErrors<VariablesTags>...>; 61 0 : using compute_tags = 62 : tmpl::list<Tags::StepperErrorEstimatesEnabledCompute<LocalTimeStepping, 63 : CacheTagPrefix>, 64 : Tags::StepperErrorTolerancesCompute< 65 : VariablesTags, LocalTimeStepping, CacheTagPrefix>...>; 66 : 67 0 : using return_tags = 68 : tmpl::list<VariablesTags..., Tags::StepperErrors<VariablesTags>...>; 69 0 : using argument_tags = 70 : tmpl::list<CacheTagPrefix<Tags::TimeStepper<TimeStepper>>, 71 : Tags::TimeStepId, Tags::Next<Tags::TimeStepId>, Tags::TimeStep, 72 : Tags::StepperErrorEstimatesEnabled, 73 : Tags::HistoryEvolvedVariables<VariablesTags>..., 74 : Tags::StepperErrorTolerances<VariablesTags>...>; 75 : 76 0 : static void apply( 77 : const gsl::not_null<typename VariablesTags::type*>... vars, 78 : const typename tmpl::has_type< 79 : VariablesTags, 80 : gsl::not_null<std::array<std::optional<StepperErrorEstimate>, 2>*>>:: 81 : type... errors, 82 : const TimeStepper& time_stepper, const TimeStepId& time_step_id, 83 : const TimeStepId& next_time_step_id, const TimeDelta& time_step, 84 : bool error_estimates_enabled, 85 : const TimeSteppers::History<typename VariablesTags::type>&... histories, 86 : const typename tmpl::has_type< 87 : VariablesTags, StepperErrorTolerances>::type&... tolerances); 88 : }; 89 : /// @}