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