Defines a general purpose 1D linear interpolator. More...

#include "util/interpolator1D.h"

Public Member Functions

 Interpolator1D (std::string method="linear")
 Default constructor, x and f must be set before operator() can be called.
 
 Interpolator1D (std::vector< double > x, std::vector< double > f, std::string method="linear")
 Construct Interpolator1D object with x and f defined.
 
 Interpolator1D (std::string ifile, size_t column, size_t headers=0, std::string method="linear")
 Construct Interpolator1D object with x and f as read in from <ifile> in columns 1 (x) and <column> (f) after ignoring the first <headers> lines.
 
void set_tables (std::vector< double > x, std::vector< double > f)
 Sets/resets the tabulated independent (x) and dependent (f) variable values.
 
double operator() (double x) const
 Linear interpolation function.
 

Private Member Functions

double linear (double x) const
 Monotone cubic, or mcubic interpolation using the https://epubs.siam.org/doi/10.1137/0717021 Fritch&Carlson method.
 
double mcubic (double x) const
 
void set_mcubic ()
 

Private Attributes

std::vector< double > _x
 
std::vector< double > _y
 
std::vector< double > _s
 
std::vector< double > _dx
 
std::vector< double > _dy
 
std::vector< double > _c1
 
std::vector< double > _c2
 
std::vector< double > _c3
 
std::string _method
 Linear interpolation or linear.
 

Detailed Description

Takes a monotonic, but not necessarily regular, pair of independent and dependent variables, x and f, and encapsulates linear interpolation. Can also read these in from a file given the column and number of headers (assumes the independent variable is listed in the first column).


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