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 Computes spacetime normal vector from lapse and shift.
21 : *
22 : * \details If \f$\alpha, \beta^i\f$ are the lapse and shift respectively, then
23 : *
24 : * \f{align} n^t &= 1/\alpha \\
25 : * n^i &= -\frac{\beta^i}{\alpha} \f}
26 : *
27 : * is computed.
28 : */
29 : template <typename DataType, size_t SpatialDim, typename Frame>
30 1 : tnsr::A<DataType, SpatialDim, Frame> spacetime_normal_vector(
31 : const Scalar<DataType>& lapse,
32 : const tnsr::I<DataType, SpatialDim, Frame>& shift);
33 :
34 : template <typename DataType, size_t SpatialDim, typename Frame>
35 1 : void spacetime_normal_vector(
36 : gsl::not_null<tnsr::A<DataType, SpatialDim, Frame>*>
37 : spacetime_normal_vector,
38 : const Scalar<DataType>& lapse,
39 : const tnsr::I<DataType, SpatialDim, Frame>& shift);
40 : /// @}
41 :
42 : namespace Tags {
43 : /*!
44 : * \brief Compute item for spacetime normal vector \f$n^a\f$ from
45 : * the lapse \f$\alpha\f$ and the shift \f$\beta^i\f$.
46 : *
47 : * \details Can be retrieved using `gr::Tags::SpacetimeNormalVector`.
48 : */
49 : template <typename DataType, size_t SpatialDim, typename Frame>
50 1 : struct SpacetimeNormalVectorCompute
51 : : SpacetimeNormalVector<DataType, SpatialDim, Frame>,
52 : db::ComputeTag {
53 0 : using argument_tags =
54 : tmpl::list<Lapse<DataType>, Shift<DataType, SpatialDim, Frame>>;
55 :
56 0 : using return_type = tnsr::A<DataType, SpatialDim, Frame>;
57 :
58 0 : static constexpr auto function = static_cast<void (*)(
59 : gsl::not_null<tnsr::A<DataType, SpatialDim, Frame>*>,
60 : const Scalar<DataType>&, const tnsr::I<DataType, SpatialDim, Frame>&)>(
61 : &spacetime_normal_vector<DataType, SpatialDim, Frame>);
62 :
63 0 : using base = SpacetimeNormalVector<DataType, SpatialDim, Frame>;
64 : };
65 : } // namespace Tags
66 : } // namespace gr
|