17 using namespace genie;
21 #if GSL_MAJOR_VERSION >= 2 22 #include "gsl/gsl_spline2d.h" 34 interp_accel_container() : acc(NULL) {};
35 ~interp_accel_container() {
if (acc)
delete acc; };
36 gsl_interp_accel * acc;
43 const size_t & size_x,
const double * grid_x,
44 const size_t & size_y,
const double * grid_y,
45 const double * knots) :
50 fSpline->spl = gsl_spline2d_alloc(gsl_interp2d_bilinear,size_x,size_y);
51 gsl_spline2d_init(fSpline->spl,grid_x,grid_y,knots,size_x,size_y);
52 fAcc_x->acc = gsl_interp_accel_alloc();
53 fAcc_y->acc = gsl_interp_accel_alloc();
58 if (fSpline)
delete fSpline;
59 if (fAcc_x )
delete fAcc_x;
60 if (fAcc_y )
delete fAcc_y;
65 return gsl_spline2d_eval(
73 return gsl_spline2d_eval_deriv_x(
81 return gsl_spline2d_eval_deriv_y(
89 return gsl_spline2d_eval_deriv_xx(
97 return gsl_spline2d_eval_deriv_xy(
105 return gsl_spline2d_eval_deriv_yy(
115 #include "TGraph2D.h" 133 const size_t & size_x,
const double * grid_x,
134 const size_t & size_y,
const double * grid_y,
135 const double * knots) :
143 for (
size_t iy = 0 ; iy < size_y ; iy++) {
144 for (
size_t ix = 0 ; ix < size_x ; ix++) {
145 fSpline->
spl->SetPoint(iz,grid_x[ix],grid_y[iy],knots[iz]);
165 assert(!
"Method requires GSL version 2 or higher.");
171 assert(!
"Method requires GSL version 2 or higher.");
177 assert(!
"Method requires GSL version 2 or higher.");
183 assert(!
"Method requires GSL version 2 or higher.");
189 assert(!
"Method requires GSL version 2 or higher.");
194 #endif // GSL_MAJOR_VERSION THE MAIN GENIE PROJECT NAMESPACE
double Eval(const double &x, const double &y) const
double DerivXY(const double &x, const double &y) const
double DerivYY(const double &x, const double &y) const
double DerivXX(const double &x, const double &y) const
spline2d_container * fSpline
~interp_accel_container()
Interpolator2D(const size_t &size_x, const double *grid_x, const size_t &size_y, const double *grid_y, const double *knots)
double DerivX(const double &x, const double &y) const
A 2D interpolator using the GSL spline type If GSL version is not sufficient, does an inefficient ver...
interp_accel_container * fAcc_y
interp_accel_container * fAcc_x
double DerivY(const double &x, const double &y) const