SpECTRE Documentation Coverage Report
Current view: top level - NumericalAlgorithms/Interpolation - LinearSpanInterpolator.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 linear interpolation; this class can be chosen via the
      20              : /// options factory mechanism as a possible `SpanInterpolator`
      21            1 : class LinearSpanInterpolator : public SpanInterpolator {
      22              :  public:
      23            0 :   using options = tmpl::list<>;
      24            0 :   static constexpr Options::String help = {"Linear interpolator."};
      25              : 
      26            0 :   LinearSpanInterpolator() = default;
      27            0 :   LinearSpanInterpolator(const LinearSpanInterpolator&) = default;
      28            0 :   LinearSpanInterpolator& operator=(const LinearSpanInterpolator&) = default;
      29            0 :   LinearSpanInterpolator(LinearSpanInterpolator&&) = default;
      30            0 :   LinearSpanInterpolator& operator=(LinearSpanInterpolator&&) = default;
      31            0 :   ~LinearSpanInterpolator() override = default;
      32              : 
      33            0 :   WRAPPED_PUPable_decl_template(LinearSpanInterpolator);  // NOLINT
      34              : 
      35            0 :   explicit LinearSpanInterpolator(CkMigrateMessage* /*unused*/) {}
      36              : 
      37              :   // clang-tidy: do not pass by non-const reference
      38            0 :   void pup(PUP::er& /*p*/) override {}
      39              : 
      40            1 :   std::unique_ptr<SpanInterpolator> get_clone() const override {
      41              :     return std::make_unique<LinearSpanInterpolator>(*this);
      42              :   }
      43              : 
      44            1 :   double interpolate(const gsl::span<const double>& source_points,
      45              :                      const gsl::span<const double>& values,
      46              :                      double target_point) const override;
      47              : 
      48            0 :   std::complex<double> interpolate(
      49              :       const gsl::span<const double>& source_points,
      50              :       const gsl::span<const std::complex<double>>& values,
      51              :       double target_point) const;
      52              : 
      53            1 :   double derivative(const gsl::span<const double>& source_points,
      54              :                     const gsl::span<const double>& values,
      55              :                     double target_point) const override;
      56              : 
      57            1 :   std::complex<double> derivative(
      58              :       const gsl::span<const double>& source_points,
      59              :       const gsl::span<const std::complex<double>>& values,
      60              :       double target_point) const override;
      61              : 
      62            1 :   size_t required_number_of_points_before_and_after() const override {
      63              :     return 1;
      64              :   }
      65              : };
      66              : }  // namespace intrp
        

Generated by: LCOV version 2.0-1