27 #include "antioch_config.h"
28 #ifdef ANTIOCH_HAVE_GSL
29 #ifndef ANTIOCH_GSL_SPLINER_H
30 #define ANTIOCH_GSL_SPLINER_H
54 template <
typename VectorCoeffType>
55 GSLSpliner(
const VectorCoeffType & data_x_point,
const VectorCoeffType & data_y_point);
69 template <
typename VectorCoeffType>
70 void spline_init(
const VectorCoeffType & data_x_point,
const VectorCoeffType & data_y_point);
80 template <
typename StateType>
81 StateType interpolated_value(
const StateType & x)
const;
88 template <
typename StateType>
89 StateType dinterp_dx(
const StateType & x)
const;
98 AntiochPrivate::GSLSplinerShim _gsl_shim;
102 template <
typename VectorCoeffType>
104 GSLSpliner::GSLSpliner(
const VectorCoeffType & data_x_point,
const VectorCoeffType & data_y_point)
106 this->spline_init(data_x_point, data_y_point);
110 void GSLSpliner::spline_delete()
112 _gsl_shim.spline_clear();
115 template <
typename VectorCoeffType>
117 void GSLSpliner::spline_init(
const VectorCoeffType & data_x_point,
const VectorCoeffType & data_y_point)
122 typedef typename rebind<VectorCoeffType,double>::type VectorGSLType;
123 VectorGSLType gsl_x_point(data_x_point.size(),0);
124 VectorGSLType gsl_y_point(data_y_point.size(),0);
125 for(
unsigned int i = 0; i < data_x_point.size(); i++)
127 gsl_x_point[i] = (
const double)data_x_point[i];
128 gsl_y_point[i] = (
const double)data_y_point[i];
131 const double * x = &gsl_x_point[0];
132 const double * y = &gsl_y_point[0];
134 _gsl_shim.spline_init(x, y, data_x_point.size());
137 template <
typename StateType>
139 StateType GSLSpliner::interpolated_value(
const StateType & x)
const
141 return AntiochPrivate::GSLSplinerPolicy<has_size<StateType>::value>().interpolation(x, _gsl_shim);
144 template <
typename StateType>
146 StateType GSLSpliner::dinterp_dx(
const StateType & x)
const
148 return AntiochPrivate::GSLSplinerPolicy<has_size<StateType>::value>().dinterpolation(x, _gsl_shim);
153 #endif // ANTIOCH_GSL_SPLINE
155 #endif// if ANTIOCH_HAVE_GSL
#define antioch_assert_equal_to(expr1, expr2)
The parameters are reduced parameters.