mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Identity: Added cast to scalar
This commit is contained in:
@ -25,8 +25,8 @@ Class
|
|||||||
Foam::Identity
|
Foam::Identity
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Templated identity and dual space identity tensors
|
Templated identity and dual space identity tensors derived from
|
||||||
derived from SphericalTensor.
|
SphericalTensor.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -75,9 +75,19 @@ public:
|
|||||||
{
|
{
|
||||||
return dual();
|
return dual();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Return 1 for scalar
|
||||||
|
inline operator scalar() const
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Global Identity tensor
|
||||||
|
static const Identity<scalar> I;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -48,13 +48,9 @@ namespace Foam
|
|||||||
|
|
||||||
typedef SphericalTensor<scalar> sphericalTensor;
|
typedef SphericalTensor<scalar> sphericalTensor;
|
||||||
|
|
||||||
// Identity tensor
|
|
||||||
static const Identity<scalar> I;
|
|
||||||
|
|
||||||
static const sphericalTensor oneThirdI(1.0/3.0);
|
static const sphericalTensor oneThirdI(1.0/3.0);
|
||||||
static const sphericalTensor twoThirdsI(2.0/3.0);
|
static const sphericalTensor twoThirdsI(2.0/3.0);
|
||||||
|
|
||||||
|
|
||||||
//- Specify data associated with sphericalTensor type are contiguous
|
//- Specify data associated with sphericalTensor type are contiguous
|
||||||
template<>
|
template<>
|
||||||
inline bool contiguous<sphericalTensor>() {return true;}
|
inline bool contiguous<sphericalTensor>() {return true;}
|
||||||
|
|||||||
Reference in New Issue
Block a user