SpECTRE  v2026.04.01
Loading...
Searching...
No Matches
intrp::CubicSpline Class Reference

A natural cubic spline interpolation class. More...

#include <CubicSpline.hpp>

Public Member Functions

 CubicSpline (std::vector< double > x_values, std::vector< double > y_values)
 CubicSpline (const CubicSpline &)
CubicSplineoperator= (const CubicSpline &)
 CubicSpline (CubicSpline &&)=default
CubicSplineoperator= (CubicSpline &&rhs)=default
bool operator== (const CubicSpline &rhs) const
double operator() (double x_to_interp_to) const
const std::vector< double > & x_values () const
const std::vector< double > & y_values () const
void pup (PUP::er &p)

Detailed Description

A natural cubic spline interpolation class.

The class builds a cubic spline interpolant with natural boundary conditions using the x_values and y_values passed into the constructor. For details on the algorithm see the GSL documentation on gsl_interp_cspline.

Here is an example how to use this class:

intrp::CubicSpline interpolant{x_values, y_values};
CHECK(interpolant.x_values() == x_values);
CHECK(interpolant.y_values() == y_values);
const double x_to_interpolate_to =
CHECK(interpolant(x_to_interpolate_to) ==
custom_approx_interior(function(x_to_interpolate_to)));

The documentation for this class was generated from the following file:
  • src/NumericalAlgorithms/Interpolation/CubicSpline.hpp