Identity: Added cast to scalar

This commit is contained in:
Henry Weller
2016-03-22 08:22:21 +00:00
parent ea6eac35a6
commit e69aaae548
2 changed files with 12 additions and 6 deletions

View File

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

View File

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