SpECTRE Documentation Coverage Report
Current view: top level - NumericalAlgorithms/Interpolation - CubicSpanInterpolator.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 31.6 % 19 6
Test Date: 2026-10-22 17:29:42
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 :   double derivative(const gsl::span<const double>& source_points,
      58              :                     const gsl::span<const double>& values,
      59              :                     double target_point) const override;
      60              : 
      61            1 :   std::complex<double> derivative(
      62              :       const gsl::span<const double>& source_points,
      63              :       const gsl::span<const std::complex<double>>& values,
      64              :       double target_point) const override;
      65              : 
      66            1 :   size_t required_number_of_points_before_and_after() const override {
      67              :     return 2;
      68              :   }
      69              : };
      70              : }  // namespace intrp
        

Generated by: LCOV version 2.0-1