SpECTRE Documentation Coverage Report
Current view: top level - NumericalAlgorithms/Interpolation - CubicSpanInterpolator.hpp Hit Total Coverage
Commit: 524991323bb2b11bbb29bf2db759f03f14f0e6f0 Lines: 4 17 23.5 %
Date: 2024-05-25 20:39:28
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <complex>
       7             : #include <cstddef>
       8             : 
       9             : #include "DataStructures/ComplexModalVector.hpp"
      10             : #include "DataStructures/DataVector.hpp"
      11             : #include "DataStructures/ModalVector.hpp"
      12             : #include "NumericalAlgorithms/Interpolation/SpanInterpolator.hpp"
      13             : #include "Options/String.hpp"
      14             : #include "Utilities/Gsl.hpp"
      15             : #include "Utilities/Serialization/CharmPupable.hpp"
      16             : 
      17             : namespace intrp {
      18             : 
      19             : /// \brief Performs a cubic interpolation; this class can be chosen via the
      20             : /// options factory mechanism as a possible `SpanInterpolator`.
      21             : ///
      22             : /// \details This interpolator is hand-coded to be identical to the SpEC
      23             : /// implementation used for SpEC CCE so that comparison results can be as close
      24             : /// as possible for diagnostics.
      25           1 : class CubicSpanInterpolator : public SpanInterpolator {
      26             :  public:
      27           0 :   using options = tmpl::list<>;
      28           0 :   static constexpr Options::String help = {"Cubic interpolator."};
      29             : 
      30           0 :   CubicSpanInterpolator() = default;
      31           0 :   CubicSpanInterpolator(const CubicSpanInterpolator&) = default;
      32           0 :   CubicSpanInterpolator& operator=(const CubicSpanInterpolator&) = default;
      33           0 :   CubicSpanInterpolator(CubicSpanInterpolator&&) = default;
      34           0 :   CubicSpanInterpolator& operator=(CubicSpanInterpolator&&) = default;
      35           0 :   ~CubicSpanInterpolator() override = default;
      36             : 
      37           0 :   explicit CubicSpanInterpolator(CkMigrateMessage* /*unused*/) {}
      38             : 
      39           0 :   WRAPPED_PUPable_decl_template(CubicSpanInterpolator);  // NOLINT
      40             : 
      41             :   // clang-tidy: do not pass by non-const reference
      42           0 :   void pup(PUP::er& /*p*/) override {}
      43             : 
      44           1 :   std::unique_ptr<SpanInterpolator> get_clone() const override {
      45             :     return std::make_unique<CubicSpanInterpolator>(*this);
      46             :   }
      47             : 
      48           1 :   double interpolate(const gsl::span<const double>& source_points,
      49             :                      const gsl::span<const double>& values,
      50             :                      double target_point) const override;
      51             : 
      52           0 :   std::complex<double> interpolate(
      53             :       const gsl::span<const double>& source_points,
      54             :       const gsl::span<const std::complex<double>>& values,
      55             :       double target_point) const;
      56             : 
      57           1 :   size_t required_number_of_points_before_and_after() const override {
      58             :     return 2;
      59             :   }
      60             : };
      61             : }  // namespace intrp

Generated by: LCOV version 1.14