From e69aaae5486df72e136cc4c9dd9e99937e4e2fdf Mon Sep 17 00:00:00 2001 From: Henry Weller <http://cfd.direct> Date: Tue, 22 Mar 2016 08:22:21 +0000 Subject: [PATCH] Identity: Added cast to scalar --- src/OpenFOAM/primitives/SphericalTensor/Identity.H | 14 ++++++++++++-- .../sphericalTensor/sphericalTensor.H | 4 ---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/OpenFOAM/primitives/SphericalTensor/Identity.H b/src/OpenFOAM/primitives/SphericalTensor/Identity.H index 014adae6a28..492b03dddff 100644 --- a/src/OpenFOAM/primitives/SphericalTensor/Identity.H +++ b/src/OpenFOAM/primitives/SphericalTensor/Identity.H @@ -25,8 +25,8 @@ Class Foam::Identity Description - Templated identity and dual space identity tensors - derived from SphericalTensor. + Templated identity and dual space identity tensors derived from + SphericalTensor. \*---------------------------------------------------------------------------*/ @@ -75,9 +75,19 @@ public: { return dual(); } + + //- Return 1 for scalar + inline operator scalar() const + { + return 1; + } }; +// Global Identity tensor +static const Identity<scalar> I; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/primitives/SphericalTensor/sphericalTensor/sphericalTensor.H b/src/OpenFOAM/primitives/SphericalTensor/sphericalTensor/sphericalTensor.H index e4c4db09f9e..3bfa84f0bc2 100644 --- a/src/OpenFOAM/primitives/SphericalTensor/sphericalTensor/sphericalTensor.H +++ b/src/OpenFOAM/primitives/SphericalTensor/sphericalTensor/sphericalTensor.H @@ -48,13 +48,9 @@ namespace Foam typedef SphericalTensor<scalar> sphericalTensor; -// Identity tensor -static const Identity<scalar> I; - static const sphericalTensor oneThirdI(1.0/3.0); static const sphericalTensor twoThirdsI(2.0/3.0); - //- Specify data associated with sphericalTensor type are contiguous template<> inline bool contiguous<sphericalTensor>() {return true;} -- GitLab