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 example_tensor_tag = 29 : tmpl::front<typename tmpl::front<tmpl::list<Sectors...>>::tensors>; 30 : 31 : using const_global_cache_tags = tmpl::list<Tags::Mode, Tags::SolveTolerance>; 32 : using mutable_global_cache_tags = tmpl::list<>; 33 : using simple_tags_from_options = tmpl::list<>; 34 : using simple_tags = tmpl::list<Tags::ImplicitHistory<Sectors>..., 35 : Tags::SolveFailures<Sectors>...>; 36 : using compute_tags = tmpl::list<>; 37 : 38 : using return_tags = simple_tags; 39 : using argument_tags = 40 : tmpl::list<::Tags::HistoryEvolvedVariables<>, example_tensor_tag>; 41 : 42 : static void apply( 43 : const gsl::not_null< 44 : typename Tags::ImplicitHistory<Sectors>::type*>... histories, 45 : const gsl::not_null< 46 : typename Tags::SolveFailures<Sectors>::type*>... solve_failures, 47 : const TimeSteppers::History<typename System::variables_tag::type>& 48 : explicit_history, 49 : const typename example_tensor_tag::type& example_tensor) { 50 : const auto order = explicit_history.integration_order(); 51 : expand_pack((histories->integration_order(order), 0)...); 52 : expand_pack(*solve_failures = make_with_value<Scalar<DataVector>>( 53 : example_tensor, 0.0)...); 54 : } 55 : }; 56 : /// \endcond 57 : } // namespace imex