Spline Class ReferenceΒΆ

Splines: Splines::Spline Class Reference
Splines
Splines::Spline Class Referenceabstract

#include <Splines.hh>

Inheritance diagram for Splines::Spline:
Splines::ConstantSpline Splines::CubicSplineBase Splines::LinearSpline Splines::QuinticSplineBase Splines::AkimaSpline Splines::BesselSpline Splines::CubicSpline Splines::HermiteSpline Splines::PchipSpline Splines::QuinticSpline

Public Member Functions

void search (std::pair< integer, real_type > &res) const
 
Constructors
 Spline (string const &name="Spline")
 
virtual ~Spline ()
 
Open/Close
string const & name () const
 
bool is_closed () const
 
void make_closed ()
 
void make_opened ()
 
bool is_bounded () const
 
void make_unbounded ()
 
void make_bounded ()
 
bool is_extended_constant () const
 
void make_extended_constant ()
 
void make_extended_not_constant ()
 
Spline Data Info
integer num_points () const
 
real_type x_node (integer i) const
 
real_type y_node (integer i) const
 
real_type x_begin () const
 
real_type y_begin () const
 
real_type x_end () const
 
real_type y_end () const
 
real_type x_min () const
 
real_type x_max () const
 
real_type y_min () const
 
real_type y_max () const
 
virtual void y_min_max (integer &i_min_pos, real_type &x_min_pos, real_type &y_min, integer &i_max_pos, real_type &x_max_pos, real_type &y_max) const
 
virtual void y_min_max (vector< integer > &i_min_pos, vector< real_type > &x_min_pos, vector< real_type > &y_min, vector< integer > &i_max_pos, vector< real_type > &x_max_pos, vector< real_type > &y_max) const
 
Build
void build (GenericContainer const &gc)
 
virtual void build (real_type const x[], integer incx, real_type const y[], integer incy, integer n)
 
void build (real_type const x[], real_type const y[], integer n)
 
void build (vector< real_type > const &x, vector< real_type > const &y)
 
virtual void build ()=0
 
virtual void setup (GenericContainer const &gc)
 
Incremental Build
virtual void reserve (integer npts)=0
 
void push_back (real_type x, real_type y)
 
void drop_back ()
 
virtual void clear ()=0
 
Manipulate
void set_origin (real_type x0)
 
void set_range (real_type xmin, real_type xmax)
 
Dump Data
void dump (ostream_type &s, integer nintervals, char const header[]="x\ty") const
 
void dump (char const fname[], integer nintervals, char const header[]="x\ty") const
 
virtual void write_to_stream (ostream_type &s) const =0
 
Evaluation
virtual real_type eval (real_type x) const =0
 
virtual real_type D (real_type x) const =0
 
virtual real_type DD (real_type x) const =0
 
virtual real_type DDD (real_type x) const =0
 
virtual real_type DDDD (real_type) const
 
virtual real_type DDDDD (real_type) const
 
Evaluation Aliases
real_type operator() (real_type x) const
 
real_type eval_D (real_type x) const
 
real_type eval_DD (real_type x) const
 
real_type eval_DDD (real_type x) const
 
real_type eval_DDDD (real_type x) const
 
real_type eval_DDDDD (real_type x) const
 
Evaluation when segment is known
virtual real_type id_eval (integer ni, real_type x) const =0
 
virtual real_type id_D (integer ni, real_type x) const =0
 
virtual real_type id_DD (integer ni, real_type x) const =0
 
virtual real_type id_DDD (integer ni, real_type x) const =0
 
virtual real_type id_DDDD (integer, real_type) const
 
virtual real_type id_DDDDD (integer, real_type) const
 
Get Info
virtual integer coeffs (real_type cfs[], real_type nodes[], bool transpose=false) const =0
 
virtual integer order () const =0
 
char const * type_name () const
 
virtual SplineType1D type () const =0
 
string info () const
 
void info (ostream_type &stream) const
 

Friends

class SplineSet
 

Detailed Description

Spline Management Class

Constructor & Destructor Documentation

◆ Spline()

Splines::Spline::Spline ( string const & name = "Spline")
inline

spline constructor

◆ ~Spline()

virtual Splines::Spline::~Spline ( )
inlinevirtual

spline destructor

Member Function Documentation

◆ build() [1/5]

virtual void Splines::Spline::build ( )
pure virtual

◆ build() [2/5]

void Splines::Spline::build ( GenericContainer const & gc)
inline

Build a spline using data in GenericContainer

◆ build() [3/5]

void Splines::Spline::build ( real_type const x[],
integer incx,
real_type const y[],
integer incy,
integer n )
virtual

Build a spline.

Parameters
xvector of x-coordinates
incxaccess elements as x[0], x[incx], x[2*incx],...
yvector of y-coordinates
incyaccess elements as y[0], y[incx], y[2*incx],...
ntotal number of points

Reimplemented in Splines::ConstantSpline, and Splines::HermiteSpline.

◆ build() [4/5]

void Splines::Spline::build ( real_type const x[],
real_type const y[],
integer n )
inline

Build a spline.

Parameters
xvector of x-coordinates
yvector of y-coordinates
ntotal number of points

◆ build() [5/5]

void Splines::Spline::build ( vector< real_type > const & x,
vector< real_type > const & y )
inline

Build a spline.

Parameters
xvector of x-coordinates
yvector of y-coordinates

◆ clear()

virtual void Splines::Spline::clear ( )
pure virtual

Delete the support points, empty the spline.

Implemented in Splines::ConstantSpline, Splines::CubicSplineBase, Splines::LinearSpline, and Splines::QuinticSplineBase.

◆ coeffs()

virtual integer Splines::Spline::coeffs ( real_type cfs[],
real_type nodes[],
bool transpose = false ) const
pure virtual

get the piecewise polinomials of the spline

Implemented in Splines::ConstantSpline, Splines::CubicSplineBase, Splines::LinearSpline, and Splines::QuinticSplineBase.

◆ D()

virtual real_type Splines::Spline::D ( real_type x) const
pure virtual

◆ DD()

virtual real_type Splines::Spline::DD ( real_type x) const
pure virtual

◆ DDD()

virtual real_type Splines::Spline::DDD ( real_type x) const
pure virtual

◆ DDDD()

virtual real_type Splines::Spline::DDDD ( real_type ) const
inlinevirtual

4th derivative

Reimplemented in Splines::CubicSplineBase, and Splines::QuinticSplineBase.

◆ DDDDD()

virtual real_type Splines::Spline::DDDDD ( real_type ) const
inlinevirtual

5th derivative

Reimplemented in Splines::CubicSplineBase, and Splines::QuinticSplineBase.

◆ drop_back()

void Splines::Spline::drop_back ( )
inline

Drop last inserted point of the spline.

◆ dump() [1/2]

void Splines::Spline::dump ( char const fname[],
integer nintervals,
char const header[] = "x\ty" ) const
inline

dump a sample of the spline

◆ dump() [2/2]

void Splines::Spline::dump ( ostream_type & s,
integer nintervals,
char const header[] = "x\ty" ) const

dump a sample of the spline

◆ eval()

virtual real_type Splines::Spline::eval ( real_type x) const
pure virtual

◆ eval_D()

real_type Splines::Spline::eval_D ( real_type x) const
inline

Alias for real_type D( real_type x )

◆ eval_DD()

real_type Splines::Spline::eval_DD ( real_type x) const
inline

Alias for real_type DD( real_type x )

◆ eval_DDD()

real_type Splines::Spline::eval_DDD ( real_type x) const
inline

Alias for real_type DDD( real_type x )

◆ eval_DDDD()

real_type Splines::Spline::eval_DDDD ( real_type x) const
inline

Alias for real_type DDDD( real_type x )

◆ eval_DDDDD()

real_type Splines::Spline::eval_DDDDD ( real_type x) const
inline

Alias for real_type DDDD( real_type x )

◆ id_D()

virtual real_type Splines::Spline::id_D ( integer ni,
real_type x ) const
pure virtual

◆ id_DD()

virtual real_type Splines::Spline::id_DD ( integer ni,
real_type x ) const
pure virtual

◆ id_DDD()

virtual real_type Splines::Spline::id_DDD ( integer ni,
real_type x ) const
pure virtual

◆ id_DDDD()

virtual real_type Splines::Spline::id_DDDD ( integer ,
real_type  ) const
inlinevirtual

4th derivative

Reimplemented in Splines::CubicSplineBase, and Splines::QuinticSplineBase.

◆ id_DDDDD()

virtual real_type Splines::Spline::id_DDDDD ( integer ,
real_type  ) const
inlinevirtual

5th derivative

Reimplemented in Splines::CubicSplineBase, and Splines::QuinticSplineBase.

◆ id_eval()

virtual real_type Splines::Spline::id_eval ( integer ni,
real_type x ) const
pure virtual

◆ info() [1/2]

string Splines::Spline::info ( ) const

String information of the kind and order of the spline

◆ info() [2/2]

void Splines::Spline::info ( ostream_type & stream) const
inline

Print information of the kind and order of the spline

◆ is_bounded()

bool Splines::Spline::is_bounded ( ) const
inline
Returns
true if spline cannot extend outside interval of definition

◆ is_closed()

bool Splines::Spline::is_closed ( ) const
inline
Returns
true if spline is a closed spline

◆ is_extended_constant()

bool Splines::Spline::is_extended_constant ( ) const
inline
Returns
true if the spline extend with a constant value

◆ make_bounded()

void Splines::Spline::make_bounded ( )
inline

Set spline as bounded. When evaluated if parameter is outside the domain an error is issued.

◆ make_closed()

void Splines::Spline::make_closed ( )
inline

Set spline as a closed spline. When evaluated if parameter is outside the domain is wrapped cyclically before evalation.

◆ make_extended_constant()

void Splines::Spline::make_extended_constant ( )
inline

Set spline to extend constant. When evaluated if parameter is outside the domain the value returned is the value of the closed border.

◆ make_extended_not_constant()

void Splines::Spline::make_extended_not_constant ( )
inline

Set spline to extend NOT constant. When evaluated if parameter is outside the domain teh value returned is extrapolated using the last spline polynomial.

◆ make_opened()

void Splines::Spline::make_opened ( )
inline

Set spline as an opened spline. When evaluated if parameter is outside the domain an error is produced.

◆ make_unbounded()

void Splines::Spline::make_unbounded ( )
inline

Set spline as unbounded. When evaluated if parameter is outside the domain an extrapolated value is used.

◆ name()

string const & Splines::Spline::name ( ) const
inline
Returns
string with the name of the spline

◆ num_points()

integer Splines::Spline::num_points ( ) const
inline

the number of support points of the spline.

◆ operator()()

real_type Splines::Spline::operator() ( real_type x) const
inline

Alias for real_type eval( real_type x )

◆ order()

virtual integer Splines::Spline::order ( ) const
pure virtual

◆ push_back()

void Splines::Spline::push_back ( real_type x,
real_type y )

Add a support point (x,y) to the spline.

◆ reserve()

virtual void Splines::Spline::reserve ( integer npts)
pure virtual

◆ search()

void Splines::Spline::search ( std::pair< integer, real_type > & res) const

Find interval containing x using binary search.

◆ set_origin()

void Splines::Spline::set_origin ( real_type x0)

change X-origin of the spline

◆ set_range()

void Splines::Spline::set_range ( real_type xmin,
real_type xmax )

change X-range of the spline

◆ setup()

void Splines::Spline::setup ( GenericContainer const & gc)
virtual

Setup a spline using a GenericContainer

  • gc("xdata") vector with the x coordinate of the data
  • gc("ydata") vector with the y coordinate of the data

Reimplemented in Splines::AkimaSpline, Splines::BesselSpline, Splines::ConstantSpline, Splines::CubicSpline, Splines::HermiteSpline, Splines::LinearSpline, Splines::PchipSpline, and Splines::QuinticSpline.

◆ type()

◆ type_name()

char const * Splines::Spline::type_name ( ) const
inline

spline type returned as a string

◆ write_to_stream()

virtual void Splines::Spline::write_to_stream ( ostream_type & s) const
pure virtual

◆ x_begin()

real_type Splines::Spline::x_begin ( ) const
inline

first node of the spline (x component).

◆ x_end()

real_type Splines::Spline::x_end ( ) const
inline

last node of the spline (x component).

◆ x_max()

real_type Splines::Spline::x_max ( ) const
inline

x-maximum spline value

◆ x_min()

real_type Splines::Spline::x_min ( ) const
inline

x-minumum spline value

◆ x_node()

real_type Splines::Spline::x_node ( integer i) const
inline

the i-th node of the spline (x component).

◆ y_begin()

real_type Splines::Spline::y_begin ( ) const
inline

first node of the spline (y component).

◆ y_end()

real_type Splines::Spline::y_end ( ) const
inline

last node of the spline (y component).

◆ y_max()

real_type Splines::Spline::y_max ( ) const
inline

return y-maximum spline value

◆ y_min()

real_type Splines::Spline::y_min ( ) const
inline

y-minumum spline value

◆ y_min_max() [1/2]

void Splines::Spline::y_min_max ( integer & i_min_pos,
real_type & x_min_pos,
real_type & y_min,
integer & i_max_pos,
real_type & x_max_pos,
real_type & y_max ) const
virtual

Search the max and min values of y along the spline with the corresponding x position

Parameters
[out]i_min_posinterval where is the minimum
[out]x_min_poswhere is the minimum
[out]y_minthe minimum value
[out]i_max_posinterval where is the maximum
[out]x_max_poswhere is the maximum
[out]y_maxthe maximum value

Reimplemented in Splines::ConstantSpline, Splines::CubicSplineBase, Splines::LinearSpline, and Splines::QuinticSplineBase.

◆ y_min_max() [2/2]

void Splines::Spline::y_min_max ( vector< integer > & i_min_pos,
vector< real_type > & x_min_pos,
vector< real_type > & y_min,
vector< integer > & i_max_pos,
vector< real_type > & x_max_pos,
vector< real_type > & y_max ) const
virtual

Search the max and min values of y along the spline with the corresponding x position

Parameters
[out]i_min_posinterval where is the minimum
[out]x_min_poswhere is the minimum
[out]y_minthe minimum value
[out]i_max_posinterval where is the maximum
[out]x_max_poswhere is the maximum
[out]y_maxthe maximum value

Reimplemented in Splines::ConstantSpline, Splines::CubicSplineBase, Splines::LinearSpline, and Splines::QuinticSplineBase.

◆ y_node()

real_type Splines::Spline::y_node ( integer i) const
inline

the i-th node of the spline (y component).


The documentation for this class was generated from the following files:
  • /Users/enrico/Ricerca/develop/PINS/pins-mechatronix/LibSources/submodules/Splines/src/Splines.hh
  • /Users/enrico/Ricerca/develop/PINS/pins-mechatronix/LibSources/submodules/Splines/src/Splines.cc