diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2015-06-28 15:43:43 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2015-06-28 15:43:43 +0200 |
commit | 23c3263f1b2b48b729f3877e93abcd9788d7893f (patch) | |
tree | 849ef720a39a5e47552c5fb57687efc6eca7649b /tdescreensaver/kdesavers | |
parent | 442b316f96fb7555f62e7f636c2c3ec09c37fba7 (diff) | |
download | tdeartwork-23c3263f1b2b48b729f3877e93abcd9788d7893f.tar.gz tdeartwork-23c3263f1b2b48b729f3877e93abcd9788d7893f.zip |
Fix FTBFS with clang
[taken from NetBSD kdeartwork3 patches]
Diffstat (limited to 'tdescreensaver/kdesavers')
-rw-r--r-- | tdescreensaver/kdesavers/rkodesolver.cpp | 1 | ||||
-rw-r--r-- | tdescreensaver/kdesavers/rotation.cpp | 18 | ||||
-rw-r--r-- | tdescreensaver/kdesavers/vec3.cpp | 4 | ||||
-rw-r--r-- | tdescreensaver/kdesavers/vec3.h | 8 |
4 files changed, 20 insertions, 11 deletions
diff --git a/tdescreensaver/kdesavers/rkodesolver.cpp b/tdescreensaver/kdesavers/rkodesolver.cpp index 2127a110..4c581416 100644 --- a/tdescreensaver/kdesavers/rkodesolver.cpp +++ b/tdescreensaver/kdesavers/rkodesolver.cpp @@ -10,6 +10,7 @@ // //============================================================================ +#include <cstdlib> #include <kdebug.h> #include "rkodesolver.h" diff --git a/tdescreensaver/kdesavers/rotation.cpp b/tdescreensaver/kdesavers/rotation.cpp index 9d9a1442..a00f7bbc 100644 --- a/tdescreensaver/kdesavers/rotation.cpp +++ b/tdescreensaver/kdesavers/rotation.cpp @@ -123,9 +123,9 @@ std::valarray<double> EulerOdeSolver::f( ypr[2] = -(B-A)/C * omega_body[0] * omega_body[1]; // r' // e1', e2', e3' - ypr[std::slice(3,3,1)] = vec3<double>::crossprod(omega, e1); - ypr[std::slice(6,3,1)] = vec3<double>::crossprod(omega, e2); - ypr[std::slice(9,3,1)] = vec3<double>::crossprod(omega, e3); + ypr[std::slice(3,3,1)] = std::valarray<double>(vec3<double>::crossprod(omega, e1)); + ypr[std::slice(6,3,1)] = std::valarray<double>(vec3<double>::crossprod(omega, e2)); + ypr[std::slice(9,3,1)] = std::valarray<double>(vec3<double>::crossprod(omega, e3)); return ypr; } @@ -529,15 +529,17 @@ void KRotationSaver::initData() e3_body.rotate(-m_initEulerTheta*e1_body); // omega_body = L_body * J_body^(-1) vec3<double> omega_body = e3_body * m_Lz; - omega_body /= J; + std::valarray<double> &omega_body_ = omega_body; + std::valarray<double> &J_ = J; + omega_body_ /= J_; // assemble initial y for solver std::valarray<double> y(12); - y[std::slice(0,3,1)] = omega_body; + y[std::slice(0,3,1)] = std::valarray<double>(omega_body); // 3 basis vectors of body system in fixed coordinates - y[std::slice(3,3,1)] = e1t; - y[std::slice(6,3,1)] = e2t; - y[std::slice(9,3,1)] = e3t; + y[std::slice(3,3,1)] = std::valarray<double>(e1t); + y[std::slice(6,3,1)] = std::valarray<double>(e2t); + y[std::slice(9,3,1)] = std::valarray<double>(e3t); // initial rotation vector omega diff --git a/tdescreensaver/kdesavers/vec3.cpp b/tdescreensaver/kdesavers/vec3.cpp index c66730e5..1715937e 100644 --- a/tdescreensaver/kdesavers/vec3.cpp +++ b/tdescreensaver/kdesavers/vec3.cpp @@ -59,7 +59,9 @@ vec3<T>& vec3<T>::rotate(const vec3<T>& r) // part of vector which is parallel to r vec3<T> par(r*(*this)/(r*r) * r); // part of vector which is perpendicular to r - vec3<T> perp(*this - par); + vec3<T> perp(*this); + std::valarray<T> &perp_ = perp; + perp -= std::valarray<T>(par); // rotation direction, size of perp vec3<T> rotdir(norm(perp) * normalized(crossprod(r,perp))); *this = par + cos(phi)*perp + sin(phi)*rotdir; diff --git a/tdescreensaver/kdesavers/vec3.h b/tdescreensaver/kdesavers/vec3.h index 62aeb8ed..879c55f7 100644 --- a/tdescreensaver/kdesavers/vec3.h +++ b/tdescreensaver/kdesavers/vec3.h @@ -148,7 +148,9 @@ inline vec3<T>::vec3(const std::slice_array<T>& a) template<typename T> inline vec3<T> operator+(vec3<T> a, const vec3<T>& b) { - a += b; /* valarray<T>::operator+=(const valarray<T>&) */ + std::valarray<T> &a_ = a; + const std::valarray<T> &b_ = b; + a_ += b_; /* valarray<T>::operator+=(const valarray<T>&) */ return a; } @@ -158,7 +160,9 @@ inline vec3<T> operator+(vec3<T> a, const vec3<T>& b) template<typename T> inline T operator*(vec3<T> a, const vec3<T>& b) { - a *= b; /* valarray<T>::operator*=(const T&) */ + std::valarray<T> &a_ = a; + const std::valarray<T> &b_ = b; + a_ *= b_; /* valarray<T>::operator*=(const valarray<T>&) */ return a.sum(); } |