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 "Options/String.hpp" 8 : #include "Utilities/PrettyType.hpp" 9 : #include "Utilities/Serialization/Serialize.hpp" 10 : 11 : namespace OptionTags { 12 : /// \ingroup OptionGroupsGroup 13 : /// Holds the `OptionTags::AnalyticData` option in the input file 14 1 : struct AnalyticDataGroup { 15 0 : static std::string name() { return "AnalyticData"; } 16 0 : static constexpr Options::String help = 17 : "Analytic data used for the initial data"; 18 : }; 19 : 20 : /// \ingroup OptionTagsGroup 21 : /// The analytic data, with the type of the analytic data set as the template 22 : /// parameter 23 : template <typename DataType> 24 1 : struct AnalyticData { 25 0 : static std::string name() { return pretty_type::name<DataType>(); } 26 0 : static constexpr Options::String help = "Options for the analytic data"; 27 0 : using type = DataType; 28 0 : using group = AnalyticDataGroup; 29 : }; 30 : } // namespace OptionTags 31 : 32 : namespace Tags { 33 : /// The analytic data, with the type of the analytic data set as the 34 : /// template parameter 35 : template <typename DataType> 36 1 : struct AnalyticData : db::SimpleTag { 37 0 : using type = DataType; 38 0 : using option_tags = tmpl::list<::OptionTags::AnalyticData<DataType>>; 39 : 40 0 : static constexpr bool pass_metavariables = false; 41 0 : static DataType create_from_options(const DataType& analytic_solution) { 42 : return deserialize<type>(serialize<type>(analytic_solution).data()); 43 : } 44 : }; 45 : } // namespace Tags