12 #ifndef ECL_SMOOTH_LINEAR_SPLINE_HPP_
13 #define ECL_SMOOTH_LINEAR_SPLINE_HPP_
53 SmoothLinearSpline() {}
77 SmoothLinearSpline(
const Array<double>& x_data,
const Array<double>& y_data,
double a_max);
79 virtual ~SmoothLinearSpline() {}
90 double operator()(
const double &x)
const;
101 double derivative(
const double &x)
const;
110 double dderivative(
const double &x)
const;
120 const Array<double>& domain()
const {
return discretised_domain; }
136 static SmoothLinearSpline Interpolation(
const Array<double>& x_data,
const Array<double>& y_data,
double a_max)
139 return SmoothLinearSpline(x_data, y_data, a_max);
140 }
catch ( DataException<int> &e ) {
141 throw DataException<int>(LOC,e);
143 return SmoothLinearSpline();
162 template <
typename OutputStream>
163 friend OutputStream&
operator << (OutputStream &ostream,
const SmoothLinearSpline &smooth_linear_spline);
166 Array<double> discretised_domain;
167 Array<LinearFunction> segments;
168 Array<QuinticPolynomial> corners;
175 template <
typename OutputStream>
176 OutputStream&
operator << (OutputStream &ostream,
const SmoothLinearSpline &smooth_linear_spline) {
180 ostream << smooth_linear_spline.segments[0] <<
"\n";
181 for (
unsigned int i = 1; i < smooth_linear_spline.segments.size(); ++i ) {
182 ostream << smooth_linear_spline.corners[i-1] <<
"\n";
183 ostream << smooth_linear_spline.segments[i] <<
"\n";