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 "Time/OptionTags/LocalTimeStepping.hpp" 9 : #include "Utilities/ErrorHandling/Error.hpp" 10 : #include "Utilities/TMPL.hpp" 11 : 12 : namespace Tags { 13 : /// \ingroup DataBoxTagsGroup 14 : /// \ingroup TimeGroup 15 : /// \brief The version of local time-stepping in use 16 1 : struct LtsMode : db::SimpleTag { 17 0 : using type = ::LtsMode; 18 : 19 0 : static constexpr bool pass_metavariables = false; 20 0 : using option_tags = tmpl::list<::OptionTags::LocalTimeStepping>; 21 : 22 0 : static type create_from_options(const type lts_mode) { return lts_mode; } 23 : }; 24 : 25 : /// \ingroup DataBoxTagsGroup 26 : /// \ingroup TimeGroup 27 : /// Version of LtsMode that forces a specific value, primarily for 28 : /// executables without LTS support. 29 : template <::LtsMode Mode> 30 1 : struct LtsModeForced : LtsMode { 31 0 : using base = LtsMode; 32 : 33 0 : static type create_from_options(const type lts_mode) { 34 : // Check consistency rather than just returning the forced mode so 35 : // that other tag creation functions can rely on the parsed value 36 : // being correct. 37 : if (lts_mode != Mode) { 38 : ERROR_NO_TRACE( 39 : "This executable only supports LocalTimeStepping: " << Mode); 40 : } 41 : return lts_mode; 42 : } 43 : }; 44 : } // namespace Tags