Specialization of the Linear-template which provides LinearInterpolation for pointer two Mappings. Used by MultiDimMapping. More...
#include <MappingUtils.h>
Public Types | |
typedef std::map< double, Mapping * >::const_iterator | InputIterator |
Iterator type of the mapping over which to interpolate. | |
typedef Interpolated< Mapping * > | interpolated |
Interpolated type used as return value. | |
Public Member Functions | |
Linear (Mapping *oorv) | |
void | setOutOfRangeVal (Mapping *oorv) |
interpolated | operator() (const InputIterator &first, const InputIterator &last, const double &pos) const |
Functor operator of this class which linear interpolates the value at the passed position using the values between the passed Iterators. | |
interpolated | operator() (const InputIterator &first, const InputIterator &last, const double &pos, InputIterator upperBound) const |
Functor operator of this class which linear interpolates the value at the passed position using the values between the passed Iterators. | |
Static Public Member Functions | |
static double | linearInterpolationFactor (const double &t, const double &t0, const double &t1) |
calculates the linear interpolation factor used for the created LinearIntplMappings. | |
Protected Attributes | |
PairLess< std::map< double, Mapping * >::value_type, double > | comp |
Comparison class for the values of the map to interpolate over. | |
bool | continueOutOfRange |
Mapping * | outOfRangeVal |
Specialization of the Linear-template which provides LinearInterpolation for pointer two Mappings. Used by MultiDimMapping.
Definition at line 674 of file MappingUtils.h.
interpolated Linear< double, Mapping *, std::map< double, Mapping * >::value_type, std::map< double, Mapping * >::const_iterator >::operator() | ( | const InputIterator & | first, | |
const InputIterator & | last, | |||
const double & | pos, | |||
InputIterator | upperBound | |||
) | const [inline] |
Functor operator of this class which linear interpolates the value at the passed position using the values between the passed Iterators.
The upperBound-iterator has to point two the entry next bigger as the passed position to interpolate.
The returned instance of interpolated represents the result. Which can be either an actual entry of the interpolated map (if the position two interpolate was exactly that. Or it can be an interpolated value, if the passed position was between two entries of the map. This state can be retrieved with the "isInterpolated"-Member of the returned "interpolated".
Definition at line 742 of file MappingUtils.h.
{ if(first == last){ if(continueOutOfRange) return interpolated(0); else return interpolated(outOfRangeVal); } if(upperBound == first){ if(continueOutOfRange) return interpolated(upperBound->second); else return interpolated(outOfRangeVal); } InputIterator right = upperBound; InputIterator left = --upperBound; if(left->first == pos) return interpolated(left->second, false); if(right == last){ if(continueOutOfRange) return interpolated(left->second); else return interpolated(outOfRangeVal); } double fact = linearInterpolationFactor(pos, left->first, right->first); return interpolated(LinearIntplMapping(left->second, right->second, fact)); }
interpolated Linear< double, Mapping *, std::map< double, Mapping * >::value_type, std::map< double, Mapping * >::const_iterator >::operator() | ( | const InputIterator & | first, | |
const InputIterator & | last, | |||
const double & | pos | |||
) | const [inline] |
Functor operator of this class which linear interpolates the value at the passed position using the values between the passed Iterators.
The returned instance of interpolated represents the result. Which can be either an actual entry of the interpolated map (if the position two interpolate was exactly that. Or it can be an interpolated value, if the passed position was between two entries of the map. This state can be retrieved with the "isInterpolated"-Member of the returned "interpolated".
Definition at line 719 of file MappingUtils.h.
{ InputIterator right = std::upper_bound(first, last, pos, comp); return operator()(first, last, pos, right); }