Translation.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <array>
7 #include <boost/optional.hpp>
8 #include <cstddef>
9 #include <string>
10 #include <unordered_map>
11 
13 #include "Utilities/TypeTraits.hpp"
14 
15 /// \cond
16 class FunctionOfTime;
17 namespace PUP {
18 class er;
19 } // namespace PUP
20 /// \endcond
21 
22 namespace CoordMapsTimeDependent {
23 /*!
24  * \ingroup CoordMapsTimeDependentGroup
25  * \brief Translation map defined by \f$x = \xi+T(t)\f$.
26  *
27  * The map adds a translation, \f$T(t)\f$, to the coordinates \f$\xi\f$,
28  * where \f$T(t)\f$ is a FunctionOfTime.
29  */
30 class Translation {
31  public:
32  static constexpr size_t dim = 1;
33 
34  template <typename T>
36  const std::array<T, 1>& source_coords, double time,
38  noexcept;
39 
40  boost::optional<std::array<double, 1>> inverse(
41  const std::array<double, 1>& target_coords, double time,
43  noexcept;
44 
45  template <typename T>
46  std::array<tt::remove_cvref_wrap_t<T>, 1> frame_velocity(
47  const std::array<T, 1>& source_coords, double time,
49  noexcept;
50 
51  template <typename T>
52  tnsr::Ij<tt::remove_cvref_wrap_t<T>, 1, Frame::NoFrame> inv_jacobian(
53  const std::array<T, 1>& source_coords) const noexcept;
54 
55  template <typename T>
56  tnsr::Ij<tt::remove_cvref_wrap_t<T>, 1, Frame::NoFrame> jacobian(
57  const std::array<T, 1>& source_coords) const noexcept;
58 
59  // clang-tidy: google-runtime-references
60  void pup(PUP::er& p) noexcept; // NOLINT
61 
62  bool is_identity() const noexcept { return false; }
63 
64  private:
65  friend bool operator==(const Translation& lhs,
66  const Translation& rhs) noexcept;
67 
68  std::string f_of_t_name_ = "trans";
69 };
70 
71 inline bool operator!=(
73  const CoordMapsTimeDependent::Translation& rhs) noexcept {
74  return not(lhs == rhs);
75 }
76 
77 } // namespace CoordMapsTimeDependent
Definition: Strahlkorper.hpp:14
Translation map defined by .
Definition: Translation.hpp:30
Defines a list of useful type aliases for tensors.
Represents an index that is not in a known frame, e.g. some internal intermediate frame that is irrel...
Definition: IndexType.hpp:48
Definition: CubicScale.cpp:23
Base class for FunctionsOfTime.
Definition: FunctionOfTime.hpp:13
Defines type traits, some of which are future STL type_traits header.