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 skew 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 1 : struct SkewMapOptions {
28 : private:
29 0 : struct Y {};
30 0 : struct Z {};
31 :
32 : public:
33 0 : using type = Options::Auto<std::variant<SkewMapOptions, FromVolumeFile>,
34 : Options::AutoLabel::None>;
35 0 : static std::string name() { return "SkewMap"; }
36 0 : static constexpr Options::String help = {
37 : "Options for a time-dependent skew of the x coordinate (y and z "
38 : "coordinates are left unchanged). Specify 'None' to not use this map."};
39 :
40 : template <typename Coord>
41 0 : struct InitialValues {
42 0 : using type = std::array<double, 3>;
43 0 : static std::string name() {
44 : return "InitialValues" + pretty_type::name<Coord>();
45 : }
46 0 : static constexpr Options::String help =
47 : "Initial value, and two time derivatives.";
48 : };
49 :
50 0 : using options = tmpl::list<InitialValues<Y>, InitialValues<Z>>;
51 :
52 0 : SkewMapOptions() = default;
53 0 : SkewMapOptions(const std::array<double, 3>& initial_angles_y_in,
54 : const std::array<double, 3>& initial_angles_z_in);
55 :
56 0 : std::array<double, 3> initial_angles_y{};
57 0 : std::array<double, 3> initial_angles_z{};
58 : };
59 :
60 : /*!
61 : * \brief Helper function that takes the variant of the skew map options,
62 : * and returns the fully constructed skew function of time.
63 : *
64 : * \details The function of time will have a new \p initial_time and \p
65 : * expiration_time, unless it is read from a file and is replaying.
66 : */
67 1 : std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime> get_skew(
68 : const std::variant<SkewMapOptions, FromVolumeFile>& skew_map_options,
69 : double initial_time, double expiration_time);
70 : } // namespace domain::creators::time_dependent_options
|