SpECTRE Documentation Coverage Report
Current view: top level - Domain/CoordinateMaps - Identity.hpp Hit Total Coverage
Commit: ecb8a275e1aebab77dcce48a5e098ed4e486ab4b Lines: 3 18 16.7 %
Date: 2026-08-22 01:05:40
Legend: Lines: hit not hit

          Line data    Source code
       1           1 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : /// \file
       5             : /// Defines the class Identity.
       6             : 
       7             : #pragma once
       8             : 
       9             : #include <array>
      10             : #include <cstddef>
      11             : #include <optional>
      12             : 
      13             : #include "DataStructures/Tensor/TypeAliases.hpp"
      14             : 
      15             : /// \cond
      16             : namespace PUP {
      17             : class er;
      18             : }  // namespace PUP
      19             : /// \endcond
      20             : 
      21             : namespace domain {
      22             : namespace CoordinateMaps {
      23             : 
      24             : /// \ingroup CoordinateMapsGroup
      25             : /// Identity  map from \f$\xi \rightarrow x\f$.
      26             : template <size_t Dim>
      27           1 : class Identity {
      28             :  public:
      29           0 :   static constexpr size_t dim = Dim;
      30             : 
      31           0 :   Identity() = default;
      32           0 :   ~Identity() = default;
      33           0 :   Identity(const Identity&) = default;
      34           0 :   Identity(Identity&&) = default;  // NOLINT
      35           0 :   Identity& operator=(const Identity&) = default;
      36           0 :   Identity& operator=(Identity&&) = default;
      37             : 
      38             :   template <typename T>
      39           0 :   std::array<T, Dim> operator()(const std::array<T, Dim>& source_coords) const;
      40             : 
      41             :   /// The inverse function is only callable with doubles because the inverse
      42             :   /// might fail if called for a point out of range, and it is unclear
      43             :   /// what should happen if the inverse were to succeed for some points in a
      44             :   /// DataVector but fail for other points.
      45           1 :   std::optional<std::array<double, Dim>> inverse(
      46             :       const std::array<double, Dim>& target_coords) const;
      47             : 
      48             :   template <typename T>
      49           0 :   tnsr::Ij<T, Dim, Frame::NoFrame> jacobian(
      50             :       const std::array<T, Dim>& source_coords) const;
      51             : 
      52             :   template <typename T>
      53           0 :   tnsr::Ij<T, Dim, Frame::NoFrame> inv_jacobian(
      54             :       const std::array<T, Dim>& source_coords) const;
      55             : 
      56             :   // NOLINTNEXTLINE(google-runtime-references)
      57           0 :   void pup(PUP::er& /*p*/) {}
      58             : 
      59           0 :   bool is_identity() const { return true; }
      60             : 
      61           0 :   static constexpr bool supports_hessian{true};
      62             : };
      63             : 
      64             : template <size_t Dim>
      65           0 : inline constexpr bool operator==(const CoordinateMaps::Identity<Dim>& /*lhs*/,
      66             :                                  const CoordinateMaps::Identity<Dim>& /*rhs*/) {
      67             :   return true;
      68             : }
      69             : 
      70             : template <size_t Dim>
      71           0 : inline constexpr bool operator!=(const CoordinateMaps::Identity<Dim>& lhs,
      72             :                                  const CoordinateMaps::Identity<Dim>& rhs) {
      73             :   return not(lhs == rhs);
      74             : }
      75             : }  // namespace CoordinateMaps
      76             : }  // namespace domain

Generated by: LCOV version 1.14