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/VariableOrderAlgorithm.hpp"
11 : #include "Utilities/TMPL.hpp"
12 : #include "Utilities/TypeTraits/IsA.hpp"
13 :
14 : /// \cond
15 : struct StepperErrorEstimate;
16 : class TimeStepId;
17 : class TimeStepper;
18 : class VariableOrderAlgorithm;
19 : namespace Tags {
20 : template <typename Tag>
21 : struct HistoryEvolvedVariables;
22 : template <typename Tag>
23 : struct Next;
24 : template <typename Tag>
25 : struct StepperErrors;
26 : struct TimeStepId;
27 : template <typename StepperInterface>
28 : struct TimeStepper;
29 : } // namespace Tags
30 : namespace TimeSteppers {
31 : template <typename Vars>
32 : class History;
33 : } // namespace TimeSteppers
34 : namespace gsl {
35 : template <class T>
36 : class not_null;
37 : } // namespace gsl
38 : /// \endcond
39 :
40 : /*!
41 : * \ingroup TimeGroup
42 : * \brief Adjust the step order for local time-stepping
43 : *
44 : * \details See VariableOrderAlgorithm for descriptions of the
45 : * algorithms. This mutator wraps that class, checking that the order
46 : * is not changed out of the valid range for the time stepper.
47 : */
48 : /// @{
49 : template <typename System,
50 : template <typename> typename CacheTagPrefix = std::type_identity_t,
51 : typename = tmpl::conditional_t<
52 : tt::is_a_v<tmpl::list, typename System::variables_tag>,
53 : typename System::variables_tag,
54 : tmpl::list<typename System::variables_tag>>>
55 1 : struct ChangeTimeStepperOrder;
56 :
57 : template <typename System, template <typename> typename CacheTagPrefix,
58 : typename... VariablesTags>
59 0 : struct ChangeTimeStepperOrder<System, CacheTagPrefix,
60 : tmpl::list<VariablesTags...>> {
61 0 : using const_global_cache_tags =
62 : tmpl::list<CacheTagPrefix<Tags::VariableOrderAlgorithm>>;
63 0 : using return_tags =
64 : tmpl::list<Tags::HistoryEvolvedVariables<VariablesTags>...>;
65 0 : using argument_tags =
66 : tmpl::list<CacheTagPrefix<Tags::TimeStepper<TimeStepper>>,
67 : CacheTagPrefix<Tags::VariableOrderAlgorithm>,
68 : Tags::Next<Tags::TimeStepId>,
69 : Tags::StepperErrors<VariablesTags>...>;
70 :
71 0 : static void apply(
72 : const gsl::not_null<
73 : TimeSteppers::History<typename VariablesTags::type>*>... histories,
74 : const TimeStepper& time_stepper,
75 : const VariableOrderAlgorithm& order_algorithm,
76 : const TimeStepId& next_time_step_id,
77 : const typename tmpl::has_type<
78 : VariablesTags,
79 : std::array<std::optional<StepperErrorEstimate>, 2>>::type&... errors);
80 : };
81 : /// @}
|