SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/GeneralRelativity - InverseSpacetimeMetric.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 37.5 % 8 3
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 <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              : /// \ingroup GeneralRelativityGroup
      15              : /// Holds functions related to general relativity.
      16              : namespace gr {
      17              : /// @{
      18              : /*!
      19              :  * \ingroup GeneralRelativityGroup
      20              :  * \brief Compute inverse spacetime metric from inverse spatial metric, lapse
      21              :  * and shift
      22              :  *
      23              :  * \details The inverse spacetime metric \f$ g^{ab} \f$ is calculated as
      24              :  * \f{align}
      25              :  *    g^{tt} &= -  1/\alpha^2 \\
      26              :  *    g^{ti} &= \beta^i / \alpha^2 \\
      27              :  *    g^{ij} &= \gamma^{ij} - \beta^i \beta^j / \alpha^2
      28              :  * \f}
      29              :  * where \f$ \alpha, \beta^i\f$ and \f$ \gamma^{ij}\f$ are the lapse, shift and
      30              :  * inverse spatial metric respectively
      31              :  */
      32              : template <typename DataType, size_t SpatialDim, typename Frame>
      33            1 : void inverse_spacetime_metric(
      34              :     gsl::not_null<tnsr::AA<DataType, SpatialDim, Frame>*>
      35              :         inverse_spacetime_metric,
      36              :     const Scalar<DataType>& lapse,
      37              :     const tnsr::I<DataType, SpatialDim, Frame>& shift,
      38              :     const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric);
      39              : 
      40              : template <typename DataType, size_t SpatialDim, typename Frame>
      41            1 : tnsr::AA<DataType, SpatialDim, Frame> inverse_spacetime_metric(
      42              :     const Scalar<DataType>& lapse,
      43              :     const tnsr::I<DataType, SpatialDim, Frame>& shift,
      44              :     const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric);
      45              : /// @}
      46              : 
      47              : namespace Tags {
      48              : /*!
      49              :  * \brief Compute item for inverse spacetime metric \f$g^{ab}\f$ in terms of the
      50              :  * lapse \f$\alpha\f$, shift \f$\beta^i\f$, and inverse spatial metric
      51              :  * \f$\gamma^{ij}\f$.
      52              :  *
      53              :  * \details Can be retrieved using `gr::Tags::InverseSpacetimeMetric`.
      54              :  */
      55              : template <typename DataType, size_t SpatialDim, typename Frame>
      56            1 : struct InverseSpacetimeMetricCompute
      57              :     : InverseSpacetimeMetric<DataType, SpatialDim, Frame>,
      58              :       db::ComputeTag {
      59            0 :   using argument_tags =
      60              :       tmpl::list<Lapse<DataType>, Shift<DataType, SpatialDim, Frame>,
      61              :                  InverseSpatialMetric<DataType, SpatialDim, Frame>>;
      62              : 
      63            0 :   using return_type = tnsr::AA<DataType, SpatialDim, Frame>;
      64              : 
      65            0 :   static constexpr auto function = static_cast<void (*)(
      66              :       gsl::not_null<tnsr::AA<DataType, SpatialDim, Frame>*>,
      67              :       const Scalar<DataType>&, const tnsr::I<DataType, SpatialDim, Frame>&,
      68              :       const tnsr::II<DataType, SpatialDim, Frame>&)>(
      69              :       &inverse_spacetime_metric<DataType, SpatialDim, Frame>);
      70              : 
      71            0 :   using base = InverseSpacetimeMetric<DataType, SpatialDim, Frame>;
      72              : };
      73              : }  // namespace Tags
      74              : }  // namespace gr
        

Generated by: LCOV version 2.0-1