--- trunk/src/math/CubicSpline.hpp 2013/08/17 13:03:17 1928 +++ trunk/src/math/CubicSpline.hpp 2015/03/03 15:22:26 2057 @@ -57,22 +57,35 @@ namespace OpenMD { void addPoint(const RealType xp, const RealType yp); void addPoints(const vector& xps, const vector& yps); RealType getValueAt(const RealType& t); - pair getValueAndDerivativeAt(const RealType& t); pair getLimits(); void getValueAt(const RealType& t, RealType& v); void getValueAndDerivativeAt(const RealType& t, RealType& v, RealType& d); private: void generate(); + std::vector sort_permutation(std::vector& v); + std::vector apply_permutation(std::vector const& v, + std::vector const& p); + bool isUniform; bool generated; RealType dx, dt, yval, dydx; int n, j; - vector > data_; + vector x_; + vector y_; vector b; vector c; vector d; }; + + class Comparator{ + std::vector& _v; + public: + Comparator(std::vector& v) : _v(v) {} + bool operator()(size_t i, size_t j){ + return _v[i] < _v[j]; + } + }; } #endif