SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/GeneralRelativity - CubicCurvatureScalars.hpp Hit Total Coverage
Commit: 3ffcbc8ecf43797401b60bcca17d6040ee06f013 Lines: 4 19 21.1 %
Date: 2026-03-03 02:01:44
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/DataBox/Tag.hpp"
       9             : #include "DataStructures/Tensor/TypeAliases.hpp"
      10             : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
      11             : #include "Utilities/Gsl.hpp"
      12             : #include "Utilities/TMPL.hpp"
      13             : 
      14             : namespace gr {
      15             : 
      16             : /// @{
      17             : /*!
      18             :  * Computes the real part of the cubic invariant of the Weyl tensor from the
      19             :  * electric and magnetic parts. The cubic invariant is e.g. given in Equation
      20             :  * (10) of \cite Dennison:2012vf
      21             :  * \f[
      22             :  *   \mathcal{J} = \left(-\frac{1}{6} E^i_j E^j_k E^k_i + \frac{1}{2} E^i_j
      23             :  *    B^j_k B^k_i\right) + i\left(\frac{1}{6} B^i_j B^j_k B^k_i - \frac{1}{2}
      24             :  *    B^i_j E^j_k E^k_i\right)
      25             :  * \f]
      26             :  */
      27             : template <typename DataType, size_t Dim, typename Frame>
      28           1 : void cubic_invariant_real(
      29             :     gsl::not_null<Scalar<DataType>*> result,
      30             :     const tnsr::ii<DataType, Dim, Frame>& weyl_electric,
      31             :     const tnsr::ii<DataType, Dim, Frame>& weyl_magnetic,
      32             :     const tnsr::II<DataType, Dim, Frame>& inverse_spatial_metric);
      33             : 
      34             : template <typename DataType, size_t Dim, typename Frame>
      35           1 : Scalar<DataType> cubic_invariant_real(
      36             :     const tnsr::ii<DataType, Dim, Frame>& weyl_electric,
      37             :     const tnsr::ii<DataType, Dim, Frame>& weyl_magnetic,
      38             :     const tnsr::II<DataType, Dim, Frame>& inverse_spatial_metric);
      39             : /// @}
      40             : 
      41             : /// @{
      42             : /*!
      43             :  * Computes the imaginary part of the cubic invariant of the Weyl tensor from
      44             :  * the electric and magnetic parts. The cubic invariant is e.g. given in
      45             :  * Equation (10) of \cite Dennison:2012vf
      46             :  * \f[
      47             :  *   \mathcal{J} = \left(-\frac{1}{6} E^i_j E^j_k E^k_i + \frac{1}{2} E^i_j
      48             :  *    B^j_k B^k_i\right) + i\left(\frac{1}{6} B^i_j B^j_k B^k_i - \frac{1}{2}
      49             :  *    B^i_j E^j_k E^k_i\right)
      50             :  * \f]
      51             :  */
      52             : template <typename DataType, size_t Dim, typename Frame>
      53           1 : void cubic_invariant_imag(
      54             :     gsl::not_null<Scalar<DataType>*> result,
      55             :     const tnsr::ii<DataType, Dim, Frame>& weyl_electric,
      56             :     const tnsr::ii<DataType, Dim, Frame>& weyl_magnetic,
      57             :     const tnsr::II<DataType, Dim, Frame>& inverse_spatial_metric);
      58             : 
      59             : template <typename DataType, size_t Dim, typename Frame>
      60           1 : Scalar<DataType> cubic_invariant_imag(
      61             :     const tnsr::ii<DataType, Dim, Frame>& weyl_electric,
      62             :     const tnsr::ii<DataType, Dim, Frame>& weyl_magnetic,
      63             :     const tnsr::II<DataType, Dim, Frame>& inverse_spatial_metric);
      64             : /// @}
      65             : 
      66             : }  // namespace gr
      67             : 
      68             : namespace gr::Tags {
      69             : // Simple and compute tags for cubic invariants
      70             : template <typename DataType>
      71           0 : struct CubicInvariantReal : db::SimpleTag {
      72           0 :   using type = Scalar<DataType>;
      73             : };
      74             : 
      75             : template <typename DataType, size_t Dim, typename Frame>
      76           0 : struct CubicInvariantRealCompute : CubicInvariantReal<DataType>,
      77             :                                    db::ComputeTag {
      78           0 :   using argument_tags =
      79             :       tmpl::list<gr::Tags::WeylElectric<DataType, Dim, Frame>,
      80             :                  gr::Tags::WeylMagnetic<DataType, Dim, Frame>,
      81             :                  gr::Tags::InverseSpatialMetric<DataType, Dim, Frame>>;
      82           0 :   using return_type = Scalar<DataType>;
      83           0 :   static constexpr auto function = static_cast<void (*)(
      84             :       gsl::not_null<Scalar<DataType>*>, const tnsr::ii<DataType, Dim, Frame>&,
      85             :       const tnsr::ii<DataType, Dim, Frame>&,
      86             :       const tnsr::II<DataType, Dim, Frame>&)>(
      87             :       &gr::cubic_invariant_real<DataType, Dim, Frame>);
      88           0 :   using base = CubicInvariantReal<DataType>;
      89             : };
      90             : 
      91             : template <typename DataType>
      92           0 : struct CubicInvariantImag : db::SimpleTag {
      93           0 :   using type = Scalar<DataType>;
      94             : };
      95             : 
      96             : template <typename DataType, size_t Dim, typename Frame>
      97           0 : struct CubicInvariantImagCompute : CubicInvariantImag<DataType>,
      98             :                                    db::ComputeTag {
      99           0 :   using argument_tags =
     100             :       tmpl::list<gr::Tags::WeylElectric<DataType, Dim, Frame>,
     101             :                  gr::Tags::WeylMagnetic<DataType, Dim, Frame>,
     102             :                  gr::Tags::InverseSpatialMetric<DataType, Dim, Frame>>;
     103           0 :   using return_type = Scalar<DataType>;
     104           0 :   static constexpr auto function = static_cast<void (*)(
     105             :       gsl::not_null<Scalar<DataType>*>, const tnsr::ii<DataType, Dim, Frame>&,
     106             :       const tnsr::ii<DataType, Dim, Frame>&,
     107             :       const tnsr::II<DataType, Dim, Frame>&)>(
     108             :       &gr::cubic_invariant_imag<DataType, Dim, Frame>);
     109           0 :   using base = CubicInvariantImag<DataType>;
     110             : };
     111             : }  // namespace gr::Tags

Generated by: LCOV version 1.14