KrisLibrary
1.0.0
|
A 1D tabular function interpolated over a grid. More...
#include <Tabular.h>
Public Member Functions | |
Table1D (int n, Real a, Real b, int dim=0) | |
Table1D (const std::vector< T > &values, Real a, Real b, int dim=0) | |
T | Lookup (Real x) const |
int | Index (Real x, Real *u=NULL) const |
std::pair< Real, Real > | Cell (int index) const |
T | Lookup (const Config &x) const |
int | Index (const Config &x, Real *u=NULL) const |
Public Attributes | |
std::vector< T > | values |
Real | a |
Real | b |
int | dim |
A 1D tabular function interpolated over a grid.
The domain is [a,b]. If values contains n items v0,...,vn-1, then each item vi is reached exactly at x = a+(i+0.5)/n*(b-a) (interpolation through cell centers).
Each cell is "active" over the x range [a+i/n*(b-a),a+(i+1)/n*(b-a)].
Lookup gives the index i and the interpolation value u in [-0.5,0.5] that tells how much to blend an adjacent value at i-1 or i+1.