SpECTRE Documentation Coverage Report
Current view: top level - Domain/CoordinateMaps - SphericalToCartesianPfaffian.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 1 17 5.9 %
Date: 2025-12-05 05:03:31
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 <optional>
       9             : 
      10             : #include "DataStructures/Tensor/TypeAliases.hpp"
      11             : #include "Utilities/TypeTraits/RemoveReferenceWrapper.hpp"
      12             : 
      13             : /// \cond
      14             : namespace PUP {
      15             : class er;
      16             : }  // namespace PUP
      17             : /// \endcond
      18             : 
      19             : namespace domain::CoordinateMaps {
      20             : 
      21             : /*!
      22             :  * \ingroup CoordinateMapsGroup
      23             :  *
      24             :  * \brief Pfaffian transformation from spherical to Cartesian coordinates.
      25             :  *
      26             :  * \note This map is designed to be used together with Spherepack! Spherepack
      27             :  * expects a Pfaffian transformation of the derivatives.
      28             :  *
      29             :  * \details This is a Pfaffian mapping from \f$(r,\theta,\phi) \rightarrow
      30             :  * (x,y,z) \f$.
      31             :  *
      32             :  * The formula for the mapping is...
      33             :  * \f{eqnarray*}
      34             :  *     x &=& r \sin\theta \cos\phi \\
      35             :  *     y &=& r \sin\theta \sin\phi \\
      36             :  *     z &=& r \cos\theta
      37             :  * \f}
      38             :  *
      39             :  * The Pfaffian basis vectors
      40             :  * \f$ (e_{\hat r}, e_{\hat \theta}, e_{\hat \phi})\f$
      41             :  * are related to the coordinate basis vectors
      42             :  * \f$ (e_r, e_{\theta}, e_{\phi})\f$
      43             :  * by...
      44             :  * \f{eqnarray*}
      45             :  *     e_{\hat r}      &=& e_r \\
      46             :  *     e_{\hat \theta} &=& e_{\theta} \\
      47             :  *     e_{\hat \phi}   &=& \frac{1}{\sin \theta} e_{\phi}
      48             :  * \f}
      49             :  */
      50           1 : class SphericalToCartesianPfaffian {
      51             :  public:
      52           0 :   static constexpr size_t dim = 3;
      53           0 :   SphericalToCartesianPfaffian();
      54           0 :   ~SphericalToCartesianPfaffian() = default;
      55           0 :   SphericalToCartesianPfaffian(SphericalToCartesianPfaffian&&);
      56           0 :   SphericalToCartesianPfaffian(const SphericalToCartesianPfaffian&);
      57           0 :   SphericalToCartesianPfaffian& operator=(const SphericalToCartesianPfaffian&);
      58           0 :   SphericalToCartesianPfaffian& operator=(SphericalToCartesianPfaffian&&);
      59             : 
      60             :   template <typename T>
      61           0 :   std::array<tt::remove_cvref_wrap_t<T>, 3> operator()(
      62             :       const std::array<T, 3>& source_coords) const;
      63             : 
      64             :   // NOLINTNEXTLINE(readability-convert-member-functions-to-static)
      65           0 :   std::optional<std::array<double, 3>> inverse(
      66             :       const std::array<double, 3>& target_coords) const;
      67             : 
      68             :   template <typename T>
      69           0 :   tnsr::Ij<tt::remove_cvref_wrap_t<T>, 3, Frame::NoFrame> jacobian(
      70             :       const std::array<T, 3>& source_coords) const;
      71             : 
      72             :   template <typename T>
      73           0 :   tnsr::Ij<tt::remove_cvref_wrap_t<T>, 3, Frame::NoFrame> inv_jacobian(
      74             :       const std::array<T, 3>& source_coords) const;
      75             : 
      76             :   // NOLINTNEXTLINE(google-runtime-references)
      77           0 :   void pup(PUP::er& p);
      78             : 
      79           0 :   static constexpr bool is_identity() { return false; }
      80             : };
      81             : 
      82           0 : bool operator==(const SphericalToCartesianPfaffian& lhs,
      83             :                 const SphericalToCartesianPfaffian& rhs);
      84             : 
      85           0 : bool operator!=(const SphericalToCartesianPfaffian& lhs,
      86             :                 const SphericalToCartesianPfaffian& rhs);
      87             : }  // namespace domain::CoordinateMaps

Generated by: LCOV version 1.14