COMP/ENH: Update assignments to constructors to compile with clang. Add tensor->triad conversion.

This commit is contained in:
laurence
2012-12-24 15:36:50 +00:00
parent 180cb0bbc1
commit 9989b015a6
14 changed files with 88 additions and 41 deletions

View File

@ -103,6 +103,9 @@ public:
//- Construct given SymmTensor
inline Tensor(const SymmTensor<Cmpt>&);
//- Construct given triad
inline Tensor(const Vector<Vector<Cmpt> >&);
//- Construct given the three vector components
inline Tensor
(
@ -165,6 +168,9 @@ public:
//- Assign to a SymmTensor
inline void operator=(const SymmTensor<Cmpt>&);
//- Assign to a triad
inline void operator=(const Vector<Vector<Cmpt> >&);
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -66,6 +66,24 @@ inline Tensor<Cmpt>::Tensor(const SymmTensor<Cmpt>& st)
}
//- Construct given triad
template <class Cmpt>
inline Tensor<Cmpt>::Tensor(const Vector<Vector<Cmpt> >& tr)
{
this->v_[XX] = tr.x().x();
this->v_[XY] = tr.x().y();
this->v_[XZ] = tr.x().z();
this->v_[YX] = tr.y().x();
this->v_[YY] = tr.y().y();
this->v_[YZ] = tr.y().z();
this->v_[ZX] = tr.z().x();
this->v_[ZY] = tr.z().y();
this->v_[ZZ] = tr.z().z();
}
//- Construct given the three vector components
template <class Cmpt>
inline Tensor<Cmpt>::Tensor
@ -272,6 +290,23 @@ inline void Tensor<Cmpt>::operator=(const SymmTensor<Cmpt>& st)
}
template <class Cmpt>
inline void Tensor<Cmpt>::operator=(const Vector<Vector<Cmpt> >& tr)
{
this->v_[XX] = tr.x().x();
this->v_[XY] = tr.x().y();
this->v_[XZ] = tr.x().z();
this->v_[YX] = tr.y().x();
this->v_[YY] = tr.y().y();
this->v_[YZ] = tr.y().z();
this->v_[ZX] = tr.z().x();
this->v_[ZY] = tr.z().y();
this->v_[ZZ] = tr.z().z();
}
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
//- Hodge Dual operator (tensor -> vector)