gcc-4.5.1 porting changes: strict aliasing

This commit is contained in:
Hrvoje Jasak 2010-12-02 13:30:24 +00:00
parent 2fe293b0a1
commit 7eb1b7c884
5 changed files with 14 additions and 43 deletions

View file

@ -185,19 +185,19 @@ public:
}
//- Return local Cartesian x-axis
const vector e1() const
vector e1() const
{
return tensor::T().x();
}
//- Return local Cartesian y-axis
const vector e2() const
vector e2() const
{
return tensor::T().y();
}
//- Return local Cartesian z-axis
const vector e3() const
vector e3() const
{
return tensor::T().z();
}

View file

@ -348,26 +348,26 @@ public:
}
//- Return local Cartesian x-axis
const vector e1() const
vector e1() const
{
return Rtr_.x();
}
//- Return local Cartesian y-axis
const vector e2() const
vector e2() const
{
return Rtr_.y();
}
//- Return local Cartesian z-axis
const vector e3() const
vector e3() const
{
return Rtr_.z();
}
//- Return axis (e3: local Cartesian z-axis)
// @deprecated method e3 is preferred
const vector axis() const
vector axis() const
{
return Rtr_.z();
}

View file

@ -269,6 +269,9 @@ tensor eigenVectors(const tensor& t)
// Modification for strict-aliasing compliance.
// Sandeep Menon, 01/Dec/2010
// Test for null eigen values to return a not null eigen vector
// Jovani Favero, 18/Nov/2009
tensor evs
(
(mag(evals.x()) < SMALL) ? vector(0, 0, 1) : eigenVector(t, evals.x()),
@ -276,37 +279,6 @@ tensor eigenVectors(const tensor& t)
(mag(evals.z()) < SMALL) ? vector(1, 0, 0) : eigenVector(t, evals.z())
);
/*
// Test for null eigen values to return a not null eigen vector
// Jovani Favero, 18/Nov/2009
if (mag(evals.x()) < SMALL)
{
evs.x() = vector(0, 0, 1);
}
else
{
evs.x() = eigenVector(t, evals.x());
}
if (mag(evals.y()) < SMALL)
{
evs.y() = vector(0, 1, 0);
}
else
{
evs.y() = eigenVector(t, evals.y());
}
if (mag(evals.z()) < SMALL)
{
evs.z() = vector(1, 0, 0);
}
else
{
evs.z() = eigenVector(t, evals.z());
}
*/
return evs;
}

View file

@ -126,10 +126,9 @@ public:
inline Cmpt& yy();
// Access vector components.
// Note: returning const only to find out lhs usage
inline const Vector2D<Cmpt> x() const;
inline const Vector2D<Cmpt> y() const;
inline Vector2D<Cmpt> x() const;
inline Vector2D<Cmpt> y() const;
//- Transpose
inline Tensor2D<Cmpt> T() const;

View file

@ -85,13 +85,13 @@ inline Tensor2D<Cmpt>::Tensor2D(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template <class Cmpt>
inline const Vector2D<Cmpt> Tensor2D<Cmpt>::x() const
inline Vector2D<Cmpt> Tensor2D<Cmpt>::x() const
{
return Vector2D<Cmpt>(this->v_[XX], this->v_[XY]);
}
template <class Cmpt>
inline const Vector2D<Cmpt> Tensor2D<Cmpt>::y() const
inline Vector2D<Cmpt> Tensor2D<Cmpt>::y() const
{
return Vector2D<Cmpt>(this->v_[YX], this->v_[YY]);
}