From eba7a485ba894ecc79bf9bb68c27fbd861f9366e Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 2 Jun 2022 09:13:20 +0200 Subject: [PATCH] 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) --- .../test/DiagTensor/Test-DiagTensor.C | 22 +++++-------------- .../SphericalTensor/Test-SphericalTensor.C | 22 +++++-------------- .../Test-SphericalTensor2D.C | 22 +++++-------------- .../test/SymmTensor/Test-SymmTensor.C | 22 +++++-------------- .../test/SymmTensor2D/Test-SymmTensor2D.C | 22 +++++-------------- applications/test/Tensor/Test-Tensor.C | 20 +++++------------ applications/test/Tensor2D/Test-Tensor2D.C | 22 +++++-------------- .../primitives/DiagTensor/DiagTensor.H | 18 +++++++-------- .../primitives/SphericalTensor/Identity.H | 7 +++--- .../SphericalTensor/SphericalTensor.H | 12 +++++----- .../labelSphericalTensor.H | 3 --- .../primitives/SymmTensor/SymmTensor.H | 1 - src/OpenFOAM/primitives/Tensor/Tensor.H | 6 +++++ src/OpenFOAM/primitives/Tensor/TensorI.H | 16 ++++++++++++++ .../primitives/Tensor/ints/labelTensor.C | 8 +++++++ .../primitives/VectorSpace/VectorSpaceI.H | 17 ++++++-------- .../primitives/quaternion/quaternion.C | 6 ++++- .../primitives/quaternion/quaternion.H | 9 ++++++-- src/OpenFOAM/primitives/transform/transform.H | 10 ++++----- .../derived/turbulentDFSEMInlet/eddy/eddy.C | 6 ++++- .../derived/turbulentDFSEMInlet/eddy/eddy.H | 6 ++--- 21 files changed, 122 insertions(+), 155 deletions(-) diff --git a/applications/test/DiagTensor/Test-DiagTensor.C b/applications/test/DiagTensor/Test-DiagTensor.C index f810193dd5..fa5a652364 100644 --- a/applications/test/DiagTensor/Test-DiagTensor.C +++ b/applications/test/DiagTensor/Test-DiagTensor.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License 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. // The function is converted from PEP-485. template -typename std::enable_if -< - std::is_same::value || - std::is_same::value || - std::is_same::value, - void ->::type cmp +typename std::enable_if::rank == 0, void>::type +cmp ( const word& msg, const Type& x, @@ -99,13 +94,8 @@ typename std::enable_if // Do ++nFail_ if two components are not equal within a given tolerance. // The function is converted from PEP-485 template -typename std::enable_if -< - !std::is_same::value && - !std::is_same::value && - !std::is_same::value, - void ->::type cmp +typename std::enable_if::rank != 0, void>::type +cmp ( const word& msg, const Type& x, @@ -118,7 +108,7 @@ typename std::enable_if unsigned nFail = 0; - for (label i = 0; i < pTraits::nComponents; ++i) + for (direction i = 0; i < pTraits::nComponents; ++i) { if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i])) { diff --git a/applications/test/SphericalTensor/Test-SphericalTensor.C b/applications/test/SphericalTensor/Test-SphericalTensor.C index 05ebd8c3f7..d386b4ac2e 100644 --- a/applications/test/SphericalTensor/Test-SphericalTensor.C +++ b/applications/test/SphericalTensor/Test-SphericalTensor.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License 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. // The function is converted from PEP-485. template -typename std::enable_if -< - std::is_same::value || - std::is_same::value || - std::is_same::value, - void ->::type cmp +typename std::enable_if::rank == 0, void>::type +cmp ( const word& msg, const Type& x, @@ -99,13 +94,8 @@ typename std::enable_if // Do ++nFail_ if two components are not equal within a given tolerance. // The function is converted from PEP-485 template -typename std::enable_if -< - !std::is_same::value && - !std::is_same::value && - !std::is_same::value, - void ->::type cmp +typename std::enable_if::rank != 0, void>::type +cmp ( const word& msg, const Type& x, @@ -118,7 +108,7 @@ typename std::enable_if unsigned nFail = 0; - for (label i = 0; i < pTraits::nComponents; ++i) + for (direction i = 0; i < pTraits::nComponents; ++i) { if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i])) { diff --git a/applications/test/SphericalTensor2D/Test-SphericalTensor2D.C b/applications/test/SphericalTensor2D/Test-SphericalTensor2D.C index d86207a622..3fc89d8b10 100644 --- a/applications/test/SphericalTensor2D/Test-SphericalTensor2D.C +++ b/applications/test/SphericalTensor2D/Test-SphericalTensor2D.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License 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. // The function is converted from PEP-485. template -typename std::enable_if -< - std::is_same::value || - std::is_same::value || - std::is_same::value, - void ->::type cmp +typename std::enable_if::rank == 0, void>::type +cmp ( const word& msg, const Type& x, @@ -98,13 +93,8 @@ typename std::enable_if // Do ++nFail_ if two components are not equal within a given tolerance. // The function is converted from PEP-485 template -typename std::enable_if -< - !std::is_same::value && - !std::is_same::value && - !std::is_same::value, - void ->::type cmp +typename std::enable_if::rank != 0, void>::type +cmp ( const word& msg, const Type& x, @@ -117,7 +107,7 @@ typename std::enable_if unsigned nFail = 0; - for (label i = 0; i < pTraits::nComponents; ++i) + for (direction i = 0; i < pTraits::nComponents; ++i) { if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i])) { diff --git a/applications/test/SymmTensor/Test-SymmTensor.C b/applications/test/SymmTensor/Test-SymmTensor.C index f1ecdf0342..d1ea6a0b1d 100644 --- a/applications/test/SymmTensor/Test-SymmTensor.C +++ b/applications/test/SymmTensor/Test-SymmTensor.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License 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. // The function is converted from PEP-485. template -typename std::enable_if -< - std::is_same::value || - std::is_same::value || - std::is_same::value, - void ->::type cmp +typename std::enable_if::rank == 0, void>::type +cmp ( const word& msg, const Type& x, @@ -124,13 +119,8 @@ typename std::enable_if // Do ++nFail_ if two components are not equal within a given tolerance. // The function is converted from PEP-485 template -typename std::enable_if -< - !std::is_same::value && - !std::is_same::value && - !std::is_same::value, - void ->::type cmp +typename std::enable_if::rank != 0, void>::type +cmp ( const word& msg, const Type& x, @@ -143,7 +133,7 @@ typename std::enable_if unsigned nFail = 0; - for (label i = 0; i < pTraits::nComponents; ++i) + for (direction i = 0; i < pTraits::nComponents; ++i) { if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i])) { diff --git a/applications/test/SymmTensor2D/Test-SymmTensor2D.C b/applications/test/SymmTensor2D/Test-SymmTensor2D.C index d4a96eeffb..da9b102b5f 100644 --- a/applications/test/SymmTensor2D/Test-SymmTensor2D.C +++ b/applications/test/SymmTensor2D/Test-SymmTensor2D.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License 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. // The function is converted from PEP-485. template -typename std::enable_if -< - std::is_same::value || - std::is_same::value || - std::is_same::value, - void ->::type cmp +typename std::enable_if::rank == 0, void>::type +cmp ( const word& msg, const Type& x, @@ -109,13 +104,8 @@ typename std::enable_if // Do ++nFail_ if two components are not equal within a given tolerance. // The function is converted from PEP-485 template -typename std::enable_if -< - !std::is_same::value && - !std::is_same::value && - !std::is_same::value, - void ->::type cmp +typename std::enable_if::rank != 0, void>::type +cmp ( const word& msg, const Type& x, @@ -128,7 +118,7 @@ typename std::enable_if unsigned nFail = 0; - for (label i = 0; i < pTraits::nComponents; ++i) + for (direction i = 0; i < pTraits::nComponents; ++i) { if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i])) { diff --git a/applications/test/Tensor/Test-Tensor.C b/applications/test/Tensor/Test-Tensor.C index 05504bd3c8..ff67487abb 100644 --- a/applications/test/Tensor/Test-Tensor.C +++ b/applications/test/Tensor/Test-Tensor.C @@ -72,13 +72,8 @@ tensor makeRandomContainer(Random& rnd) // Do ++nFail_ if values of two objects are not equal within a given tolerance. // The function is converted from PEP-485. template -typename std::enable_if -< - std::is_same::value || - std::is_same::value || - std::is_same::value, - void ->::type cmp +typename std::enable_if::rank == 0, void>::type +cmp ( const word& msg, const Type& x, @@ -110,13 +105,8 @@ typename std::enable_if // Do ++nFail_ if two components are not equal within a given tolerance. // The function is converted from PEP-485 template -typename std::enable_if -< - !std::is_same::value && - !std::is_same::value && - !std::is_same::value, - void ->::type cmp +typename std::enable_if::rank != 0, void>::type +cmp ( const word& msg, const Type& x, @@ -129,7 +119,7 @@ typename std::enable_if unsigned nFail = 0; - for (label i = 0; i < pTraits::nComponents; ++i) + for (direction i = 0; i < pTraits::nComponents; ++i) { if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i])) { diff --git a/applications/test/Tensor2D/Test-Tensor2D.C b/applications/test/Tensor2D/Test-Tensor2D.C index 1ab50b0176..f1993afbf8 100644 --- a/applications/test/Tensor2D/Test-Tensor2D.C +++ b/applications/test/Tensor2D/Test-Tensor2D.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2014 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License 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. // The function is converted from PEP-485. template -typename std::enable_if -< - std::is_same::value || - std::is_same::value || - std::is_same::value, - void ->::type cmp +typename std::enable_if::rank == 0, void>::type +cmp ( const word& msg, const Type& x, @@ -112,13 +107,8 @@ typename std::enable_if // Do ++nFail_ if two components are not equal within a given tolerance. // The function is converted from PEP-485 template -typename std::enable_if -< - !std::is_same::value && - !std::is_same::value && - !std::is_same::value, - void ->::type cmp +typename std::enable_if::rank != 0, void>::type +cmp ( const word& msg, const Type& x, @@ -131,7 +121,7 @@ typename std::enable_if unsigned nFail = 0; - for (label i = 0; i < pTraits::nComponents; ++i) + for (direction i = 0; i < pTraits::nComponents; ++i) { if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i])) { diff --git a/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H b/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H index 648b6989a4..32f600241b 100644 --- a/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H +++ b/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H @@ -39,8 +39,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef DiagTensor_H -#define DiagTensor_H +#ifndef Foam_DiagTensor_H +#define Foam_DiagTensor_H #include "Tensor.H" @@ -106,15 +106,15 @@ public: // Member Functions - // Access + // Access - inline const Cmpt& xx() const; - inline const Cmpt& yy() const; - inline const Cmpt& zz() const; + inline const Cmpt& xx() const; + inline const Cmpt& yy() const; + inline const Cmpt& zz() const; - inline Cmpt& xx(); - inline Cmpt& yy(); - inline Cmpt& zz(); + inline Cmpt& xx(); + inline Cmpt& yy(); + inline Cmpt& zz(); }; diff --git a/src/OpenFOAM/primitives/SphericalTensor/Identity.H b/src/OpenFOAM/primitives/SphericalTensor/Identity.H index 72e09aaab7..278c83f15e 100644 --- a/src/OpenFOAM/primitives/SphericalTensor/Identity.H +++ b/src/OpenFOAM/primitives/SphericalTensor/Identity.H @@ -51,7 +51,6 @@ class Identity : public SphericalTensor { - public: //- Construct initializing the SphericalTensor to 1 @@ -73,19 +72,19 @@ public: }; //- Return the identity in the dual space - inline dual operator*() + dual operator*() { return dual(); } //- Return 1 for label - inline explicit operator label() const + explicit operator label() const noexcept { return 1; } //- Return 1 for scalar - inline explicit operator scalar() const + explicit operator scalar() const noexcept { return 1; } diff --git a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H index a203f3019c..1b335324af 100644 --- a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H +++ b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H @@ -39,8 +39,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef SphericalTensor_H -#define SphericalTensor_H +#ifndef Foam_SphericalTensor_H +#define Foam_SphericalTensor_H #include "contiguous.H" #include "VectorSpace.H" @@ -117,12 +117,14 @@ public: // Member Functions - // Access + // Access - inline const Cmpt& ii() const; - inline Cmpt& ii(); + inline const Cmpt& ii() const; + inline Cmpt& ii(); + // Tensor Operations + //- Return non-Hermitian transpose (no-op) inline const SphericalTensor& T() const; }; diff --git a/src/OpenFOAM/primitives/SphericalTensor/labelSphericalTensor/labelSphericalTensor.H b/src/OpenFOAM/primitives/SphericalTensor/labelSphericalTensor/labelSphericalTensor.H index 3ebc5ecff4..b8a0dd1f25 100644 --- a/src/OpenFOAM/primitives/SphericalTensor/labelSphericalTensor/labelSphericalTensor.H +++ b/src/OpenFOAM/primitives/SphericalTensor/labelSphericalTensor/labelSphericalTensor.H @@ -52,9 +52,6 @@ namespace Foam typedef SphericalTensor