Commit f35a8798 authored by mattijs's avatar mattijs
Browse files

ENH: Tensor: access for vector component

parent 57db18c3
......@@ -152,11 +152,11 @@ public:
inline Cmpt& zz();
// Access vector components.
// Note: returning const only to find out lhs usage
inline const Vector<Cmpt> x() const;
inline const Vector<Cmpt> y() const;
inline const Vector<Cmpt> z() const;
inline Vector<Cmpt> x() const;
inline Vector<Cmpt> y() const;
inline Vector<Cmpt> z() const;
inline Vector<Cmpt> vectorComponent(const direction) const;
//- Transpose
inline Tensor<Cmpt> T() const;
......
......@@ -118,24 +118,42 @@ inline Tensor<Cmpt>::Tensor(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
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]);
}
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]);
}
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]);
}
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>
inline const Cmpt& Tensor<Cmpt>::xx() const
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment