SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/SpecialRelativity - LorentzBoostMatrix.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 87.5 % 8 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              : 
       9              : #include "DataStructures/Tensor/Tensor.hpp"
      10              : #include "Utilities/Gsl.hpp"
      11              : #include "Utilities/MakeArray.hpp"
      12              : 
      13              : /// \cond
      14              : namespace gsl {
      15              : template <typename T>
      16              : class not_null;
      17              : }  // namespace gsl
      18              : 
      19              : /// \endcond
      20              : 
      21              : /// \ingroup SpecialRelativityGroup
      22              : /// Holds functions related to special relativity.
      23            1 : namespace sr {
      24              : /// @{
      25              : /*!
      26              :  * \ingroup SpecialRelativityGroup
      27              :  * \brief Computes the matrix for a Lorentz boost from a single
      28              :  * velocity vector (i.e., not a velocity field).
      29              :  *
      30              :  * \details Given a spatial velocity vector \f$v^i\f$ (with \f$c=1\f$),
      31              :  * compute the matrix \f$\Lambda^{a}{}_{\bar{a}}\f$ for a Lorentz boost with
      32              :  * that velocity [e.g. Eq. (2.38) of \cite ThorneBlandford2017]:
      33              :  *
      34              :  * \f{align}{
      35              :  * \Lambda^t{}_{\bar{t}} &= \gamma, \\
      36              :  * \Lambda^t{}_{\bar{i}} = \Lambda^i{}_{\bar{t}} &= \gamma v^i, \\
      37              :  * \Lambda^i{}_{\bar{j}} = \Lambda^j{}_{\bar{i}} &= [(\gamma - 1)/v^2] v^i v^j
      38              :  *                                              + \delta^{ij}.
      39              :  * \f}
      40              :  *
      41              :  * Here \f$v = \sqrt{\delta_{ij} v^i v^j}\f$, \f$\gamma = 1/\sqrt{1-v^2}\f$,
      42              :  * and \f$\delta^{ij}\f$ is the Kronecker delta. Note that this matrix boosts
      43              :  * a one-form from the unbarred to the barred frame, and its inverse
      44              :  * (obtained via \f$v \rightarrow -v\f$) boosts a vector from the barred to
      45              :  * the unbarred frame.
      46              :  *
      47              :  * Note that while the Lorentz boost matrix is symmetric, the returned
      48              :  * boost matrix is of type `tnsr::Ab`, because `Tensor` does not support
      49              :  * symmetric tensors unless both indices have the same valence.
      50              :  */
      51              : template <size_t SpatialDim>
      52            1 : tnsr::Ab<double, SpatialDim, Frame::NoFrame> lorentz_boost_matrix(
      53              :     const tnsr::I<double, SpatialDim, Frame::NoFrame>& velocity);
      54              : 
      55              : template <size_t SpatialDim>
      56            1 : void lorentz_boost_matrix(
      57              :     gsl::not_null<tnsr::Ab<double, SpatialDim, Frame::NoFrame>*> boost_matrix,
      58              :     const tnsr::I<double, SpatialDim, Frame::NoFrame>& velocity);
      59              : 
      60              : template <size_t SpatialDim>
      61            1 : tnsr::Ab<double, SpatialDim, Frame::NoFrame> lorentz_boost_matrix(
      62              :     const std::array<double, SpatialDim>& velocity);
      63              : /// @}
      64              : 
      65              : /// @{
      66              : /*!
      67              :  * \ingroup SpecialRelativityGroup
      68              :  * \brief Apply a Lorentz boost to the spatial part of a vector.
      69              :  * \details This requires passing the 0th component of the vector as an
      70              :  * additional argument.
      71              :  */
      72              : template <typename DataType, size_t SpatialDim, typename Frame>
      73            1 : void lorentz_boost(gsl::not_null<tnsr::I<DataType, SpatialDim, Frame>*> result,
      74              :                    const tnsr::I<DataType, SpatialDim, Frame>& vector,
      75              :                    double vector_component_0,
      76              :                    const std::array<double, SpatialDim>& velocity);
      77              : 
      78              : /*!
      79              :  * \brief Apply a Lorentz boost to a one form.
      80              :  */
      81              : template <typename DataType, size_t SpatialDim, typename Frame>
      82            1 : void lorentz_boost(
      83              :     gsl::not_null<tnsr::a<DataType, SpatialDim, Frame>*> result,
      84              :     const tnsr::a<DataType, SpatialDim, Frame>& one_form,
      85              :     const std::array<double, SpatialDim>& velocity);
      86              : 
      87              : /*!
      88              :  * \brief Apply a Lorentz boost to each component of a rank-2 tensor with
      89              :  * lower or covariant indices.
      90              :  * \note In the future we might want to write a single function capable to boost
      91              :  * a tensor of arbitrary rank.
      92              :  */
      93              : template <typename DataType, size_t SpatialDim, typename Frame>
      94            1 : void lorentz_boost(gsl::not_null<tnsr::ab<DataType, SpatialDim, Frame>*> result,
      95              :                    const tnsr::ab<DataType, SpatialDim, Frame>& tensor,
      96              :                    const std::array<double, SpatialDim>& velocity);
      97              : /// @}
      98              : }  // namespace sr
        

Generated by: LCOV version 2.0-1