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 0 : struct AnalyticSolutionOrData : db::BaseTag {}; 34 : 35 : /// Can be used to retrieve the analytic solution from the cache without having 36 : /// to know the template parameters of AnalyticData. 37 1 : struct AnalyticDataBase : AnalyticSolutionOrData {}; 38 : 39 : /// The analytic data, with the type of the analytic data set as the 40 : /// template parameter 41 : template <typename DataType> 42 1 : struct AnalyticData : AnalyticDataBase, db::SimpleTag { 43 0 : using type = DataType; 44 0 : using option_tags = tmpl::list<::OptionTags::AnalyticData<DataType>>; 45 : 46 0 : static constexpr bool pass_metavariables = false; 47 0 : static DataType create_from_options(const DataType& analytic_solution) { 48 : return deserialize<type>(serialize<type>(analytic_solution).data()); 49 : } 50 : }; 51 : } // namespace Tags