Defines a general purpose 2D interpolator class that implements a variety of interpolation schemes. More...

#include "util/interpolator2D.h"

Public Member Functions

 Interpolator2D ()
 Default Interpolator2D constructor; set_f must be called to set x,y,f prior to calling interpolation.
 
 Interpolator2D (std::valarray< double > x, std::valarray< double > y, std::valarray< double > f)
 Interpolator2D constructor with x,y,f set explicitly.
 
 Interpolator2D (std::valarray< double > x, std::valarray< double > y, std::valarray< double > f, std::valarray< double > dfdx, std::valarray< double > dfdy, std::valarray< double > d2fdxdy)
 Interpolator2D constructor with x,y,f and the gradients \(df/dx\), \(df/dy\), and \(d^2f/dxdy\) set explicitly.
 
void set_f (std::valarray< double > &x, std::valarray< double > &y, std::valarray< double > &f)
 Set/reset x,y,f after construction.
 
void set_df (std::valarray< double > &dfdx, std::valarray< double > &dfdy, std::valarray< double > &d2fdxdy)
 Set/reset \(df/dx\), \(df/dy\), and \(d^2f/dxdy\) after construction.
 
void use_forward_difference ()
 Set/reset \(df/dx\), \(df/dy\), and \(d^2f/dxdy\) after construction via finite differencing the tabulated values.
 
std::valarray< double > & x ()
 Access to x array.
 
std::valarray< double > & y ()
 Access to y array.
 
std::valarray< double > & f ()
 Access to f array.
 
std::valarray< double > & dfdx ()
 Access to \(df/dx\) array.
 
std::valarray< double > & dfdy ()
 Access to \(df/dy\) array.
 
std::valarray< double > & d2fdxdy ()
 Access to \(d^2f/dxdy\) array.
 
double xmax ()
 Access to maximum x tabulated value.
 
double ymax ()
 Access to minimum x tabulated value.
 
double xmin ()
 Access to maximum y tabulated value.
 
double ymin ()
 Access to minimum y tabulated value.
 
void cell_limits (double x, double y, double &xlo, double &xhi, double &ylo, double &yhi)
 Obtaining the limits on an interpolation cell given x,y.
 
void linear_triangle (double x, double y, double &f)
 Linear interpolation within the nearest trixel.
 
void linear_loglog (double x, double y, double &f)
 Linear interpolation on log(x),log(y),log(f).
 
void linear_wdbndry (double x, double y, double &f)
 Linear interpolation with treatement of boundary. See interpolator2D.cpp for details.
 
void linear (double x, double y, double &f)
 Bilinear interpolation.
 
void bicubic (double x, double y, double &f)
 Bicubic interpolation.
 
void bicubic_spline (double x, double y, double &f)
 Bicubic spline interpolation.
 

Private Member Functions

void fd_derivatives ()
 
void gen_spline_derivs ()
 
void check_tables () const
 
int index (int ix, int iy) const
 
void get_cell (double x, double y, int ix[], int iy[])
 
void bcuint (double y[], double y1[], double y2[], double y12[], double x1l, double x1u, double x2l, double x2u, double x1, double x2, double &ansy, double &ansy1, double &ansy2)
 
void bcucof (double y[], double y1[], double y2[], double y12[], double d1, double d2, double c[5][5])
 
void column_spline (int ilow, int ihi, double x, std::valarray< double > fx, double &f)
 

Private Attributes

std::valarray< double > _x
 
std::valarray< double > _y
 
std::valarray< double > _f
 
std::valarray< double > _dfdx
 
std::valarray< double > _dfdy
 
std::valarray< double > _d2fdxdy
 
std::valarray< double > _spline_derivs
 
bool _derivatives_defined
 

Detailed Description

Implemented methods include: linear within the nearest trixel, logarithmic linear, linear with appropriate boundary implementation, bilinear, and bicubic.

Warning
Assumes that the grid is rectilinear and monotonically increasing, though not necessarily regular, and that the arrays passed during construction are sliced in Fortran order as iy+y.size()*ix.

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