Transform.hpp
2 // See LICENSE.txt for details.
3
4 #pragma once
5
6 #include <cstddef>
7
8 #include "DataStructures/DataBox/Tag.hpp"
10 #include "Utilities/Gsl.hpp"
11
12 /// \cond
13 class DataVector;
14 /// \endcond
15
16 /// Holds functions related to transforming between frames.
17 namespace transform {
18 /// @{
19 /*!
20  * \ingroup GeneralRelativityGroup
21  * Transforms tensor to different frame.
22  *
23  * The formula for transforming \f$T_{ij}\f$ is
24  * \f{align}
25  * T_{\bar{\imath}\bar{\jmath}} &= T_{ij}
26  * \frac{\partial x^i}{\partial x^{\bar{\imath}}}
27  * \frac{\partial x^j}{\partial x^{\bar{\jmath}}}
28  * \f}
29  * where \f$x^i\f$ are the source coordinates and
30  * \f$x^{\bar{\imath}}\f$ are the destination coordinates.
31  *
32  * Note that Jacobian<DestFrame,SrcFrame> is the same type as
33  * InverseJacobian<SrcFrame,DestFrame> and represents
34  * \f$\partial x^i/\partial x^{\bar{\jmath}}\f$.
35  *
36  * In principle to_different_frame can be extended/generalized to
37  * other tensor types if needed.
38  */
39 template <size_t VolumeDim, typename SrcFrame, typename DestFrame>
41  const gsl::not_null<tnsr::ii<DataVector, VolumeDim, DestFrame>*> dest,
42  const tnsr::ii<DataVector, VolumeDim, SrcFrame>& src,
43  const Jacobian<DataVector, VolumeDim, DestFrame, SrcFrame>&
44  jacobian) noexcept;
45
46 template <size_t VolumeDim, typename SrcFrame, typename DestFrame>
47 auto to_different_frame(const tnsr::ii<DataVector, VolumeDim, SrcFrame>& src,
48  const Jacobian<DataVector, VolumeDim, DestFrame,
49  SrcFrame>& jacobian) noexcept
50  -> tnsr::ii<DataVector, VolumeDim, DestFrame>;
51 /// @}
52
53 /// @{
54 /*!
55  * \ingroup GeneralRelativityGroup
56  * Transforms only the first index to different frame.
57  *
58  * Often used for derivatives: When representing derivatives as
59  * tensors, the first index is typically the derivative index.
60  * Numerical derivatives must be computed in the logical frame or
61  * sometimes the grid frame (independent of the frame of the tensor
62  * being differentiated), and then that derivative index must later
63  * be transformed into the same frame as the other indices of the
64  * tensor.
65  *
66  * The formula for transforming \f$T_{i\bar{\jmath}\bar{k}}\f$ is
67  * \f{align}
68  * T_{\bar{\imath}\bar{\jmath}\bar{k}} &= T_{i\bar{\jmath}\bar{k}}
69  * \frac{\partial x^i}{\partial x^{\bar{\imath}}},
70  * \f}
71  * where \f$x^i\f$ are the source coordinates and
72  * \f$x^{\bar{\imath}}\f$ are the destination coordinates.
73  *
74  * Note that Jacobian<DestFrame,SrcFrame> is the same type as
75  * InverseJacobian<SrcFrame,DestFrame> and represents
76  * \f$\partial x^i/\partial x^{\bar{\jmath}}\f$.
77  *
78  * In principle first_index_to_different_frame can be
79  * extended/generalized to other tensor types if needed.
80  */
81 template <size_t VolumeDim, typename SrcFrame, typename DestFrame>
83  const gsl::not_null<tnsr::ijj<DataVector, VolumeDim, DestFrame>*> dest,
84  const Tensor<DataVector, tmpl::integral_list<std::int32_t, 2, 1, 1>,
88  const Jacobian<DataVector, VolumeDim, DestFrame, SrcFrame>&
89  jacobian) noexcept;
90
91 template <size_t VolumeDim, typename SrcFrame, typename DestFrame>
93  const Tensor<DataVector, tmpl::integral_list<std::int32_t, 2, 1, 1>,
97  const Jacobian<DataVector, VolumeDim, DestFrame, SrcFrame>&
98  jacobian) noexcept -> tnsr::ijj<DataVector, VolumeDim, DestFrame>;
99 /// @}
100 } // namespace transform
transform
Holds functions related to transforming between frames.
Definition: Transform.hpp:17
transform::to_different_frame
void to_different_frame(const gsl::not_null< tnsr::ii< DataVector, VolumeDim, DestFrame > * > dest, const tnsr::ii< DataVector, VolumeDim, SrcFrame > &src, const Jacobian< DataVector, VolumeDim, DestFrame, SrcFrame > &jacobian) noexcept
cstddef
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:46
transform::first_index_to_different_frame
void first_index_to_different_frame(const gsl::not_null< tnsr::ijj< DataVector, VolumeDim, DestFrame > * > dest, const Tensor< DataVector, tmpl::integral_list< std::int32_t, 2, 1, 1 >, index_list< SpatialIndex< VolumeDim, UpLo::Lo, SrcFrame >, SpatialIndex< VolumeDim, UpLo::Lo, DestFrame >, SpatialIndex< VolumeDim, UpLo::Lo, DestFrame >>> &src, const Jacobian< DataVector, VolumeDim, DestFrame, SrcFrame > &jacobian) noexcept
Gsl.hpp
TypeAliases.hpp
SpatialIndex
Tensor_detail::TensorIndexType< SpatialDim, Ul, Fr, IndexType::Spatial > SpatialIndex
Definition: IndexType.hpp:187
gsl::not_null
Require a pointer to not be a nullptr