ENH: quaternion ROLL_PITCH_YAW and YAW_PITCH_ROLL aliases/lookups

COMP: define labelSphericalTensor::I

- remove spurious 'labelI' global constant (labelSphericalTensor::I)

STYLE: replace use of deprecated Tensor vectorComponent

STYLE: avoid bit-wise assignment of bool (VectorSpace compare ops)
This commit is contained in:
Mark Olesen
2022-06-02 09:13:20 +02:00
parent 8b63b8cdfe
commit eba7a485ba
21 changed files with 122 additions and 155 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -61,13 +61,8 @@ unsigned nFail_ = 0;
// Do ++nFail_ if values of two objects are not equal within a given tolerance. // Do ++nFail_ if values of two objects are not equal within a given tolerance.
// The function is converted from PEP-485. // The function is converted from PEP-485.
template<class Type> template<class Type>
typename std::enable_if typename std::enable_if<pTraits<Type>::rank == 0, void>::type
< cmp
std::is_same<floatScalar, Type>::value ||
std::is_same<doubleScalar, Type>::value ||
std::is_same<complex, Type>::value,
void
>::type cmp
( (
const word& msg, const word& msg,
const Type& x, const Type& x,
@ -99,13 +94,8 @@ typename std::enable_if
// Do ++nFail_ if two components are not equal within a given tolerance. // Do ++nFail_ if two components are not equal within a given tolerance.
// The function is converted from PEP-485 // The function is converted from PEP-485
template<class Type> template<class Type>
typename std::enable_if typename std::enable_if<pTraits<Type>::rank != 0, void>::type
< cmp
!std::is_same<floatScalar, Type>::value &&
!std::is_same<doubleScalar, Type>::value &&
!std::is_same<complex, Type>::value,
void
>::type cmp
( (
const word& msg, const word& msg,
const Type& x, const Type& x,
@ -118,7 +108,7 @@ typename std::enable_if
unsigned nFail = 0; unsigned nFail = 0;
for (label i = 0; i < pTraits<Type>::nComponents; ++i) for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
{ {
if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i])) if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -61,13 +61,8 @@ unsigned nFail_ = 0;
// Do ++nFail_ if values of two objects are not equal within a given tolerance. // Do ++nFail_ if values of two objects are not equal within a given tolerance.
// The function is converted from PEP-485. // The function is converted from PEP-485.
template<class Type> template<class Type>
typename std::enable_if typename std::enable_if<pTraits<Type>::rank == 0, void>::type
< cmp
std::is_same<floatScalar, Type>::value ||
std::is_same<doubleScalar, Type>::value ||
std::is_same<complex, Type>::value,
void
>::type cmp
( (
const word& msg, const word& msg,
const Type& x, const Type& x,
@ -99,13 +94,8 @@ typename std::enable_if
// Do ++nFail_ if two components are not equal within a given tolerance. // Do ++nFail_ if two components are not equal within a given tolerance.
// The function is converted from PEP-485 // The function is converted from PEP-485
template<class Type> template<class Type>
typename std::enable_if typename std::enable_if<pTraits<Type>::rank != 0, void>::type
< cmp
!std::is_same<floatScalar, Type>::value &&
!std::is_same<doubleScalar, Type>::value &&
!std::is_same<complex, Type>::value,
void
>::type cmp
( (
const word& msg, const word& msg,
const Type& x, const Type& x,
@ -118,7 +108,7 @@ typename std::enable_if
unsigned nFail = 0; unsigned nFail = 0;
for (label i = 0; i < pTraits<Type>::nComponents; ++i) for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
{ {
if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i])) if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -60,13 +60,8 @@ unsigned nFail_ = 0;
// Do ++nFail_ if values of two objects are not equal within a given tolerance. // Do ++nFail_ if values of two objects are not equal within a given tolerance.
// The function is converted from PEP-485. // The function is converted from PEP-485.
template<class Type> template<class Type>
typename std::enable_if typename std::enable_if<pTraits<Type>::rank == 0, void>::type
< cmp
std::is_same<floatScalar, Type>::value ||
std::is_same<doubleScalar, Type>::value ||
std::is_same<complex, Type>::value,
void
>::type cmp
( (
const word& msg, const word& msg,
const Type& x, const Type& x,
@ -98,13 +93,8 @@ typename std::enable_if
// Do ++nFail_ if two components are not equal within a given tolerance. // Do ++nFail_ if two components are not equal within a given tolerance.
// The function is converted from PEP-485 // The function is converted from PEP-485
template<class Type> template<class Type>
typename std::enable_if typename std::enable_if<pTraits<Type>::rank != 0, void>::type
< cmp
!std::is_same<floatScalar, Type>::value &&
!std::is_same<doubleScalar, Type>::value &&
!std::is_same<complex, Type>::value,
void
>::type cmp
( (
const word& msg, const word& msg,
const Type& x, const Type& x,
@ -117,7 +107,7 @@ typename std::enable_if
unsigned nFail = 0; unsigned nFail = 0;
for (label i = 0; i < pTraits<Type>::nComponents; ++i) for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
{ {
if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i])) if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -86,13 +86,8 @@ typename std::enable_if
// Do ++nFail_ if values of two objects are not equal within a given tolerance. // Do ++nFail_ if values of two objects are not equal within a given tolerance.
// The function is converted from PEP-485. // The function is converted from PEP-485.
template<class Type> template<class Type>
typename std::enable_if typename std::enable_if<pTraits<Type>::rank == 0, void>::type
< cmp
std::is_same<floatScalar, Type>::value ||
std::is_same<doubleScalar, Type>::value ||
std::is_same<complex, Type>::value,
void
>::type cmp
( (
const word& msg, const word& msg,
const Type& x, const Type& x,
@ -124,13 +119,8 @@ typename std::enable_if
// Do ++nFail_ if two components are not equal within a given tolerance. // Do ++nFail_ if two components are not equal within a given tolerance.
// The function is converted from PEP-485 // The function is converted from PEP-485
template<class Type> template<class Type>
typename std::enable_if typename std::enable_if<pTraits<Type>::rank != 0, void>::type
< cmp
!std::is_same<floatScalar, Type>::value &&
!std::is_same<doubleScalar, Type>::value &&
!std::is_same<complex, Type>::value,
void
>::type cmp
( (
const word& msg, const word& msg,
const Type& x, const Type& x,
@ -143,7 +133,7 @@ typename std::enable_if
unsigned nFail = 0; unsigned nFail = 0;
for (label i = 0; i < pTraits<Type>::nComponents; ++i) for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
{ {
if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i])) if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2020 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -71,13 +71,8 @@ symmTensor2D makeRandomContainer(Random& rnd)
// Do ++nFail_ if values of two objects are not equal within a given tolerance. // Do ++nFail_ if values of two objects are not equal within a given tolerance.
// The function is converted from PEP-485. // The function is converted from PEP-485.
template<class Type> template<class Type>
typename std::enable_if typename std::enable_if<pTraits<Type>::rank == 0, void>::type
< cmp
std::is_same<floatScalar, Type>::value ||
std::is_same<doubleScalar, Type>::value ||
std::is_same<complex, Type>::value,
void
>::type cmp
( (
const word& msg, const word& msg,
const Type& x, const Type& x,
@ -109,13 +104,8 @@ typename std::enable_if
// Do ++nFail_ if two components are not equal within a given tolerance. // Do ++nFail_ if two components are not equal within a given tolerance.
// The function is converted from PEP-485 // The function is converted from PEP-485
template<class Type> template<class Type>
typename std::enable_if typename std::enable_if<pTraits<Type>::rank != 0, void>::type
< cmp
!std::is_same<floatScalar, Type>::value &&
!std::is_same<doubleScalar, Type>::value &&
!std::is_same<complex, Type>::value,
void
>::type cmp
( (
const word& msg, const word& msg,
const Type& x, const Type& x,
@ -128,7 +118,7 @@ typename std::enable_if
unsigned nFail = 0; unsigned nFail = 0;
for (label i = 0; i < pTraits<Type>::nComponents; ++i) for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
{ {
if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i])) if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
{ {

View File

@ -72,13 +72,8 @@ tensor makeRandomContainer(Random& rnd)
// Do ++nFail_ if values of two objects are not equal within a given tolerance. // Do ++nFail_ if values of two objects are not equal within a given tolerance.
// The function is converted from PEP-485. // The function is converted from PEP-485.
template<class Type> template<class Type>
typename std::enable_if typename std::enable_if<pTraits<Type>::rank == 0, void>::type
< cmp
std::is_same<floatScalar, Type>::value ||
std::is_same<doubleScalar, Type>::value ||
std::is_same<complex, Type>::value,
void
>::type cmp
( (
const word& msg, const word& msg,
const Type& x, const Type& x,
@ -110,13 +105,8 @@ typename std::enable_if
// Do ++nFail_ if two components are not equal within a given tolerance. // Do ++nFail_ if two components are not equal within a given tolerance.
// The function is converted from PEP-485 // The function is converted from PEP-485
template<class Type> template<class Type>
typename std::enable_if typename std::enable_if<pTraits<Type>::rank != 0, void>::type
< cmp
!std::is_same<floatScalar, Type>::value &&
!std::is_same<doubleScalar, Type>::value &&
!std::is_same<complex, Type>::value,
void
>::type cmp
( (
const word& msg, const word& msg,
const Type& x, const Type& x,
@ -129,7 +119,7 @@ typename std::enable_if
unsigned nFail = 0; unsigned nFail = 0;
for (label i = 0; i < pTraits<Type>::nComponents; ++i) for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
{ {
if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i])) if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2014 OpenFOAM Foundation Copyright (C) 2014 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -74,13 +74,8 @@ tensor2D makeRandomContainer(Random& rnd)
// Do ++nFail_ if values of two objects are not equal within a given tolerance. // Do ++nFail_ if values of two objects are not equal within a given tolerance.
// The function is converted from PEP-485. // The function is converted from PEP-485.
template<class Type> template<class Type>
typename std::enable_if typename std::enable_if<pTraits<Type>::rank == 0, void>::type
< cmp
std::is_same<floatScalar, Type>::value ||
std::is_same<doubleScalar, Type>::value ||
std::is_same<complex, Type>::value,
void
>::type cmp
( (
const word& msg, const word& msg,
const Type& x, const Type& x,
@ -112,13 +107,8 @@ typename std::enable_if
// Do ++nFail_ if two components are not equal within a given tolerance. // Do ++nFail_ if two components are not equal within a given tolerance.
// The function is converted from PEP-485 // The function is converted from PEP-485
template<class Type> template<class Type>
typename std::enable_if typename std::enable_if<pTraits<Type>::rank != 0, void>::type
< cmp
!std::is_same<floatScalar, Type>::value &&
!std::is_same<doubleScalar, Type>::value &&
!std::is_same<complex, Type>::value,
void
>::type cmp
( (
const word& msg, const word& msg,
const Type& x, const Type& x,
@ -131,7 +121,7 @@ typename std::enable_if
unsigned nFail = 0; unsigned nFail = 0;
for (label i = 0; i < pTraits<Type>::nComponents; ++i) for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
{ {
if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i])) if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
{ {

View File

@ -39,8 +39,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef DiagTensor_H #ifndef Foam_DiagTensor_H
#define DiagTensor_H #define Foam_DiagTensor_H
#include "Tensor.H" #include "Tensor.H"
@ -106,15 +106,15 @@ public:
// Member Functions // Member Functions
// Access // Access
inline const Cmpt& xx() const; inline const Cmpt& xx() const;
inline const Cmpt& yy() const; inline const Cmpt& yy() const;
inline const Cmpt& zz() const; inline const Cmpt& zz() const;
inline Cmpt& xx(); inline Cmpt& xx();
inline Cmpt& yy(); inline Cmpt& yy();
inline Cmpt& zz(); inline Cmpt& zz();
}; };

View File

@ -51,7 +51,6 @@ class Identity
: :
public SphericalTensor<Cmpt> public SphericalTensor<Cmpt>
{ {
public: public:
//- Construct initializing the SphericalTensor to 1 //- Construct initializing the SphericalTensor to 1
@ -73,19 +72,19 @@ public:
}; };
//- Return the identity in the dual space //- Return the identity in the dual space
inline dual operator*() dual operator*()
{ {
return dual(); return dual();
} }
//- Return 1 for label //- Return 1 for label
inline explicit operator label() const explicit operator label() const noexcept
{ {
return 1; return 1;
} }
//- Return 1 for scalar //- Return 1 for scalar
inline explicit operator scalar() const explicit operator scalar() const noexcept
{ {
return 1; return 1;
} }

View File

@ -39,8 +39,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef SphericalTensor_H #ifndef Foam_SphericalTensor_H
#define SphericalTensor_H #define Foam_SphericalTensor_H
#include "contiguous.H" #include "contiguous.H"
#include "VectorSpace.H" #include "VectorSpace.H"
@ -117,12 +117,14 @@ public:
// Member Functions // Member Functions
// Access // Access
inline const Cmpt& ii() const; inline const Cmpt& ii() const;
inline Cmpt& ii(); inline Cmpt& ii();
// Tensor Operations
//- Return non-Hermitian transpose (no-op) //- Return non-Hermitian transpose (no-op)
inline const SphericalTensor<Cmpt>& T() const; inline const SphericalTensor<Cmpt>& T() const;
}; };

View File

@ -52,9 +52,6 @@ namespace Foam
typedef SphericalTensor<label> labelSphericalTensor; typedef SphericalTensor<label> labelSphericalTensor;
//- Identity labelTensor
static const labelSphericalTensor labelI(1);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -39,7 +39,6 @@ SourceFiles
#ifndef Foam_SymmTensor_H #ifndef Foam_SymmTensor_H
#define Foam_SymmTensor_H #define Foam_SymmTensor_H
#include "contiguous.H"
#include "Vector.H" #include "Vector.H"
#include "SphericalTensor.H" #include "SphericalTensor.H"

View File

@ -261,6 +261,12 @@ public:
inline void diag(const Vector<Cmpt>& v); inline void diag(const Vector<Cmpt>& v);
// Characteristics
//- Is identity tensor?
inline bool is_identity(const scalar tol = ROOTVSMALL) const;
// Tensor Operations // Tensor Operations
//- Return non-Hermitian transpose //- Return non-Hermitian transpose

View File

@ -25,6 +25,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include <type_traits> #include <type_traits>
#include "SymmTensor.H" #include "SymmTensor.H"
@ -504,6 +505,21 @@ inline void Foam::Tensor<Cmpt>::diag(const Vector<Cmpt>& v)
} }
template<class Cmpt>
inline bool Foam::Tensor<Cmpt>::is_identity(const scalar tol) const
{
return
(
mag(xx() - pTraits<Cmpt>::one) < tol
&& mag(yy() - pTraits<Cmpt>::one) < tol
&& mag(zz() - pTraits<Cmpt>::one) < tol
&& mag(xy()) < tol && mag(xz()) < tol
&& mag(yx()) < tol && mag(yz()) < tol
&& mag(zx()) < tol && mag(zy()) < tol
);
}
// * * * * * * * * * * * * * * * Member Operations * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operations * * * * * * * * * * * * * //
template<class Cmpt> template<class Cmpt>

View File

@ -77,5 +77,13 @@ const Foam::labelTensor Foam::labelTensor::vsType::rootMin
labelTensor::uniform(-sqrt(scalar(labelMax))) labelTensor::uniform(-sqrt(scalar(labelMax)))
); );
template<>
const Foam::labelTensor Foam::labelTensor::I
(
1, 0, 0,
0, 1, 0,
0, 0, 1
);
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -837,12 +837,11 @@ inline bool operator==
const VectorSpace<Form, Cmpt, Ncmpts>& vs2 const VectorSpace<Form, Cmpt, Ncmpts>& vs2
) )
{ {
bool eq = true;
for (direction i=0; i<Ncmpts; ++i) for (direction i=0; i<Ncmpts; ++i)
{ {
if (!(eq &= (equal(vs1.v_[i], vs2.v_[i])))) break; if (!equal(vs1.v_[i], vs2.v_[i])) return false;
} }
return eq; return true;
} }
@ -864,12 +863,11 @@ inline bool operator>
const VectorSpace<Form, Cmpt, Ncmpts>& vs2 const VectorSpace<Form, Cmpt, Ncmpts>& vs2
) )
{ {
bool gt = true;
for (direction i=0; i<Ncmpts; ++i) for (direction i=0; i<Ncmpts; ++i)
{ {
if (!(gt &= vs1.v_[i] > vs2.v_[i])) break; if (!(vs1.v_[i] > vs2.v_[i])) return false;
} }
return gt; return true;
} }
@ -880,12 +878,11 @@ inline bool operator<
const VectorSpace<Form, Cmpt, Ncmpts>& vs2 const VectorSpace<Form, Cmpt, Ncmpts>& vs2
) )
{ {
bool lt = true;
for (direction i=0; i<Ncmpts; ++i) for (direction i=0; i<Ncmpts; ++i)
{ {
if (!(lt &= vs1.v_[i] < vs2.v_[i])) break; if (!(vs1.v_[i] < vs2.v_[i])) return false;
} }
return lt; return true;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -53,6 +53,10 @@ Foam::quaternion::eulerOrderNames
{ eulerOrder::YZX, "yzx" }, { eulerOrder::YZX, "yzx" },
{ eulerOrder::ZYX, "zyx" }, { eulerOrder::ZYX, "zyx" },
{ eulerOrder::ZXY, "zxy" }, { eulerOrder::ZXY, "zxy" },
// Aliases
{ eulerOrder::XYZ, "rollPitchYaw" },
{ eulerOrder::ZYX, "yawPitchRoll" },
}); });

View File

@ -107,10 +107,15 @@ public:
XZX, XYX, YXY, YZY, ZYZ, ZXZ, XZX, XYX, YXY, YZY, ZYZ, ZXZ,
// Tait-Bryan angles // Tait-Bryan angles
XZY, XYZ, YXZ, YZX, ZYX, ZXY XZY, XYZ, YXZ, YZX, ZYX, ZXY,
// Aliases
ROLL_PITCH_YAW = XYZ,
YAW_PITCH_ROLL = ZYX,
}; };
//- The names for Euler-angle rotation order //- The names for Euler-angle and Tait-Bryan angles,
//- including "rollPitchYaw" and "yawPitchRoll" aliases
static const Enum<eulerOrder> eulerOrderNames; static const Enum<eulerOrder> eulerOrderNames;

View File

@ -32,8 +32,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef transform_H #ifndef Foam_transform_H
#define transform_H #define Foam_transform_H
#include "tensor.H" #include "tensor.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
@ -82,7 +82,7 @@ inline tensor rotationTensor
//- Rotational transformation tensor about the x-axis by omega radians //- Rotational transformation tensor about the x-axis by omega radians
inline tensor Rx(const scalar& omega) inline tensor Rx(const scalar omega)
{ {
const scalar s = sin(omega); const scalar s = sin(omega);
const scalar c = cos(omega); const scalar c = cos(omega);
@ -96,7 +96,7 @@ inline tensor Rx(const scalar& omega)
//- Rotational transformation tensor about the y-axis by omega radians //- Rotational transformation tensor about the y-axis by omega radians
inline tensor Ry(const scalar& omega) inline tensor Ry(const scalar omega)
{ {
const scalar s = sin(omega); const scalar s = sin(omega);
const scalar c = cos(omega); const scalar c = cos(omega);
@ -110,7 +110,7 @@ inline tensor Ry(const scalar& omega)
//- Rotational transformation tensor about the z-axis by omega radians //- Rotational transformation tensor about the z-axis by omega radians
inline tensor Rz(const scalar& omega) inline tensor Rz(const scalar omega)
{ {
const scalar s = sin(omega); const scalar s = sin(omega);
const scalar c = cos(omega); const scalar c = cos(omega);

View File

@ -37,6 +37,7 @@ Foam::label Foam::eddy::Gamma2Values[] = {1, 2, 3, 4, 5, 6, 7, 8};
Foam::UList<Foam::label> Foam::eddy::Gamma2(&Gamma2Values[0], 8); Foam::UList<Foam::label> Foam::eddy::Gamma2(&Gamma2Values[0], 8);
int Foam::eddy::debug = 0; int Foam::eddy::debug = 0;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::eddy::setScales bool Foam::eddy::setScales
@ -287,7 +288,10 @@ Foam::label Foam::eddy::writeSurfaceOBJ
const vector& s = sigma_; const vector& s = sigma_;
const vector axisDir = tensor::I.vectorComponent(dir1_); // Unit vector
vector axisDir(Zero);
axisDir[dir1_] = 1;
const label dir2 = (dir1_ + 1) % 3; const label dir2 = (dir1_ + 1) % 3;
const label dir3 = (dir1_ + 2) % 3; const label dir3 = (dir1_ + 2) % 3;

View File

@ -96,7 +96,7 @@ class eddy
//- Model coefficient c1 //- Model coefficient c1
scalar c1_; scalar c1_;
//- Index of streamwise direction //- Index of streamwise direction (0,1,2)
label dir1_; label dir1_;
@ -177,8 +177,8 @@ public:
//- Return the eddy position //- Return the eddy position
inline point position(const vector& n) const; inline point position(const vector& n) const;
//- Return the index of the streamwise direction //- Return the index of the streamwise direction (0,1,2)
inline label dir1() const; label dir1() const noexcept { return dir1_; }
//- Return random vector of -1 and 1's //- Return random vector of -1 and 1's
inline vector epsilon(Random& rndGen) const; inline vector epsilon(Random& rndGen) const;