DiagTensor: add conversion from SymmTensor

This commit is contained in:
Henry
2014-05-16 13:18:04 +01:00
committed by Andrew Heather
parent 99d47d85a8
commit 9c79939745

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "SphericalTensor.H" #include "SphericalTensor.H"
#include "SymmTensor.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -291,7 +292,7 @@ inline Cmpt det(const DiagTensor<Cmpt>& t)
} }
//- Return the inverse of a symmetric tensor //- Return the inverse of a diagonal tensor
template<class Cmpt> template<class Cmpt>
inline DiagTensor<Cmpt> inv(const DiagTensor<Cmpt>& dt) inline DiagTensor<Cmpt> inv(const DiagTensor<Cmpt>& dt)
{ {
@ -299,6 +300,14 @@ inline DiagTensor<Cmpt> inv(const DiagTensor<Cmpt>& dt)
} }
//- Return the diagonal of a symmetric tensor as a diagonal tensor
template<class Cmpt>
inline DiagTensor<Cmpt> diag(const SymmTensor<Cmpt>& t)
{
return DiagTensor<Cmpt>(t.xx(), t.yy(), t.zz());
}
//- Return the diagonal of a tensor as a diagonal tensor //- Return the diagonal of a tensor as a diagonal tensor
template<class Cmpt> template<class Cmpt>
inline DiagTensor<Cmpt> diag(const Tensor<Cmpt>& t) inline DiagTensor<Cmpt> diag(const Tensor<Cmpt>& t)