SpECTRE Documentation Coverage Report
Current view: top level - Domain/FunctionsOfTime - SettleToConstantQuaternion.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 28.0 % 25 7
Test Date: 2026-10-22 17:29:42
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 <limits>
       9              : #include <memory>
      10              : #include <pup.h>
      11              : 
      12              : #include "DataStructures/DataVector.hpp"
      13              : #include "Domain/FunctionsOfTime/FunctionOfTime.hpp"
      14              : #include "Domain/FunctionsOfTime/SettleToConstant.hpp"
      15              : #include "Utilities/Serialization/CharmPupable.hpp"
      16              : 
      17              : namespace domain::FunctionsOfTime {
      18              : /// \ingroup ControlSystemGroup
      19              : /// \brief Given an initial function of time that is a unit quaternion,
      20              : /// transitions to a constant-in-time unit quaternion.
      21              : ///
      22              : /// Given an initial unit quaternion \f$\mathbf{f}(t)\f$ and its first two
      23              : /// derivatives at the matching time \f$t_0\f$, return a function of time
      24              : /// \f$\mathbf{g}(t)\f$ satisfies \f$\mathbf{g}(t=t_0)=\mathbf{f}f(t=t_0)\f$ and
      25              : /// approaches a constant value for \f$t > t_0\f$ on a timescale of \f$\tau\f$.
      26              : /// This is done by internally holding a `SettleToConstant` function of time
      27              : /// initialized from \f$\mathbf{f}(t)\f$ and its first two derivatives at the
      28              : /// matching time, but then ensuring that \f$\mathbf{g}(t)\f$ remains
      29              : /// a unit quaternion.
      30            1 : class SettleToConstantQuaternion : public FunctionOfTime {
      31              :  public:
      32            0 :   SettleToConstantQuaternion() = default;
      33            0 :   SettleToConstantQuaternion(
      34              :       const std::array<DataVector, 3>& initial_func_and_derivs,
      35              :       double match_time, double decay_time);
      36              : 
      37            0 :   ~SettleToConstantQuaternion() override = default;
      38            0 :   SettleToConstantQuaternion(SettleToConstantQuaternion&&) = default;
      39            0 :   SettleToConstantQuaternion& operator=(SettleToConstantQuaternion&&) = default;
      40            0 :   SettleToConstantQuaternion(const SettleToConstantQuaternion&) = default;
      41            0 :   SettleToConstantQuaternion& operator=(const SettleToConstantQuaternion&) =
      42              :       default;
      43              : 
      44              :   // NOLINTNEXTLINE(google-runtime-references)
      45            0 :   WRAPPED_PUPable_decl_template(SettleToConstantQuaternion);
      46              : 
      47            0 :   explicit SettleToConstantQuaternion(CkMigrateMessage* /*unused*/) {}
      48              : 
      49            0 :   auto get_clone() const -> std::unique_ptr<FunctionOfTime> override;
      50              : 
      51              :   /// Returns the function at an arbitrary time `t`.
      52            1 :   std::array<DataVector, 1> func(double t) const override;
      53              :   /// Returns the function and its first derivative at an arbitrary time `t`.
      54            1 :   std::array<DataVector, 2> func_and_deriv(double t) const override;
      55              :   /// Returns the function and the first two derivatives at an arbitrary time
      56              :   /// `t`.
      57            1 :   std::array<DataVector, 3> func_and_2_derivs(double t) const override;
      58              : 
      59              :   /// Returns the domain of validity of the function.
      60            1 :   std::array<double, 2> time_bounds() const override;
      61              : 
      62            1 :   double expiration_after(double time) const override;
      63              : 
      64            1 :   void truncate_at_time(double time) override;
      65              : 
      66              :   // NOLINTNEXTLINE(google-runtime-references)
      67            0 :   void pup(PUP::er& p) override;
      68              : 
      69              :  private:
      70            0 :   friend bool operator==(const SettleToConstantQuaternion& lhs,
      71              :                          const SettleToConstantQuaternion& rhs);
      72              : 
      73              :   template <size_t MaxDerivReturned = 2>
      74            0 :   std::array<DataVector, MaxDerivReturned + 1> func_and_derivs(double t) const;
      75              : 
      76            0 :   SettleToConstant unnormalized_function_of_time_;
      77            0 :   double match_time_{std::numeric_limits<double>::signaling_NaN()};
      78            0 :   double decay_time_{std::numeric_limits<double>::signaling_NaN()};
      79              : };
      80              : 
      81            0 : bool operator!=(const SettleToConstantQuaternion& lhs,
      82              :                 const SettleToConstantQuaternion& rhs);
      83              : }  // namespace domain::FunctionsOfTime
        

Generated by: LCOV version 2.0-1