38 #ifndef EGS_INTERPOLATOR_
39 #define EGS_INTERPOLATOR_
43 typedef EGS_Float(*EGS_InterpolatorFuncion)(EGS_Float,
void *);
63 const EGS_Float *values);
73 EGS_InterpolatorFuncion func,
85 EGS_InterpolatorFuncion func,
void *data,
86 int nmax = 1024, EGS_Float accu = 1e-4);
97 EGS_Float *a, EGS_Float *b);
109 void initialize(
int nbin, EGS_Float Xmin, EGS_Float Xmax,
110 const EGS_Float *values);
119 void initialize(
int nbin, EGS_Float Xmin, EGS_Float Xmax,
120 EGS_InterpolatorFuncion func,
129 void initialize(EGS_Float Xmin, EGS_Float Xmax,
130 EGS_InterpolatorFuncion func,
void *data,
131 int nmax = 1024, EGS_Float accu = 1e-4);
140 void initialize(
int nbin, EGS_Float Xmin, EGS_Float Xmax,
141 EGS_Float *a, EGS_Float *b);
152 if (x > xmin && x < xmax) {
153 int i = (int)(ax + bx*x);
157 return a[i] + b[i]*x;
159 else if (x <= xmin) {
175 int i = (int)(ax + bx*x);
176 return a[i] + b[i]*x;
184 if (x > xmin && x < xmax) {
185 return (
int)(ax + bx*x);
187 else if (x <= xmin) {
203 return (
int)(ax + bx*x);
223 return a[i] + b[i]*x;
235 inline EGS_Float
get_a(
int i)
const {
239 inline EGS_Float
get_b(
int i)
const {
254 void check(
int nbin, EGS_Float Xmin, EGS_Float Xmax);
A class for fast run-time interpolations.
int getIndex(EGS_Float x) const
Get the interpolation index corresponding to x.
EGS_Float interpolate(EGS_Float x) const
Interpolate the function value at x.
EGS_Float getXmax() const
Get the upper interpolation interval limit.
EGS_Float get_b(int i) const
Get i-th interval interpolation parameter b[i].
EGS_Float get_a(int i) const
Get i-th interval interpolation parameter a[i].
EGS_Float interpolateFast(int i, EGS_Float x) const
Interpolate the function value at x assuming that belongs to the interpolation interval i.
EGS_Float getXmin() const
Get the lower interpolation interval limit.
EGS_Float interpolateFast(EGS_Float x) const
Interpolate the function value at x.
int getIndexFast(EGS_Float x) const
Get the interpolation index corresponding to x.
Defines the EGS_EXPORT and EGS_LOCAL macros.
#define EGS_EXPORT
Export symbols from the egspp library.