16 #include <deal.II/base/function_cspline.h> 17 #include <deal.II/base/point.h> 19 #ifdef DEAL_II_WITH_GSL 23 DEAL_II_NAMESPACE_OPEN
28 const std::vector<double> &y_)
29 : interpolation_points(x_)
30 , interpolation_values(y_)
46 acc = gsl_interp_accel_alloc();
48 cspline = gsl_spline_alloc(gsl_interp_cspline, n);
61 gsl_interp_accel_free(acc);
62 gsl_spline_free(cspline);
76 std::lock_guard<std::mutex> lock(acc_mutex);
78 const double x = p[0];
79 Assert(x >= interpolation_points.front() &&
80 x <= interpolation_points.back(),
82 interpolation_points.front(),
83 interpolation_points.back()));
85 return gsl_spline_eval(cspline, x, acc);
97 std::lock_guard<std::mutex> lock(acc_mutex);
99 const double x = p[0];
100 Assert(x >= interpolation_points.front() &&
101 x <= interpolation_points.back(),
103 interpolation_points.front(),
104 interpolation_points.back()));
106 const double deriv = gsl_spline_eval_deriv(cspline, x, acc);
121 std::lock_guard<std::mutex> lock(acc_mutex);
123 const double x = p[0];
124 Assert(x >= interpolation_points.front() &&
125 x <= interpolation_points.back(),
127 interpolation_points.front(),
128 interpolation_points.back()));
130 return gsl_spline_eval_deriv2(cspline, x, acc);
140 res[0][0] = laplacian(p);
152 return sizeof(*this) + 2 *
sizeof(double) * interpolation_values.size();
157 template class CSpline<1>;
161 DEAL_II_NAMESPACE_CLOSE
virtual SymmetricTensor< 2, dim > hessian(const Point< dim > &p, const unsigned int component=0) const override
virtual ~CSpline() override
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const override
virtual double value(const Point< dim > &point, const unsigned int component=0) const override
#define AssertThrow(cond, exc)
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
static ::ExceptionBase & ExcCSplineEmpty(int arg1)
#define Assert(cond, exc)
const std::vector< double > interpolation_points
static ::ExceptionBase & ExcCSplineOrder(int arg1, double arg2, double arg3)
const std::vector< double > interpolation_values
static ::ExceptionBase & ExcCSplineRange(double arg1, double arg2, double arg3)
static ::ExceptionBase & ExcCSplineSizeMismatch(int arg1, int arg2)
CSpline(const std::vector< double > &interpolation_points, const std::vector< double > &interpolation_values)