--- trunk/src/math/CubicSpline.cpp 2015/03/03 15:22:26 2057 +++ trunk/src/math/CubicSpline.cpp 2015/03/07 21:41:51 2071 @@ -50,7 +50,7 @@ using namespace std; using namespace OpenMD; using namespace std; -CubicSpline::CubicSpline() : generated(false), isUniform(true) { +CubicSpline::CubicSpline() : isUniform(true), generated(false) { x_.clear(); y_.clear(); } @@ -83,7 +83,8 @@ void CubicSpline::generate() { // d = vector of S'''(x_[i]+)/6 values (i < n). // Local variables: - RealType fp1, fpn, h, p; + RealType fp1, fpn, p; + RealType h(0.0); // make sure the sizes match @@ -319,7 +320,15 @@ std::vector CubicSpline::sort_permutation(std::ve std::vector CubicSpline::sort_permutation(std::vector& v) { std::vector p(v.size()); - std::iota(p.begin(), p.end(), 0); + + // 6 lines to replace std::iota(p.begin(), p.end(), 0); + int value = 0; + std::vector::iterator i; + for (i = p.begin(); i != p.end(); ++i) { + (*i) = value; + ++value; + } + std::sort(p.begin(), p.end(), OpenMD::Comparator(v) ); return p; }