SpECTRE Documentation Coverage Report
Current view: top level - NumericalAlgorithms/Interpolation - BarycentricRationalSpanInterpolator.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 23.3 % 30 7
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 "NumericalAlgorithms/Interpolation/SpanInterpolator.hpp"
      10              : #include "Options/String.hpp"
      11              : #include "Utilities/Gsl.hpp"
      12              : #include "Utilities/Serialization/CharmPupable.hpp"
      13              : 
      14              : namespace intrp {
      15              : 
      16              : /// \brief Performs a barycentric interpolation with an order in a range fixed
      17              : /// at construction; this class can be chosen via the options factory mechanism
      18              : /// as a possible `SpanInterpolator`.
      19              : ///
      20              : /// \details This will call a barycentric interpolation on a fixed minimum
      21              : /// length, so that buffers that adjust length based on
      22              : /// `required_points_before_and_after()` can be forced to use an interpolator of
      23              : /// a target order.
      24            1 : class BarycentricRationalSpanInterpolator : public SpanInterpolator {
      25              :  public:
      26            0 :   struct MinOrder {
      27            0 :     using type = size_t;
      28            0 :     static constexpr Options::String help = {
      29              :         "Order of barycentric interpolation"};
      30            0 :     static type lower_bound() { return 1; }
      31              :   };
      32              : 
      33            0 :   struct MaxOrder {
      34            0 :     using type = size_t;
      35            0 :     static constexpr Options::String help = {
      36              :         "Order of barycentric interpolation"};
      37            0 :     static type upper_bound() { return 10; }
      38              :   };
      39              : 
      40            0 :   using options = tmpl::list<MinOrder, MaxOrder>;
      41            0 :   static constexpr Options::String help = {
      42              :       "Barycentric interpolator of option-defined maximum and minimum order."};
      43              : 
      44            0 :   explicit BarycentricRationalSpanInterpolator(CkMigrateMessage* /*unused*/) {}
      45              : 
      46            0 :   WRAPPED_PUPable_decl_template(BarycentricRationalSpanInterpolator);  // NOLINT
      47              : 
      48              :   // clang-tidy: do not pass by non-const reference
      49            0 :   void pup(PUP::er& p) override {  // NOLINT
      50              :     p | min_order_;
      51              :     p | max_order_;
      52              :   }
      53              : 
      54            0 :   BarycentricRationalSpanInterpolator() = default;
      55            0 :   BarycentricRationalSpanInterpolator(
      56              :       const BarycentricRationalSpanInterpolator&) = default;
      57            0 :   BarycentricRationalSpanInterpolator& operator=(
      58              :       const BarycentricRationalSpanInterpolator&) = default;
      59            0 :   BarycentricRationalSpanInterpolator(BarycentricRationalSpanInterpolator&&) =
      60              :       default;
      61            0 :   BarycentricRationalSpanInterpolator& operator=(
      62              :       BarycentricRationalSpanInterpolator&&) = default;
      63            0 :   ~BarycentricRationalSpanInterpolator() override = default;
      64              : 
      65            0 :   explicit BarycentricRationalSpanInterpolator(size_t min_order,
      66              :                                                size_t max_order);
      67              : 
      68            1 :   std::unique_ptr<SpanInterpolator> get_clone() const override {
      69              :     return std::make_unique<BarycentricRationalSpanInterpolator>(*this);
      70              :   }
      71              : 
      72              :   // to get the generic overloads:
      73            1 :   using SpanInterpolator::derivative;
      74            1 :   using SpanInterpolator::interpolate;
      75              : 
      76            1 :   double interpolate(const gsl::span<const double>& source_points,
      77              :                      const gsl::span<const double>& values,
      78              :                      double target_point) const override;
      79              : 
      80            1 :   double derivative(const gsl::span<const double>& source_points,
      81              :                     const gsl::span<const double>& values,
      82              :                     double target_point) const override;
      83              : 
      84            1 :   size_t required_number_of_points_before_and_after() const override {
      85              :     return min_order_ / 2 + 1;
      86              :   }
      87              : 
      88              :  private:
      89            0 :   size_t min_order_ = 1;
      90            0 :   size_t max_order_ = 10;
      91              : };
      92              : }  // namespace intrp
        

Generated by: LCOV version 2.0-1