SpECTRE Documentation Coverage Report
Current view: top level - Domain/FunctionsOfTime - QuaternionHelpers.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 50.0 % 8 4
Test Date: 2026-10-22 17:29:42
Legend: Lines:     hit not hit

            Line data    Source code
       1            1 : // Distributed under the MIT License.
       2              : // See LICENSE.txt for details.
       3              : 
       4              : /// \file
       5              : /// Defines helper functions for converting between `DataVector`s and boost
       6              : /// quaternions.
       7              : 
       8              : #pragma once
       9              : 
      10              : #include "DataStructures/BoostMultiArray.hpp"
      11              : 
      12              : #include <boost/math/quaternion.hpp>
      13              : #include <boost/numeric/odeint.hpp>
      14              : 
      15              : #include "DataStructures/DataVector.hpp"
      16              : 
      17              : /// \cond
      18              : namespace gsl {
      19              : template <class T>
      20              : class not_null;
      21              : }  // namespace gsl
      22              : /// \endcond
      23              : 
      24              : /// Convert a `boost::math::quaternion` to a `DataVector`
      25            1 : DataVector quaternion_to_datavector(
      26              :     const boost::math::quaternion<double>& input);
      27              : 
      28              : /// \brief Convert a `DataVector` to a `boost::math::quaternion`
      29              : ///
      30              : /// \details To convert to a quaternion, a `DataVector` must have either 3 or 4
      31              : /// components. If it has 3 components, the quaternion will be constructed with
      32              : /// 0 scalar part while the vector part is the `DataVector`. If the `DataVector`
      33              : /// has 4 components, the quaternion is just the `DataVector` itself.
      34            1 : boost::math::quaternion<double> datavector_to_quaternion(
      35              :     const DataVector& input);
      36              : 
      37              : /// Normalize a `boost::math::quaternion`
      38            1 : void normalize_quaternion(
      39              :     gsl::not_null<boost::math::quaternion<double>*> input);
      40              : 
      41              : // Necessary for odeint to be able to integrate boost quaternions
      42            0 : namespace boost::numeric::odeint {
      43              : template <>
      44            0 : struct vector_space_norm_inf<boost::math::quaternion<double>> {
      45            0 :   using result_type = double;
      46            0 :   result_type operator()(const boost::math::quaternion<double>& q) const {
      47              :     return sup(q);
      48              :   }
      49              : };
      50              : }  // namespace boost::numeric::odeint
        

Generated by: LCOV version 2.0-1