SpECTRE Documentation Coverage Report
Current view: top level - DataStructures/Tensor/EagerMath - CartesianToSpherical.hpp Hit Total Coverage
Commit: a8efe75339f4781ca06d43fed14c40144d5e8a08 Lines: 4 5 80.0 %
Date: 2024-10-17 21:19:21
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 <cstddef>
       7             : 
       8             : #include "DataStructures/Tensor/Tensor.hpp"
       9             : #include "Utilities/Gsl.hpp"
      10             : 
      11             : /// @{
      12             : /*!
      13             :  * \brief Convert between Cartesian and spherical coordinates (r, theta, phi)
      14             :  *
      15             :  * In 2D the order is (r, phi), and in 3D the order is (r, theta, phi), as
      16             :  * defined by `Frame::Spherical`. The conventions for the angles are as follows:
      17             :  *
      18             :  * - phi is the azimuthal angle (-pi, pi], measuring the angle from the x-axis
      19             :  * - theta is the polar angle [0, pi], measuring the angle from the z-axis
      20             :  */
      21             : template <typename DataType, size_t Dim, typename CoordsFrame>
      22           1 : void cartesian_to_spherical(
      23             :     gsl::not_null<tnsr::I<DataType, Dim, Frame::Spherical<CoordsFrame>>*>
      24             :         result,
      25             :     const tnsr::I<DataType, Dim, CoordsFrame>& x);
      26             : 
      27             : template <typename DataType, size_t Dim, typename CoordsFrame>
      28           1 : tnsr::I<DataType, Dim, Frame::Spherical<CoordsFrame>> cartesian_to_spherical(
      29             :     const tnsr::I<DataType, Dim, CoordsFrame>& x);
      30             : 
      31             : template <typename DataType, size_t Dim, typename CoordsFrame>
      32           1 : void spherical_to_cartesian(
      33             :     gsl::not_null<tnsr::I<DataType, Dim, CoordsFrame>*> result,
      34             :     const tnsr::I<DataType, Dim, Frame::Spherical<CoordsFrame>>& x);
      35             : 
      36             : template <typename DataType, size_t Dim, typename CoordsFrame>
      37           1 : tnsr::I<DataType, Dim, CoordsFrame> spherical_to_cartesian(
      38             :     const tnsr::I<DataType, Dim, Frame::Spherical<CoordsFrame>>& x);
      39             : /// @}

Generated by: LCOV version 1.14