SpECTRE  v2024.04.12
domain::FunctionsOfTime::QuaternionFunctionOfTime< MaxDeriv > Class Template Reference

A FunctionOfTime that stores quaternions for the rotation map. More...

#include <QuaternionFunctionOfTime.hpp>

Public Member Functions

 QuaternionFunctionOfTime (QuaternionFunctionOfTime &&)
 
 QuaternionFunctionOfTime (const QuaternionFunctionOfTime &)
 
QuaternionFunctionOfTimeoperator= (QuaternionFunctionOfTime &&)
 
QuaternionFunctionOfTimeoperator= (const QuaternionFunctionOfTime &)
 
 QuaternionFunctionOfTime (double t, const std::array< DataVector, 1 > &initial_quat_func, std::array< DataVector, MaxDeriv+1 > initial_angle_func, double expiration_time)
 
 QuaternionFunctionOfTime (CkMigrateMessage *)
 
auto get_clone () const -> std::unique_ptr< FunctionOfTime > override
 
 WRAPPED_PUPable_decl_template (QuaternionFunctionOfTime< MaxDeriv >)
 
std::array< double, 2 > time_bounds () const override
 Returns domain of validity for the function of time. More...
 
double expiration_after (double time) const override
 The first expiration time after time. More...
 
void update (double time_of_update, DataVector updated_max_deriv, double next_expiration_time) override
 Updates the MaxDerivth derivative of the angle piecewisepolynomial at the given time, then updates the stored quaternions. More...
 
void pup (PUP::er &p) override
 
std::array< DataVector, 1 > func (const double t) const override
 Returns the quaternion at an arbitrary time t. More...
 
std::array< DataVector, 2 > func_and_deriv (const double t) const override
 Returns the quaternion and its first derivative at an arbitrary time t. More...
 
std::array< DataVector, 3 > func_and_2_derivs (const double t) const override
 Returns the quaternion and the first two derivatives at an arbitrary time t. More...
 
std::array< DataVector, 1 > quat_func (double t) const
 Returns the quaternion at an arbitrary time t.
 
std::array< DataVector, 2 > quat_func_and_deriv (double t) const
 Returns the quaternion and its first derivative at an arbitrary time t.
 
std::array< DataVector, 3 > quat_func_and_2_derivs (double t) const
 Returns the quaternion and the first two derivatives at an arbitrary time t.
 
std::array< DataVector, 1 > angle_func (const double t) const
 Returns stored angle at an arbitrary time t.
 
std::array< DataVector, 2 > angle_func_and_deriv (const double t) const
 Returns stored angle and its first derivative (omega) at an arbitrary time t.
 
std::array< DataVector, 3 > angle_func_and_2_derivs (const double t) const
 Returns stored angle and the first two derivatives at an arbitrary time t.
 
- Public Member Functions inherited from domain::FunctionsOfTime::FunctionOfTime
 FunctionOfTime (FunctionOfTime &&)=default
 
FunctionOfTimeoperator= (FunctionOfTime &&)=default
 
 FunctionOfTime (const FunctionOfTime &)=default
 
FunctionOfTimeoperator= (const FunctionOfTime &)=default
 
virtual auto get_clone () const -> std::unique_ptr< FunctionOfTime >=0
 
virtual std::array< double, 2 > time_bounds () const =0
 Returns the domain of validity of the function. For FunctionsOfTime that allow a small amount of time extrapolation, time_bounds tells you the bounds including the allowed extrapolation interval. More...
 
virtual double expiration_after (double time) const =0
 The first expiration time after time. More...
 
virtual void update (double, DataVector, double)
 Updates the maximum derivative of the FunctionOfTime at a given time while also resetting the expiration. By default, a FunctionOfTime cannot be updated. More...
 
virtual std::array< DataVector, 1 > func (double t) const =0
 The DataVector can be of any size. More...
 
virtual std::array< DataVector, 2 > func_and_deriv (double t) const =0
 The DataVector can be of any size. More...
 
virtual std::array< DataVector, 3 > func_and_2_derivs (double t) const =0
 The DataVector can be of any size. More...
 
 WRAPPED_PUPable_abstract (FunctionOfTime)
 

Friends

template<size_t LocalMaxDeriv>
bool operator== (const QuaternionFunctionOfTime< LocalMaxDeriv > &lhs, const QuaternionFunctionOfTime< LocalMaxDeriv > &rhs)
 
template<size_t LocalMaxDeriv>
std::ostreamoperator<< (std::ostream &os, const QuaternionFunctionOfTime< LocalMaxDeriv > &quaternion_f_of_t)
 

Detailed Description

template<size_t MaxDeriv>
class domain::FunctionsOfTime::QuaternionFunctionOfTime< MaxDeriv >

A FunctionOfTime that stores quaternions for the rotation map.

Details

This FunctionOfTime stores quaternions that will be used in the time-dependent rotation map as well as the orbital angular velocity that will be controlled by the rotation control sytem. To get the quaternion, an ODE is solved of the form \( \dot{q} = \frac{1}{2} q \times \omega \) where \( \omega \) is the orbital angular velocity which is stored internally as the derivative of an angle PiecewisePolynomial, and \( \times \) here is quaternion multiplication.

Different from a PiecewisePolynomial, only the quaternion itself is stored, not any of the derivatives because the derivatives must be calculated from the solved ODE at every function call. Because derivatives of the quaternion are not stored, the template parameter MaxDeriv refers to both the max derivative of the stored angle PiecewisePolynomial and the max derivative returned by the QuaternionFunctionOfTime. The update function is then just a wrapper around the internal PiecewisePolynomial::update function with the addition that it then updates the stored quaternions as well.

The angle PiecewisePolynomial is accessible through the angle_func, angle_func_and_deriv, and angle_func_and_2_derivs functions which correspond to the function calls of a normal PiecewisePolynomial except without the angle_ prefix.

It is encouraged to use quat_func and angle_func when you want the specific values of the functions to avoid ambiguity in what you are calling. However, the original three func functions inherited from the FunctionOfTime base class are necessary because the maps use the generic func functions, thus they return the quaternion and its derivatives (which are needed for the map). This is all to keep the symmetry of naming angle_func and quat_func so that function calls won't be ambiguous.

Note
This class conforms to the requirements of the Parallel::GlobalCache for objects held by mutable global cache tags.

Member Function Documentation

◆ expiration_after()

template<size_t MaxDeriv>
double domain::FunctionsOfTime::QuaternionFunctionOfTime< MaxDeriv >::expiration_after ( double  time) const
overridevirtual

The first expiration time after time.

Details

For non-updatable functions, this returns infinity. For updatable functions, the first expiration time after time is found by determining the update immediately before time. The expiration time of this update is what is returned. If time happens to be an update itself, then the expiration of that update is returned.

Implements domain::FunctionsOfTime::FunctionOfTime.

◆ func()

template<size_t MaxDeriv>
std::array< DataVector, 1 > domain::FunctionsOfTime::QuaternionFunctionOfTime< MaxDeriv >::func ( const double  t) const
inlineoverridevirtual

Returns the quaternion at an arbitrary time t.

Implements domain::FunctionsOfTime::FunctionOfTime.

◆ func_and_2_derivs()

template<size_t MaxDeriv>
std::array< DataVector, 3 > domain::FunctionsOfTime::QuaternionFunctionOfTime< MaxDeriv >::func_and_2_derivs ( const double  t) const
inlineoverridevirtual

Returns the quaternion and the first two derivatives at an arbitrary time t.

Implements domain::FunctionsOfTime::FunctionOfTime.

◆ func_and_deriv()

template<size_t MaxDeriv>
std::array< DataVector, 2 > domain::FunctionsOfTime::QuaternionFunctionOfTime< MaxDeriv >::func_and_deriv ( const double  t) const
inlineoverridevirtual

Returns the quaternion and its first derivative at an arbitrary time t.

Implements domain::FunctionsOfTime::FunctionOfTime.

◆ get_clone()

template<size_t MaxDeriv>
auto domain::FunctionsOfTime::QuaternionFunctionOfTime< MaxDeriv >::get_clone ( ) const -> std::unique_ptr< FunctionOfTime >
overridevirtual

◆ time_bounds()

template<size_t MaxDeriv>
std::array< double, 2 > domain::FunctionsOfTime::QuaternionFunctionOfTime< MaxDeriv >::time_bounds ( ) const
overridevirtual

Returns domain of validity for the function of time.

Implements domain::FunctionsOfTime::FunctionOfTime.

◆ update()

template<size_t MaxDeriv>
void domain::FunctionsOfTime::QuaternionFunctionOfTime< MaxDeriv >::update ( double  time_of_update,
DataVector  updated_max_deriv,
double  next_expiration_time 
)
overridevirtual

Updates the MaxDerivth derivative of the angle piecewisepolynomial at the given time, then updates the stored quaternions.

updated_max_deriv is a datavector of the MaxDerivs for each component. next_expiration_time is the next expiration time.

The time_of_update must be the same as the old expiration time. It is passed as a check that the calling code is computing the other arguments with the correct value.

Reimplemented from domain::FunctionsOfTime::FunctionOfTime.


The documentation for this class was generated from the following file: