|
criptic v1
Cosmic Ray Interstellar Propagation Tool using Itô Calculus
|
A class to handle interpolation on 1D tables. More...
#include <Interp1D.H>
Public Member Functions | |
| Interp1D (const double *x_, const double *y_, const size_t n_, const extrapType extrapLo_=extrapError, const extrapType extrapHi_=extrapError, const bool xLog_=false, const bool yLog_=false, const double yLo_=0.0, const double yHi_=0.0) | |
| Constructor. | |
| ~Interp1D () | |
| Destructor. | |
| double | xMin () const |
| Return lower limit of table. | |
| double | xMax () const |
| Return upper limit of table. | |
| double | operator() (const Real &x_) const |
| Caclulate an interpolated value from the table. | |
Private Attributes | |
| const double * | x |
| const double * | y |
| const size_t | n |
| const extrapType | extrapLo |
| const extrapType | extrapHi |
| const bool | xLog |
| const bool | yLog |
| const double | yLo |
| const double | yHi |
| double | mLo |
| double | mHi |
| gsl_interp * | interp |
| ThreadVec< gsl_interp_accel * > | acc |
Static Private Attributes | |
| static constexpr double | tol = 1.0e-8 |
A class to handle interpolation on 1D tables.
This class wraps the GSL interpolation routines and provides interpolation on 1D tables. It automatically handles things like take logarithms when the tables are logarithmic, extrapolating where necessary, etc. Note that, because this is intended to wrap the GSL, all Real numbers here are double precision, even if the rest of the code operates in single precision.
|
inline |
Constructor.
| x_ | Tabular data in the independent variable |
| y_ | Tabular data in the dependent variable |
| n_ | Number of entries in table |
| extrapLo_ | Type of extrapolation to use in low direction |
| extrapHi_ | Type of extrapolation to use in high direction |
| xLog_ | If true, the values in x are log_10(x) |
| yLog_ | If true, the values in y are log_10(y) |
| yLo_ | Value for off-table low extrapolation |
| yHi_ | Value for off-table high extrapolation |
This class does not make any copies of the underlying data pointed to by x_ or y_, so it is the responsibility of the user not to modify or deallocate them. The parameters yLo_ and yHi_ are only used if extrapLo_ or extrapHi_ is set to extrapFixedVal, in which case they specify the fixed value that is returned.
|
inline |
Destructor.
|
inline |
Caclulate an interpolated value from the table.
| x_ | The value to which to interpolate |
|
inline |
Return upper limit of table.
|
inline |
Return lower limit of table.
|
private |
GSL accelerator
|
private |
Type of extrapolation in high direction
|
private |
Type of extrapolation in low direction
|
private |
GSL interpolator
|
private |
Slope for extrapolation in high direction
|
private |
Slope for extrapolation in low direction
|
private |
Number of entries in table
|
staticconstexprprivate |
Tolerance for off-table values
|
private |
x values in table
|
private |
Are the x values logarithmic?
|
private |
y values in table
|
private |
Off-table high value
|
private |
Off-table low value
|
private |
Are the y values logarithmic?