Fix FTBFS with clang

[taken from NetBSD kdeartwork3 patches]
(cherry picked from commit 23c3263f1b)
feature/Phase2_style
Slávek Banko 10 years ago
parent b99cb353e5
commit 06aaf8471b

@ -10,6 +10,7 @@
//
//============================================================================
#include <cstdlib>
#include <kdebug.h>
#include "rkodesolver.h"

@ -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

@ -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;

@ -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();
}

Loading…
Cancel
Save