mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Tensor: access for vector component
This commit is contained in:
@ -152,11 +152,11 @@ public:
|
|||||||
inline Cmpt& zz();
|
inline Cmpt& zz();
|
||||||
|
|
||||||
// Access vector components.
|
// Access vector components.
|
||||||
// Note: returning const only to find out lhs usage
|
|
||||||
|
|
||||||
inline const Vector<Cmpt> x() const;
|
inline Vector<Cmpt> x() const;
|
||||||
inline const Vector<Cmpt> y() const;
|
inline Vector<Cmpt> y() const;
|
||||||
inline const Vector<Cmpt> z() const;
|
inline Vector<Cmpt> z() const;
|
||||||
|
inline Vector<Cmpt> vectorComponent(const direction) const;
|
||||||
|
|
||||||
//- Transpose
|
//- Transpose
|
||||||
inline Tensor<Cmpt> T() const;
|
inline Tensor<Cmpt> T() const;
|
||||||
|
|||||||
@ -118,24 +118,42 @@ inline Tensor<Cmpt>::Tensor(Istream& is)
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Cmpt>
|
template<class Cmpt>
|
||||||
inline const Vector<Cmpt> Tensor<Cmpt>::x() const
|
inline Vector<Cmpt> Tensor<Cmpt>::x() const
|
||||||
{
|
{
|
||||||
return Vector<Cmpt>(this->v_[XX], this->v_[XY], this->v_[XZ]);
|
return Vector<Cmpt>(this->v_[XX], this->v_[XY], this->v_[XZ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Cmpt>
|
template<class Cmpt>
|
||||||
inline const Vector<Cmpt> Tensor<Cmpt>::y() const
|
inline Vector<Cmpt> Tensor<Cmpt>::y() const
|
||||||
{
|
{
|
||||||
return Vector<Cmpt>(this->v_[YX], this->v_[YY], this->v_[YZ]);
|
return Vector<Cmpt>(this->v_[YX], this->v_[YY], this->v_[YZ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Cmpt>
|
template<class Cmpt>
|
||||||
inline const Vector<Cmpt> Tensor<Cmpt>::z() const
|
inline Vector<Cmpt> Tensor<Cmpt>::z() const
|
||||||
{
|
{
|
||||||
return Vector<Cmpt>(this->v_[ZX], this->v_[ZY], this->v_[ZZ]);
|
return Vector<Cmpt>(this->v_[ZX], this->v_[ZY], this->v_[ZZ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Vector<Cmpt> Tensor<Cmpt>::vectorComponent(const direction cmpt) const
|
||||||
|
{
|
||||||
|
switch (cmpt)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return x();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
return y();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return z();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Cmpt>
|
template<class Cmpt>
|
||||||
inline const Cmpt& Tensor<Cmpt>::xx() const
|
inline const Cmpt& Tensor<Cmpt>::xx() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user