SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/GeneralRelativity - SpacetimeMetric.hpp Hit Total Coverage
Commit: 923cd4a8ea30f5a5589baa60b0a93e358ca9f8e8 Lines: 3 8 37.5 %
Date: 2025-11-07 19:37:56
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             :  * \ingroup GeneralRelativityGroup
      18             :  * \brief Computes the spacetime metric from the spatial metric, lapse, and
      19             :  * shift.
      20             :  * \details The spacetime metric \f$ g_{ab} \f$ is calculated as
      21             :  * \f{align}{
      22             :  *   g_{tt} &= - \alpha^2 + \beta^m \beta^n \gamma_{mn} \\
      23             :  *   g_{ti} &= \gamma_{mi} \beta^m  \\
      24             :  *   g_{ij} &= \gamma_{ij}
      25             :  * \f}
      26             :  * where \f$ \alpha, \beta^i\f$ and \f$ \gamma_{ij}\f$ are the lapse, shift and
      27             :  * spatial metric respectively
      28             :  */
      29             : template <typename DataType, size_t Dim, typename Frame>
      30           1 : void spacetime_metric(
      31             :     gsl::not_null<tnsr::aa<DataType, Dim, Frame>*> spacetime_metric,
      32             :     const Scalar<DataType>& lapse, const tnsr::I<DataType, Dim, Frame>& shift,
      33             :     const tnsr::ii<DataType, Dim, Frame>& spatial_metric);
      34             : 
      35             : template <typename DataType, size_t SpatialDim, typename Frame>
      36           1 : tnsr::aa<DataType, SpatialDim, Frame> spacetime_metric(
      37             :     const Scalar<DataType>& lapse,
      38             :     const tnsr::I<DataType, SpatialDim, Frame>& shift,
      39             :     const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric);
      40             : /// @}
      41             : 
      42             : namespace Tags {
      43             : /*!
      44             :  * \brief Compute item for spacetime metric \f$g_{ab}\f$ from the lapse
      45             :  * \f$\alpha\f$, shift \f$\beta^i\f$, and spatial metric \f$\gamma_{ij}\f$.
      46             :  *
      47             :  * \details Can be retrieved using `gr::Tags::SpacetimeMetric`.
      48             :  */
      49             : template <typename DataType, size_t SpatialDim, typename Frame>
      50           1 : struct SpacetimeMetricCompute : SpacetimeMetric<DataType, SpatialDim, Frame>,
      51             :                                 db::ComputeTag {
      52           0 :   using argument_tags =
      53             :       tmpl::list<Lapse<DataType>, Shift<DataType, SpatialDim, Frame>,
      54             :                  SpatialMetric<DataType, SpatialDim, Frame>>;
      55             : 
      56           0 :   using return_type = tnsr::aa<DataType, SpatialDim, Frame>;
      57             : 
      58           0 :   static constexpr auto function = static_cast<void (*)(
      59             :       gsl::not_null<tnsr::aa<DataType, SpatialDim, Frame>*>,
      60             :       const Scalar<DataType>&, const tnsr::I<DataType, SpatialDim, Frame>&,
      61             :       const tnsr::ii<DataType, SpatialDim, Frame>&)>(
      62             :       &spacetime_metric<DataType, SpatialDim, Frame>);
      63             : 
      64           0 :   using base = SpacetimeMetric<DataType, SpatialDim, Frame>;
      65             : };
      66             : }  // namespace Tags
      67             : }  // namespace gr

Generated by: LCOV version 1.14