SpECTRE Documentation Coverage Report
Current view: top level - Domain/Creators/TimeDependentOptions - RotationMap.hpp Hit Total Coverage
Commit: 923cd4a8ea30f5a5589baa60b0a93e358ca9f8e8 Lines: 2 25 8.0 %
Date: 2025-11-07 19:37:56
Legend: Lines: hit not hit

          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/Options.hpp"
      19             : #include "Options/String.hpp"
      20             : #include "Utilities/TMPL.hpp"
      21             : 
      22             : namespace domain::creators::time_dependent_options {
      23             : /*!
      24             :  * \brief Class that holds hard coded rotation map options from the input file.
      25             :  *
      26             :  * \details This class can also be used as an option tag with the \p type type
      27             :  * alias, `name()` function, and \p help string.
      28             :  */
      29             : template <bool AllowSettleFoTs>
      30           1 : struct RotationMapOptions {
      31           0 :   using type = Options::Auto<
      32             :       std::variant<RotationMapOptions<AllowSettleFoTs>, FromVolumeFile>,
      33             :       Options::AutoLabel::None>;
      34           0 :   static std::string name() { return "RotationMap"; }
      35           0 :   static constexpr Options::String help = {
      36             :       "Options for a time-dependent rotation of the coordinates. Specify "
      37             :       "'None' to not use this map."};
      38             : 
      39           0 :   struct InitialQuaternions {
      40           0 :     using type = std::vector<std::array<double, 4>>;
      41           0 :     static constexpr Options::String help = {
      42             :         "Initial values for the quaternion of the rotation map. You can "
      43             :         "optionally specify its first two time derivatives. If time "
      44             :         "derivatives aren't specified, zero will be used."};
      45             :   };
      46             : 
      47           0 :   struct InitialAngularVelocity {
      48           0 :     using type = std::array<double, 3>;
      49           0 :     static constexpr Options::String help = {"The initial angular velocity."};
      50             :   };
      51             : 
      52           0 :   struct DecayTimescale {
      53           0 :     using type = double;
      54           0 :     static constexpr Options::String help = {
      55             :         "The timescale for how fast the rotation approaches its asymptotic "
      56             :         "value with a SettleToConstant function of time."};
      57             :   };
      58             : 
      59           0 :   using non_settle_options = tmpl::list<InitialAngularVelocity>;
      60           0 :   using settle_options = tmpl::list<InitialQuaternions, DecayTimescale>;
      61             : 
      62           0 :   using options = tmpl::conditional_t<
      63             :       AllowSettleFoTs,
      64             :       tmpl::list<Options::Alternatives<non_settle_options, settle_options>>,
      65             :       non_settle_options>;
      66             : 
      67           0 :   RotationMapOptions() = default;
      68             :   // Constructor for non SettleToConstant functions of time
      69             :   // NOLINTNEXTLINE(google-explicit-constructor)
      70           0 :   RotationMapOptions(const std::array<double, 3>& initial_angular_velocity,
      71             :                      const Options::Context& context = {});
      72             :   // Constructor for SettleToConst functions of time
      73           0 :   RotationMapOptions(
      74             :       const std::vector<std::array<double, 4>>& initial_quaternions,
      75             :       double decay_timescale_in, const Options::Context& context = {});
      76             : 
      77           0 :   std::array<DataVector, 3> quaternions{};
      78           0 :   std::array<DataVector, 4> angles{};
      79           0 :   std::optional<double> decay_timescale;
      80             : 
      81             :  private:
      82           0 :   void initialize_angles_and_quats();
      83             : };
      84             : 
      85             : /*!
      86             :  * \brief Helper function that takes the variant of the rotation map options,
      87             :  * and returns the fully constructed rotation function of time.
      88             :  *
      89             :  * \details The function of time will have a new \p initial_time and \p
      90             :  * expiration_time, unless it is read from a file and is replaying.
      91             :  */
      92             : template <bool AllowSettleFoTs>
      93           1 : std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime> get_rotation(
      94             :     const std::variant<RotationMapOptions<AllowSettleFoTs>, FromVolumeFile>&
      95             :         rotation_map_options,
      96             :     double initial_time, double expiration_time);
      97             : }  // namespace domain::creators::time_dependent_options

Generated by: LCOV version 1.14