SpECTRE Documentation Coverage Report
Current view: top level - NumericalAlgorithms/Interpolation - LinearSpanInterpolator.hpp Hit Total Coverage
Commit: 664546099c4dbf27a1b708fac45e39c82dd743d2 Lines: 4 17 23.5 %
Date: 2024-04-19 16:28:01
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 :   size_t required_number_of_points_before_and_after() const override {
      54             :     return 1;
      55             :   }
      56             : };
      57             : }  // namespace intrp

Generated by: LCOV version 1.14