|
criptic v1
Cosmic Ray Interstellar Propagation Tool using Itô Calculus
|
A class to handle interpolation on 2D tables. More...
#include <Interp2D.H>
Public Member Functions | |
| Interp2D (const double *x_, const double *y_, const double *z_, const size_t nx_, const size_t ny_, const extrapType extrapXLo_=extrapError, const extrapType extrapXHi_=extrapError, const extrapType extrapYLo_=extrapError, const extrapType extrapYHi_=extrapError, const bool xLog_=false, const bool yLog_=false, const bool zLog_=false, const double zXLo_=0.0, const double zXHi_=0.0, const double zYLo_=0.0, const double zYHi_=0.0) | |
| Constructor. | |
| ~Interp2D () | |
| Destructor. | |
| double | xMin () const |
| Return lower limit of table in x. | |
| double | xMax () const |
| Return upper limit of table x. | |
| double | yMin () const |
| Return lower limit of table in y. | |
| double | yMax () const |
| Return upper limit of table y. | |
| double | operator() (const Real &x_, const Real &y_) const |
| Caclulate an interpolated value from the table. | |
Private Attributes | |
| const double * | x |
| const double * | y |
| const double * | z |
| const size_t | nx |
| const size_t | ny |
| const extrapType | extrapXLo |
| const extrapType | extrapXHi |
| const extrapType | extrapYLo |
| const extrapType | extrapYHi |
| const bool | xLog |
| const bool | yLog |
| const bool | zLog |
| const double | zXLo |
| const double | zXHi |
| const double | zYLo |
| const double | zYHi |
| gsl_interp2d * | interp |
| ThreadVec< gsl_interp_accel * > | accX |
| ThreadVec< gsl_interp_accel * > | accY |
Static Private Attributes | |
| static constexpr double | tol = 1.0e-8 |
A class to handle interpolation on 2D tables.
This class wraps the GSL interpolation routines and provides interpolation on 2D 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 first independent variable |
| y_ | Tabular data in the second independent variable |
| z_ | Tabular data for the dependent variable |
| nx_ | Number of entries in table in x direction |
| ny_ | Number of entries in table in y direction |
| extrapXLo_ | Type of extrapolation to use in low x direction |
| extrapXHi_ | Type of extrapolation to use in high x direction |
| extrapYLo_ | Type of extrapolation to use in low y direction |
| extrapYHi_ | Type of extrapolation to use in high y direction |
| xLog_ | If true, the values in x are log_10(x) |
| yLog_ | If true, the values in y are log_10(y) |
| zLog_ | If true, the values in z are log_10(z) |
| zXLo_ | Value for off-table low extrapolation in x |
| zXHi_ | Value for off-table high extrapolation in x |
| zYLo_ | Value for off-table low extrapolation in x |
| zYHi_ | Value for off-table high extrapolation in x |
This class does not make any copies of the underlying data pointed to by x_, y_, or z_, so it is the responsibility of the user not to modify or deallocate them. The parameters zXLo_ and zXHi_ are only used if extrapXLo_ or extrapXHi_ is set to extrapFixedVal, in which case they specify the fixed value that is returned; the same applies to zYLo_ and zYHi_.
|
inline |
Destructor.
Caclulate an interpolated value from the table.
| x_ | The x value to which to interpolate |
| y_ | The y value to which to interpolate |
|
inline |
Return upper limit of table x.
|
inline |
Return lower limit of table in x.
|
inline |
Return upper limit of table y.
|
inline |
Return lower limit of table in y.
|
private |
GSL accelerator for x
|
private |
GSL accelerator for y
|
private |
Extrapolation type in high x direction
|
private |
Extrapolation type in low x direction
|
private |
Extrapolation type in high y direction
|
private |
Extrapolation type in low y direction
|
private |
GSL interpolator
|
private |
Number of entries in table in x direction
|
private |
Number of entries in table in y direction
|
staticconstexprprivate |
Tolerance for off-table values
|
private |
x values in table
|
private |
Are the x values logarithmic?
|
private |
y values in table
|
private |
Are the y values logarithmic?
|
private |
z values in table
|
private |
Are the z values logarithmic?
|
private |
Off-table high x value
|
private |
Off-table low x value
|
private |
Off-table high y value
|
private |
Off-table low y value