library of assembled shared sources |
http://lass.cocamware.com |
#include <spline_linear.h>
Data Structures | |
struct | Node |
Public Types | |
typedef DataTraits | TDataTraits |
typedef Spline< ScalarType, DataType > | TSplineBase |
typedef TSplineBase::TScalar | TScalar |
typedef TSplineBase::TData | TData |
typedef TSplineBase::ControlRange | TControlRange |
Public Member Functions | |
SplineLinear () | |
template<typename PairInputIterator > | |
SplineLinear (PairInputIterator iFirst, PairInputIterator iLast) | |
construct a spline from a range of control/data pairs. | |
template<typename ScalarInputIterator , typename DataInputIterator > | |
SplineLinear (ScalarInputIterator iFirstControl, ScalarInputIterator iLastControl, DataInputIterator iFirstData) | |
construct a spline from seperate ranges. | |
const TData | operator() (TScalar iX) const |
Get the linear interpolated data value that corresponds with constrol value iX. | |
const TData | derivative (TScalar iX) const |
Get the first derivative of data value that corresponds with constrol value iX. | |
const TData | derivative2 (TScalar iX) const |
Get the second derivative of data value that corresponds with constrol value iX. | |
const TData | integral (TScalar iA, TScalar iB) const |
Get the integrated data value between control points iA and iB. | |
const bool | isEmpty () const |
return true if the spline contains any nodes at all. | |
const TControlRange | controlRange () const |
return the range of control values for which the spline can interpolate. | |
virtual const TData | operator() (TScalar iX) const =0 |
virtual const TData | derivative (TScalar iX) const =0 |
virtual const TData | derivative2 (TScalar iX) const =0 |
virtual const TData | integral (TScalar iA, TScalar iB) const =0 |
Private Types | |
typedef std::vector< Node > | TNodes |
typedef TNodes::const_iterator | TNodeConstIterator |
Private Member Functions | |
void | init () |
const TNodeConstIterator | findNode (TScalar iX) const |
binary search to find node that belongs to iX | |
Private Attributes | |
TNodes | nodes_ |
size_t | dataDimension_ |
Definition at line 67 of file spline_linear.h.
typedef DataTraits lass::num::SplineLinear< ScalarType, DataType, DataTraits >::TDataTraits |
Definition at line 71 of file spline_linear.h.
typedef Spline<ScalarType, DataType> lass::num::SplineLinear< ScalarType, DataType, DataTraits >::TSplineBase |
Definition at line 72 of file spline_linear.h.
typedef TSplineBase::TScalar lass::num::SplineLinear< ScalarType, DataType, DataTraits >::TScalar |
Reimplemented from lass::num::Spline< ScalarType, DataType >.
Definition at line 73 of file spline_linear.h.
typedef TSplineBase::TData lass::num::SplineLinear< ScalarType, DataType, DataTraits >::TData |
Reimplemented from lass::num::Spline< ScalarType, DataType >.
Definition at line 74 of file spline_linear.h.
typedef TSplineBase::ControlRange lass::num::SplineLinear< ScalarType, DataType, DataTraits >::TControlRange |
Definition at line 75 of file spline_linear.h.
typedef std::vector<Node> lass::num::SplineLinear< ScalarType, DataType, DataTraits >::TNodes [private] |
Definition at line 103 of file spline_linear.h.
typedef TNodes::const_iterator lass::num::SplineLinear< ScalarType, DataType, DataTraits >::TNodeConstIterator [private] |
Definition at line 104 of file spline_linear.h.
lass::num::SplineLinear< S, D, T >::SplineLinear | ( | ) | [inline] |
Definition at line 60 of file spline_linear.inl.
lass::num::SplineLinear< S, D, T >::SplineLinear | ( | PairInputIterator | iFirst, | |
PairInputIterator | iLast | |||
) | [inline] |
construct a spline from a range of control/data pairs.
Each node consists of a control value and a data value. This contstructor accepts a single range [iFirst, iLast) of control/data pairs. The iterator type should have two fields first
and second
that contain respectively the control and data values. This is choosen so that a std::pair can be used as a representatin of the control/data pair.
PairInputIterator
has a member first
containing the control value PairInputIterator
has a member second
containing the data valueDefinition at line 86 of file spline_linear.inl.
References lass::num::SplineLinear< ScalarType, DataType, DataTraits >::init(), lass::num::SplineLinear< ScalarType, DataType, DataTraits >::nodes_, lass::num::SplineLinear< ScalarType, DataType, DataTraits >::Node::x, and lass::num::SplineLinear< ScalarType, DataType, DataTraits >::Node::y.
lass::num::SplineLinear< S, D, T >::SplineLinear | ( | ScalarInputIterator | iFirstControl, | |
ScalarInputIterator | iLastControl, | |||
DataInputIterator | iFirstData | |||
) | [inline] |
construct a spline from seperate ranges.
Each node consists of a control value and a data value. This contstructor accepts seperate ranges for control and data values. The control values are given by the range [iFirstControl , iLastControl). Of the range of the data values, only the iterator iFirstData to the the first element is given.
Definition at line 121 of file spline_linear.inl.
References lass::num::SplineLinear< ScalarType, DataType, DataTraits >::init(), lass::num::SplineLinear< ScalarType, DataType, DataTraits >::nodes_, lass::num::SplineLinear< ScalarType, DataType, DataTraits >::Node::x, and lass::num::SplineLinear< ScalarType, DataType, DataTraits >::Node::y.
const SplineLinear< S, D, T >::TData lass::num::SplineLinear< S, D, T >::operator() | ( | TScalar | iX | ) | const [inline] |
Get the linear interpolated data value that corresponds with constrol value iX.
Definition at line 149 of file spline_linear.inl.
References lass::num::SplineLinear< ScalarType, DataType, DataTraits >::findNode(), lass::num::SplineLinear< ScalarType, DataType, DataTraits >::isEmpty(), and LASS_ASSERT.
const SplineLinear< S, D, T >::TData lass::num::SplineLinear< S, D, T >::derivative | ( | TScalar | iX | ) | const [inline] |
Get the first derivative of data value that corresponds with constrol value iX.
As long as iX is exact on a node, it equals to lim_{dx->0} (*this(iX + dx) - *this(iX)) / dx. With linear splines, in theory the first derivative does not exist on the nodes. This function however will return the first derivative on the right of the node. *
Definition at line 179 of file spline_linear.inl.
References lass::num::SplineLinear< ScalarType, DataType, DataTraits >::findNode(), lass::num::SplineLinear< ScalarType, DataType, DataTraits >::isEmpty(), and LASS_ASSERT.
const SplineLinear< S, D, T >::TData lass::num::SplineLinear< S, D, T >::derivative2 | ( | TScalar | iX | ) | const [inline] |
Get the second derivative of data value that corresponds with constrol value iX.
For a linear spline, the second derivative is always zero, except on the nodes where it does not exist. This function however will always return zero, even on the nodes.
Definition at line 203 of file spline_linear.inl.
References lass::num::SplineLinear< ScalarType, DataType, DataTraits >::dataDimension_, lass::num::SplineLinear< ScalarType, DataType, DataTraits >::isEmpty(), and LASS_ASSERT.
const SplineLinear< S, D, T >::TData lass::num::SplineLinear< S, D, T >::integral | ( | TScalar | iBegin, | |
TScalar | iEnd | |||
) | const [inline] |
Get the integrated data value between control points iA and iB.
Definition at line 227 of file spline_linear.inl.
References lass::num::SplineLinear< ScalarType, DataType, DataTraits >::findNode(), lass::num::SplineLinear< ScalarType, DataType, DataTraits >::isEmpty(), LASS_ASSERT, lass::stde::next(), lass::num::sqr(), and std::swap().
const bool lass::num::SplineLinear< S, D, T >::isEmpty | ( | ) | const [inline, virtual] |
return true if the spline contains any nodes at all.
Implements lass::num::Spline< ScalarType, DataType >.
Definition at line 283 of file spline_linear.inl.
References lass::num::SplineLinear< ScalarType, DataType, DataTraits >::nodes_.
Referenced by lass::num::SplineLinear< ScalarType, DataType, DataTraits >::derivative(), lass::num::SplineLinear< ScalarType, DataType, DataTraits >::derivative2(), lass::num::SplineLinear< ScalarType, DataType, DataTraits >::integral(), and lass::num::SplineLinear< ScalarType, DataType, DataTraits >::operator()().
const SplineLinear< S, D, T >::TControlRange lass::num::SplineLinear< S, D, T >::controlRange | ( | ) | const [inline, virtual] |
return the range of control values for which the spline can interpolate.
Implements lass::num::Spline< ScalarType, DataType >.
Definition at line 296 of file spline_linear.inl.
References lass::num::SplineLinear< ScalarType, DataType, DataTraits >::nodes_.
void lass::num::SplineLinear< S, D, T >::init | ( | ) | [inline, private] |
Definition at line 307 of file spline_linear.inl.
References lass::num::SplineLinear< ScalarType, DataType, DataTraits >::dataDimension_, lass::num::inv(), LASS_THROW, lass::stde::next(), lass::num::SplineLinear< ScalarType, DataType, DataTraits >::nodes_, and lass::stde::prev().
Referenced by lass::num::SplineLinear< ScalarType, DataType, DataTraits >::SplineLinear().
const SplineLinear< S, D, T >::TNodeConstIterator lass::num::SplineLinear< S, D, T >::findNode | ( | TScalar | iX | ) | const [inline, private] |
binary search to find node that belongs to iX
nodes_
[i].x, nodes_
[i+1].x) nodes_
[0].x nodes_.size()-2
if iX is greater than nodes_
[nodes_.size()-1].xDefinition at line 362 of file spline_linear.inl.
References lass::prim::distance(), LASS_ASSERT, lass::stde::next(), lass::num::SplineLinear< ScalarType, DataType, DataTraits >::nodes_, and lass::stde::prev().
Referenced by lass::num::SplineLinear< ScalarType, DataType, DataTraits >::derivative(), lass::num::SplineLinear< ScalarType, DataType, DataTraits >::integral(), and lass::num::SplineLinear< ScalarType, DataType, DataTraits >::operator()().
virtual const TData lass::num::Spline< ScalarType, DataType >::operator() | ( | TScalar | iX | ) | const [pure virtual, inherited] |
virtual const TData lass::num::Spline< ScalarType, DataType >::derivative | ( | TScalar | iX | ) | const [pure virtual, inherited] |
virtual const TData lass::num::Spline< ScalarType, DataType >::derivative2 | ( | TScalar | iX | ) | const [pure virtual, inherited] |
virtual const TData lass::num::Spline< ScalarType, DataType >::integral | ( | TScalar | iA, | |
TScalar | iB | |||
) | const [pure virtual, inherited] |
TNodes lass::num::SplineLinear< ScalarType, DataType, DataTraits >::nodes_ [private] |
Definition at line 110 of file spline_linear.h.
Referenced by lass::num::SplineLinear< ScalarType, DataType, DataTraits >::controlRange(), lass::num::SplineLinear< ScalarType, DataType, DataTraits >::findNode(), lass::num::SplineLinear< ScalarType, DataType, DataTraits >::init(), lass::num::SplineLinear< ScalarType, DataType, DataTraits >::isEmpty(), and lass::num::SplineLinear< ScalarType, DataType, DataTraits >::SplineLinear().
size_t lass::num::SplineLinear< ScalarType, DataType, DataTraits >::dataDimension_ [private] |
Definition at line 111 of file spline_linear.h.
Referenced by lass::num::SplineLinear< ScalarType, DataType, DataTraits >::derivative2(), and lass::num::SplineLinear< ScalarType, DataType, DataTraits >::init().
Generated on Mon Nov 10 14:22:10 2008 for Library of Assembled Shared Sources by 1.5.7.1 |