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 spatial metric from spacetime metric.
21 : * \details Simply pull out the spatial components.
22 : */
23 : template <typename DataType, size_t SpatialDim, typename Frame>
24 1 : tnsr::ii<DataType, SpatialDim, Frame> spatial_metric(
25 : const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric);
26 :
27 : template <typename DataType, size_t SpatialDim, typename Frame>
28 1 : void spatial_metric(
29 : gsl::not_null<tnsr::ii<DataType, SpatialDim, Frame>*> spatial_metric,
30 : const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric);
31 : /// @}
32 :
33 : namespace Tags {
34 : /*!
35 : * \brief Compute item for spatial metric \f$\gamma_{ij}\f$ from the
36 : * spacetime metric \f$g_{ab}\f$.
37 : *
38 : * \details Can be retrieved using `gr::Tags::SpatialMetric`.
39 : */
40 : template <typename DataType, size_t SpatialDim, typename Frame>
41 1 : struct SpatialMetricCompute : SpatialMetric<DataType, SpatialDim, Frame>,
42 : db::ComputeTag {
43 0 : using argument_tags =
44 : tmpl::list<SpacetimeMetric<DataType, SpatialDim, Frame>>;
45 :
46 0 : using return_type = tnsr::ii<DataType, SpatialDim, Frame>;
47 :
48 0 : static constexpr auto function = static_cast<void (*)(
49 : gsl::not_null<tnsr::ii<DataType, SpatialDim, Frame>*>,
50 : const tnsr::aa<DataType, SpatialDim, Frame>&)>(
51 : &spatial_metric<DataType, SpatialDim, Frame>);
52 :
53 0 : using base = SpatialMetric<DataType, SpatialDim, Frame>;
54 : };
55 : } // namespace Tags
56 : } // namespace gr
|