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 <utility> 11 : #include <variant> 12 : #include <vector> 13 : 14 : #include "DataStructures/DataVector.hpp" 15 : #include "Domain/Creators/TimeDependentOptions/FromVolumeFile.hpp" 16 : #include "Options/Auto.hpp" 17 : #include "Options/Context.hpp" 18 : #include "Options/String.hpp" 19 : #include "Utilities/TMPL.hpp" 20 : 21 : namespace domain::creators::time_dependent_options { 22 : /*! 23 : * \brief Class to be used as an option for initializing rotation map 24 : * coefficients. 25 : */ 26 : template <size_t NumDerivs> 27 1 : struct RotationMapOptions { 28 0 : using type = Options::Auto<RotationMapOptions, Options::AutoLabel::None>; 29 0 : static std::string name() { return "RotationMap"; } 30 0 : static constexpr Options::String help = { 31 : "Options for a time-dependent rotation of the coordinates. Specify " 32 : "'None' to not use this map."}; 33 : 34 0 : struct InitialQuaternions { 35 0 : using type = std::variant<std::vector<std::array<double, 4>>, 36 : FromVolumeFile<names::Rotation>>; 37 0 : static constexpr Options::String help = { 38 : "Initial values for the quaternion of the rotation map. You can " 39 : "optionally specify its first two time derivatives. If time " 40 : "derivatives aren't specified, zero will be used."}; 41 : }; 42 : 43 0 : struct InitialAngles { 44 0 : using type = Options::Auto<std::vector<std::array<double, 3>>>; 45 0 : static constexpr Options::String help = { 46 : "Initial values for the angle of the rotation map. If 'Auto' is " 47 : "specified, the behavior will depend on the 'InitialQuaternions' " 48 : "option. If you are reading the quaternion from a volume file, 'Auto' " 49 : "will use the angle values from the volume file. If you are simply " 50 : "specifying the quaternion and (optionally) its time derivatives, then " 51 : "'Auto' here will set the angle and its time derivatives to zero. If " 52 : "values are specified for the angle and its time derivatives, then " 53 : "those will override anything computed from the 'InitialQuaternions' " 54 : "option."}; 55 : }; 56 : 57 0 : struct DecayTimescale { 58 0 : using type = Options::Auto<double>; 59 0 : static constexpr Options::String help = { 60 : "The timescale for how fast the rotation approaches its asymptotic " 61 : "value. If this is specified, a SettleToConstant function of time will " 62 : "be used. If 'Auto' is specified, a PiecewisePolynomial function of " 63 : "time will be used. Note that if you are reading the initial " 64 : "quaternions from a volume file, then this option must be 'Auto'"}; 65 : }; 66 : 67 0 : using options = tmpl::list<InitialQuaternions, InitialAngles, DecayTimescale>; 68 : 69 0 : RotationMapOptions() = default; 70 0 : RotationMapOptions( 71 : std::variant<std::vector<std::array<double, 4>>, 72 : FromVolumeFile<names::Rotation>> 73 : initial_quaternions, 74 : std::optional<std::vector<std::array<double, 3>>> initial_angles, 75 : std::optional<double> decay_timescale_in, 76 : const Options::Context& context = {}); 77 : 78 0 : std::array<DataVector, NumDerivs + 1> quaternions{}; 79 0 : std::array<DataVector, NumDerivs + 1> angles{}; 80 0 : std::optional<double> decay_timescale{}; 81 : }; 82 : } // namespace domain::creators::time_dependent_options