#include <interpolation2D.h>
Represent a bicubic spline interpolation.
Definition at line 23 of file interpolation2D.h.
Public Member Functions | |
| InterpolateData2DSpline (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, ExtrapolationType extrapolation_type=ExtrapolationType::None) | |
| Interpolate function f given discrete samples f(x_i, y_i) = z_i. More... | |
| ~InterpolateData2DSpline () | |
| Destructor. More... | |
| double | operator() (double xi, double yi) const |
| Calculate bicubic interpolation for given x and y. More... | |
Private Attributes | |
| ExtrapolationType | extrapolation_type_ = ExtrapolationType::None |
| Extrapolation type. More... | |
| double | first_x_ = smash_NaN<double> |
| First x value of underlying data. More... | |
| double | last_x_ = smash_NaN<double> |
| Last x value of underlying data. More... | |
| double | first_y_ = smash_NaN<double> |
| First y value of underlying data. More... | |
| double | last_y_ = smash_NaN<double> |
| Last y value of underlying data. More... | |
| gsl_interp_accel * | xacc_ = nullptr |
| GSL iterator for interpolation lookups in x direction. More... | |
| gsl_interp_accel * | yacc_ = nullptr |
| GSL iterator for interpolation lookupin y direction. More... | |
| gsl_spline2d * | spline_ = nullptr |
| GSL spline in 2D. More... | |
| smash::InterpolateData2DSpline::InterpolateData2DSpline | ( | const std::vector< double > & | x, |
| const std::vector< double > & | y, | ||
| const std::vector< double > & | z, | ||
| ExtrapolationType | extrapolation_type = ExtrapolationType::None |
||
| ) |
Interpolate function f given discrete samples f(x_i, y_i) = z_i.
A bicubic spline interpolation is used.
| x | x-values. |
| y | y-values. |
| z | z-values |
| extrapolation_type | Type of extrapolation for requested x_i and y_i values that are out of bounds. Extrapolation is by default disabled. Possible types are None, Zero, and Constant. |
| std::out_of_range | if values outside of the boundaries of the underlying data are tried to be accessed and extrapolation is disabled. |
| std::invalid_argument | if unsupported extrapolation type is requested. |
| std::invalid_argument | if product of dimensions of x and y does not equal dimension of z. |
| std::invalid_argument | if less than three data points in x or y are provided. |
| std::invalid_argument | if x and y are not sorted that their values strictly increase. |
Definition at line 18 of file interpolation2D.cc.
| smash::InterpolateData2DSpline::~InterpolateData2DSpline | ( | ) |
Destructor.
Definition at line 75 of file interpolation2D.cc.
| double smash::InterpolateData2DSpline::operator() | ( | double | xi, |
| double | yi | ||
| ) | const |
Calculate bicubic interpolation for given x and y.
| xi | Interpolation argument in first dimension. |
| yi | Interpolation argument in second dimension. |
| std::out_of_range | if values outside of the boundaries of the underlying data are tried to be accessed and extrapolation is disabled. |
Definition at line 81 of file interpolation2D.cc.
|
private |
Extrapolation type.
Definition at line 75 of file interpolation2D.h.
|
private |
First x value of underlying data.
Definition at line 77 of file interpolation2D.h.
|
private |
Last x value of underlying data.
Definition at line 79 of file interpolation2D.h.
|
private |
First y value of underlying data.
Definition at line 81 of file interpolation2D.h.
|
private |
Last y value of underlying data.
Definition at line 83 of file interpolation2D.h.
|
private |
GSL iterator for interpolation lookups in x direction.
Definition at line 86 of file interpolation2D.h.
|
private |
GSL iterator for interpolation lookupin y direction.
Definition at line 88 of file interpolation2D.h.
|
private |
GSL spline in 2D.
Definition at line 90 of file interpolation2D.h.