Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
ecl::SmoothLinearSpline Class Reference

Storage container for a smoothed linear spline interpolation. More...

#include <smooth_linear_spline.hpp>

Public Member Functions

double dderivative (const double &x) const
 Spline second derivative. More...
 
double derivative (const double &x) const
 Spline derivative. More...
 
const Array< double > & domain () const
 The discretised domain for this spline. More...
 
double operator() (const double &x) const
 Spline function. More...
 
 SmoothLinearSpline ()
 Default constructor. More...
 
 SmoothLinearSpline (const Array< double > &x_data, const Array< double > &y_data, double a_max)
 Constructor that properly configures the ramped spline. More...
 
virtual ~SmoothLinearSpline ()
 

Static Public Member Functions

static SmoothLinearSpline Interpolation (const Array< double > &x_data, const Array< double > &y_data, double a_max)
 

Private Attributes

Array< QuinticPolynomialcorners
 
Array< double > discretised_domain
 
Array< LinearFunctionsegments
 

Friends

template<typename OutputStream >
OutputStream & operator<< (OutputStream &ostream, const SmoothLinearSpline &smooth_linear_spline)
 Streaming output insertion operator for smoothed linear splines. More...
 

Detailed Description

Storage container for a smoothed linear spline interpolation.

These interpolations connect waypoints linearly and add a smoothed corner (using a quintic polynomial) to connect each linear segment. The shape of the corners is parameterised with a maximum curvature parameter (acceleration).

Math::Splines.

Definition at line 51 of file smooth_linear_spline.hpp.

Constructor & Destructor Documentation

◆ SmoothLinearSpline() [1/2]

ecl::SmoothLinearSpline::SmoothLinearSpline ( )
inline

Default constructor.

Don't really need this, but things like vectors and array containers need it so they can reserve the appropriate storage.

Definition at line 67 of file smooth_linear_spline.hpp.

◆ SmoothLinearSpline() [2/2]

ecl::SmoothLinearSpline::SmoothLinearSpline ( const Array< double > &  x_data,
const Array< double > &  y_data,
double  a_max 
)

Constructor that properly configures the ramped spline.

The constructor uses the input data sets to initialise the segmentation. Corners are constrained by the maximum curvature (acceleration) - if construction should fail (not enough space between the waypoints) then this method will throw an exception indicating failure. It is accompanied with an int type data element that indicates the number of the segment that failed to construct. Failure typically occurs because the maximum curvature constraint at the corner was broken. Try increasing the maximum curvature constraint or increasing the time duration of the specified segment to ensure success a second time around.

Parameters
a_max: the maximum bound (absolute) on the acceleration.
x_data: set of data on the domain axis.
y_data: set of values on the range axis.
Exceptions
DataException : throws if the spline could not be constructed because of broken a_max constraint.

The int data for the exception represents the element in the set which could not make a corner without breaking the acceleration constraint. Note that if you have a data set of size 5 (i.e. elements 0-4), then it will only throw between 1 and 3, as this is where smoothed corners are built.

Definition at line 34 of file smooth_linear_spline.cpp.

◆ ~SmoothLinearSpline()

virtual ecl::SmoothLinearSpline::~SmoothLinearSpline ( )
inlinevirtual

Definition at line 93 of file smooth_linear_spline.hpp.

Member Function Documentation

◆ dderivative()

double ecl::SmoothLinearSpline::dderivative ( const double &  x) const

Spline second derivative.

Extract the second derivative of the spline.

Parameters
x: the domain value.
Returns
double : the second derivative of the spline.
Exceptions
StandardException : throws if x is outside the spline range [debug mode only].

Definition at line 142 of file smooth_linear_spline.cpp.

◆ derivative()

double ecl::SmoothLinearSpline::derivative ( const double &  x) const

Spline derivative.

Extract the derivative of the spline at the indicated value.

Parameters
x: the domain value.
Returns
double : the derivative of the spline.
Exceptions
StandardException : throws if x is outside the spline range [debug mode only].

Definition at line 129 of file smooth_linear_spline.cpp.

◆ domain()

const Array<double>& ecl::SmoothLinearSpline::domain ( ) const
inline

The discretised domain for this spline.

This returns the array of discretised time values that define the domains of each polynomial within the spline.

Returns
const Array<double>& : the discretised domain.

Definition at line 134 of file smooth_linear_spline.hpp.

◆ Interpolation()

static SmoothLinearSpline ecl::SmoothLinearSpline::Interpolation ( const Array< double > &  x_data,
const Array< double > &  y_data,
double  a_max 
)
inlinestatic
@brief Static construction that interpolates on a set of waypoints.

Static construction that interpolates on a set of waypoints.
Parameters
x_data: set of data on the domain axis.
y_data: set of values on the range axis.
a_max: the maximum bound (absolute) on the acceleration.
Exceptions
DataException : throws if the spline could not be constructed, data is the segment # that failed.

Definition at line 150 of file smooth_linear_spline.hpp.

◆ operator()()

double ecl::SmoothLinearSpline::operator() ( const double &  x) const

Spline function.

Extract the spline function's value at the indicated location.

Parameters
x: the domain value.
Returns
double : the spline function's value.
Exceptions
StandardException : throws if x is outside the spline range [debug mode only].

Definition at line 116 of file smooth_linear_spline.cpp.

Friends And Related Function Documentation

◆ operator<<

template<typename OutputStream >
OutputStream& operator<< ( OutputStream &  ostream,
const SmoothLinearSpline smooth_linear_spline 
)
friend

Streaming output insertion operator for smoothed linear splines.

Streaming output insertion operator for smoothed linear splines. This simply lists the spline segments and corners (linear functions and quintic polynomials) in algebraic form.

Template Parameters
OutputStream: the type of stream being used.
Parameters
ostream: the output stream being used.
smooth_linear_spline: the tension spline.
Returns
OutputStream : the output stream.

Definition at line 182 of file smooth_linear_spline.hpp.

Member Data Documentation

◆ corners

Array<QuinticPolynomial> ecl::SmoothLinearSpline::corners
private

Definition at line 182 of file smooth_linear_spline.hpp.

◆ discretised_domain

Array<double> ecl::SmoothLinearSpline::discretised_domain
private

Definition at line 180 of file smooth_linear_spline.hpp.

◆ segments

Array<LinearFunction> ecl::SmoothLinearSpline::segments
private

Definition at line 181 of file smooth_linear_spline.hpp.


The documentation for this class was generated from the following files:


ecl_geometry
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:40