SpatialMetric.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cmath>
7 #include <cstddef>
8 #include <cstdint>
9 #include <utility>
10 
12 #include "DataStructures/DataBox/Tag.hpp"
15 #include "DataStructures/VariablesTag.hpp"
17 #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
18 #include "Utilities/ContainerHelpers.hpp"
19 #include "Utilities/Gsl.hpp"
20 #include "Utilities/TMPL.hpp"
21 #include "Utilities/TaggedTuple.hpp"
22 
23 /// \ingroup GeneralRelativityGroup
24 /// Holds functions related to general relativity.
25 namespace gr {
26 // @{
27 /*!
28  * \ingroup GeneralRelativityGroup
29  * \brief Compute spatial metric from spacetime metric.
30  * \details Simply pull out the spatial components.
31  */
32 template <size_t SpatialDim, typename Frame, typename DataType>
33 tnsr::ii<DataType, SpatialDim, Frame> spatial_metric(
34  const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric) noexcept;
35 
36 template <size_t SpatialDim, typename Frame, typename DataType>
37 void spatial_metric(
38  gsl::not_null<tnsr::ii<DataType, SpatialDim, Frame>*> spatial_metric,
39  const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric) noexcept;
40 // @}
41 
42 namespace Tags {
43 /*!
44  * \brief Compute item for spatial metric \f$g_{ij}\f$ from the
45  * spacetime metric \f$\psi_{ab}\f$.
46  *
47  * \details Can be retrieved using `gr::Tags::SpatialMetric`.
48  */
49 template <size_t SpatialDim, typename Frame, typename DataType>
50 struct SpatialMetricCompute : SpatialMetric<SpatialDim, Frame, DataType>,
52  using argument_tags =
53  tmpl::list<SpacetimeMetric<SpatialDim, Frame, DataType>>;
54 
55  using return_type = tnsr::ii<DataType, SpatialDim, Frame>;
56 
57  static constexpr auto function = static_cast<void (*)(
59  const tnsr::aa<DataType, SpatialDim, Frame>&) noexcept>(
60  &spatial_metric<SpatialDim, Frame, DataType>);
61 
63 };
64 } // namespace Tags
65 } // namespace gr
db::ComputeTag
Marks a DataBoxTag as being a compute item that executes a function.
Definition: Tag.hpp:109
utility
gr::Tags::SpatialMetric
Definition: Tags.hpp:26
DeterminantAndInverse.hpp
cmath
cstddef
gr::Tags::SpatialMetricCompute
Compute item for spatial metric from the spacetime metric .
Definition: SpatialMetric.hpp:50
cstdint
Gsl.hpp
gr::spacetime_metric
void spacetime_metric(gsl::not_null< tnsr::aa< DataType, Dim, Frame > * > spacetime_metric, const Scalar< DataType > &lapse, const tnsr::I< DataType, Dim, Frame > &shift, const tnsr::ii< DataType, Dim, Frame > &spatial_metric) noexcept
Computes the spacetime metric from the spatial metric, lapse, and shift.
gr
Definition: GaugeWave.hpp:27
Tensor.hpp
gr::spatial_metric
tnsr::ii< DataType, SpatialDim, Frame > spatial_metric(const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute spatial metric from spacetime metric.
PartialDerivatives.hpp
Prefixes.hpp
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183