Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <array> 7 : #include <cstddef> 8 : #include <optional> 9 : #include <string> 10 : #include <variant> 11 : 12 : #include "DataStructures/DataVector.hpp" 13 : #include "Domain/Creators/TimeDependentOptions/FromVolumeFile.hpp" 14 : #include "Options/Auto.hpp" 15 : #include "Options/Context.hpp" 16 : #include "Options/String.hpp" 17 : #include "Utilities/TMPL.hpp" 18 : 19 : namespace domain::creators::time_dependent_options { 20 : /*! 21 : * \brief Class that holds hard coded translation map options from the input 22 : * file. 23 : * 24 : * \details This class can also be used as an option tag with the \p type type 25 : * alias, `name()` function, and \p help string. 26 : */ 27 : template <size_t Dim> 28 1 : struct TranslationMapOptions { 29 0 : using type = 30 : Options::Auto<std::variant<TranslationMapOptions<Dim>, FromVolumeFile>, 31 : Options::AutoLabel::None>; 32 0 : static std::string name() { return "TranslationMap"; } 33 0 : static constexpr Options::String help = { 34 : "Options for a time-dependent translation of the coordinates. Specify " 35 : "'None' to not use this map."}; 36 : 37 0 : struct InitialValues { 38 0 : using type = std::array<std::array<double, Dim>, 3>; 39 0 : static constexpr Options::String help = { 40 : "Initial values for the translation map. You can optionally specify " 41 : "its first two time derivatives. If time derivatives aren't specified, " 42 : "zero will be used."}; 43 : }; 44 : 45 0 : using options = tmpl::list<InitialValues>; 46 : 47 0 : TranslationMapOptions() = default; 48 : // NOLINTNEXTLINE(google-explicit-constructor) 49 0 : TranslationMapOptions( 50 : const std::array<std::array<double, Dim>, 3>& initial_values_in, 51 : const Options::Context& context = {}); 52 : 53 0 : std::array<DataVector, 3> initial_values{}; 54 : }; 55 : 56 : /*! 57 : * \brief Helper function that takes the variant of the translation map options, 58 : * and returns the fully constructed translation function of time. 59 : * 60 : * \details The function of time will have a new \p initial_time and \p 61 : * expiration_time, unless it is read from a file and is replaying. 62 : */ 63 : template <size_t Dim> 64 1 : std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime> get_translation( 65 : const std::variant<TranslationMapOptions<Dim>, FromVolumeFile>& 66 : translation_map_options, 67 : double initial_time, double expiration_time); 68 : } // namespace domain::creators::time_dependent_options