Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include "Evolution/Imex/Protocols/ImexSystem.hpp"
7 : #include "Evolution/Imex/Tags/ImplicitHistory.hpp"
8 : #include "Evolution/Imex/Tags/Mode.hpp"
9 : #include "Evolution/Imex/Tags/SolveFailures.hpp"
10 : #include "Evolution/Imex/Tags/SolveTolerance.hpp"
11 : #include "Time/History.hpp"
12 : #include "Time/Tags/HistoryEvolvedVariables.hpp"
13 : #include "Utilities/Gsl.hpp"
14 : #include "Utilities/MakeWithValue.hpp"
15 : #include "Utilities/ProtocolHelpers.hpp"
16 : #include "Utilities/TMPL.hpp"
17 :
18 : namespace imex {
19 : /// Create the IMEX structures and options.
20 : template <typename System, typename = typename System::implicit_sectors>
21 1 : struct Initialize;
22 :
23 : /// \cond
24 : template <typename System, typename... Sectors>
25 : struct Initialize<System, tmpl::list<Sectors...>> {
26 : static_assert(tt::assert_conforms_to_v<System, protocols::ImexSystem>);
27 :
28 : using variables_tag = typename System::variables_tag;
29 : using example_tensor_tag =
30 : tmpl::front<typename tmpl::front<tmpl::list<Sectors...>>::tensors>;
31 :
32 : using const_global_cache_tags = tmpl::list<Tags::Mode, Tags::SolveTolerance>;
33 : using mutable_global_cache_tags = tmpl::list<>;
34 : using simple_tags_from_options = tmpl::list<>;
35 : using simple_tags = tmpl::list<Tags::ImplicitHistory<Sectors>...,
36 : Tags::SolveFailures<Sectors>...>;
37 : using compute_tags = tmpl::list<>;
38 :
39 : using return_tags = simple_tags;
40 : using argument_tags =
41 : tmpl::list<::Tags::HistoryEvolvedVariables<variables_tag>,
42 : example_tensor_tag>;
43 :
44 : static void apply(
45 : const gsl::not_null<
46 : typename Tags::ImplicitHistory<Sectors>::type*>... histories,
47 : const gsl::not_null<
48 : typename Tags::SolveFailures<Sectors>::type*>... solve_failures,
49 : const TimeSteppers::History<typename variables_tag::type>&
50 : explicit_history,
51 : const typename example_tensor_tag::type& example_tensor) {
52 : const auto order = explicit_history.integration_order();
53 : expand_pack((histories->integration_order(order), 0)...);
54 : expand_pack(*solve_failures = make_with_value<Scalar<DataVector>>(
55 : example_tensor, 0.0)...);
56 : }
57 : };
58 : /// \endcond
59 : } // namespace imex
|