Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include "DataStructures/DataBox/Tag.hpp" 7 : #include "Time/LtsMode.hpp" 8 : #include "Utilities/ErrorHandling/Error.hpp" 9 : #include "Utilities/TMPL.hpp" 10 : 11 : namespace Tags { 12 : /// \ingroup DataBoxTagsGroup 13 : /// \ingroup TimeGroup 14 : /// \brief The version of local time-stepping in use 15 1 : struct LtsMode : db::SimpleTag { 16 0 : using type = ::LtsMode; 17 : 18 0 : static constexpr bool pass_metavariables = true; 19 : 20 : template <typename Metavars> 21 0 : using option_tags = tmpl::list<>; 22 : 23 : template <typename Metavars> 24 0 : static type create_from_options() { 25 : return Metavars::local_time_stepping ? ::LtsMode::Conservative 26 : : ::LtsMode::Off; 27 : } 28 : }; 29 : 30 : /// \ingroup DataBoxTagsGroup 31 : /// \ingroup TimeGroup 32 : /// Version of LtsMode that forces a specific value, primarily for 33 : /// executables without LTS support. 34 : template <::LtsMode Mode> 35 1 : struct LtsModeForced : LtsMode { 36 0 : using base = LtsMode; 37 : 38 : template <typename Metavars> 39 0 : static type create_from_options() { 40 : // Check consistency rather than just returning the forced mode so 41 : // that other tag creation functions can rely on the parsed value 42 : // being correct. 43 : const auto lts_mode = Metavars::local_time_stepping 44 : ? ::LtsMode::Conservative 45 : : ::LtsMode::Off; 46 : if (lts_mode != Mode) { 47 : ERROR_NO_TRACE( 48 : "This executable only supports LocalTimeStepping: " << Mode); 49 : } 50 : return lts_mode; 51 : } 52 : }; 53 : } // namespace Tags