SpECTRE  v2024.09.29
intrp::SpanInterpolator Class Referenceabstract

Base class for interpolators so that the factory options mechanism can be used. More...

#include <SpanInterpolator.hpp>

Public Types

using creatable_classes = tmpl::list< LinearSpanInterpolator, CubicSpanInterpolator, BarycentricRationalSpanInterpolator >
 

Public Member Functions

 WRAPPED_PUPable_abstract (SpanInterpolator)
 
virtual std::unique_ptr< SpanInterpolatorget_clone () const =0
 Produce a std::unique_ptr that points to a copy of *this`. More...
 
virtual double interpolate (const gsl::span< const double > &source_points, const gsl::span< const double > &values, double target_point) const =0
 Perform the interpolation of function represented by values at source_points to the requested target_point, returning the interpolation result. More...
 
std::complex< double > interpolate (const gsl::span< const double > &source_points, const gsl::span< const std::complex< double > > &values, double target_point) const
 Perform the interpolation of function represented by complex values at source_points to the requested target_point, returning the (complex) interpolation result.
 
virtual size_t required_number_of_points_before_and_after () const =0
 The number of domain points that should be both before and after the requested target point for best interpolation. For instance, for a linear interpolator, this function would return 1 to request that the target is between the two domain points passed to source_points. More...
 

Detailed Description

Base class for interpolators so that the factory options mechanism can be used.

Details

The virtual functions in this class demand only that the real interpolate function, get_clone function, and required_number_of_points_before_and_after function be overridden in the derived class. The interpolate for complex values can just be used from this base class, which calls the real version for each component. If it is possible to make a specialized complex version that avoids allocations, that is probably more efficient.

Member Function Documentation

◆ get_clone()

virtual std::unique_ptr< SpanInterpolator > intrp::SpanInterpolator::get_clone ( ) const
pure virtual

◆ interpolate()

virtual double intrp::SpanInterpolator::interpolate ( const gsl::span< const double > &  source_points,
const gsl::span< const double > &  values,
double  target_point 
) const
pure virtual

Perform the interpolation of function represented by values at source_points to the requested target_point, returning the interpolation result.

Implemented in intrp::BarycentricRationalSpanInterpolator, intrp::CubicSpanInterpolator, intrp::LinearSpanInterpolator, and intrp::BarycentricRationalSpanInterpolator.

◆ required_number_of_points_before_and_after()

virtual size_t intrp::SpanInterpolator::required_number_of_points_before_and_after ( ) const
pure virtual

The number of domain points that should be both before and after the requested target point for best interpolation. For instance, for a linear interpolator, this function would return 1 to request that the target is between the two domain points passed to source_points.

Implemented in intrp::BarycentricRationalSpanInterpolator, intrp::CubicSpanInterpolator, and intrp::LinearSpanInterpolator.


The documentation for this class was generated from the following file: