mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
SpatialVector: Added component access member functions
wx(), wy(), wz(), lx(), ly() and lz()
This commit is contained in:
@ -67,6 +67,10 @@ class SpatialVector
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- Component labeling enumeration
|
||||||
|
enum components { WX, WY, WZ, LX, LY, LZ };
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null
|
||||||
@ -81,19 +85,19 @@ public:
|
|||||||
//- Construct from the angular and linear vector components
|
//- Construct from the angular and linear vector components
|
||||||
inline SpatialVector
|
inline SpatialVector
|
||||||
(
|
(
|
||||||
const Vector<Cmpt>& angular,
|
const Vector<Cmpt>& w,
|
||||||
const Vector<Cmpt>& linear
|
const Vector<Cmpt>& l
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct given 6 components
|
//- Construct given 6 components
|
||||||
inline SpatialVector
|
inline SpatialVector
|
||||||
(
|
(
|
||||||
const Cmpt& v0,
|
const Cmpt& wx,
|
||||||
const Cmpt& v1,
|
const Cmpt& wy,
|
||||||
const Cmpt& v2,
|
const Cmpt& wz,
|
||||||
const Cmpt& v3,
|
const Cmpt& lx,
|
||||||
const Cmpt& v4,
|
const Cmpt& ly,
|
||||||
const Cmpt& v5
|
const Cmpt& lz
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
@ -102,11 +106,32 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return the angular part of the spatial vector as a vector
|
// Component access
|
||||||
inline Vector<Cmpt> angular() const;
|
|
||||||
|
|
||||||
//- Return the linear part of the spatial vector as a vector
|
inline const Cmpt& wx() const;
|
||||||
inline Vector<Cmpt> linear() const;
|
inline const Cmpt& wy() const;
|
||||||
|
inline const Cmpt& wz() const;
|
||||||
|
|
||||||
|
inline const Cmpt& lx() const;
|
||||||
|
inline const Cmpt& ly() const;
|
||||||
|
inline const Cmpt& lz() const;
|
||||||
|
|
||||||
|
inline Cmpt& wx();
|
||||||
|
inline Cmpt& wy();
|
||||||
|
inline Cmpt& wz();
|
||||||
|
|
||||||
|
inline Cmpt& lx();
|
||||||
|
inline Cmpt& ly();
|
||||||
|
inline Cmpt& lz();
|
||||||
|
|
||||||
|
|
||||||
|
// Sub-vector access.
|
||||||
|
|
||||||
|
//- Return the angular part of the spatial vector as a vector
|
||||||
|
inline Vector<Cmpt> w() const;
|
||||||
|
|
||||||
|
//- Return the linear part of the spatial vector as a vector
|
||||||
|
inline Vector<Cmpt> l() const;
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|||||||
@ -50,16 +50,16 @@ inline Foam::SpatialVector<Cmpt>::SpatialVector
|
|||||||
template<class Cmpt>
|
template<class Cmpt>
|
||||||
inline Foam::SpatialVector<Cmpt>::SpatialVector
|
inline Foam::SpatialVector<Cmpt>::SpatialVector
|
||||||
(
|
(
|
||||||
const Vector<Cmpt>& angular,
|
const Vector<Cmpt>& w,
|
||||||
const Vector<Cmpt>& linear
|
const Vector<Cmpt>& l
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this->v_[0] = angular.x();
|
this->v_[0] = w.x();
|
||||||
this->v_[1] = angular.y();
|
this->v_[1] = w.y();
|
||||||
this->v_[2] = angular.z();
|
this->v_[2] = w.z();
|
||||||
this->v_[3] = linear.x();
|
this->v_[3] = l.x();
|
||||||
this->v_[4] = linear.y();
|
this->v_[4] = l.y();
|
||||||
this->v_[5] = linear.z();
|
this->v_[5] = l.z();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -93,13 +93,97 @@ inline Foam::SpatialVector<Cmpt>::SpatialVector(Istream& is)
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Cmpt>
|
template<class Cmpt>
|
||||||
inline Foam::Vector<Cmpt> Foam::SpatialVector<Cmpt>::angular() const
|
inline const Cmpt& Foam::SpatialVector<Cmpt>::wx() const
|
||||||
|
{
|
||||||
|
return this->v_[WX];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline const Cmpt& Foam::SpatialVector<Cmpt>::wy() const
|
||||||
|
{
|
||||||
|
return this->v_[WY];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline const Cmpt& Foam::SpatialVector<Cmpt>::wz() const
|
||||||
|
{
|
||||||
|
return this->v_[WZ];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline const Cmpt& Foam::SpatialVector<Cmpt>::lx() const
|
||||||
|
{
|
||||||
|
return this->v_[LX];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline const Cmpt& Foam::SpatialVector<Cmpt>::ly() const
|
||||||
|
{
|
||||||
|
return this->v_[LY];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline const Cmpt& Foam::SpatialVector<Cmpt>::lz() const
|
||||||
|
{
|
||||||
|
return this->v_[LZ];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Cmpt& Foam::SpatialVector<Cmpt>::wx()
|
||||||
|
{
|
||||||
|
return this->v_[WX];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Cmpt& Foam::SpatialVector<Cmpt>::wy()
|
||||||
|
{
|
||||||
|
return this->v_[WY];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Cmpt& Foam::SpatialVector<Cmpt>::wz()
|
||||||
|
{
|
||||||
|
return this->v_[WZ];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Cmpt& Foam::SpatialVector<Cmpt>::lx()
|
||||||
|
{
|
||||||
|
return this->v_[LX];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Cmpt& Foam::SpatialVector<Cmpt>::ly()
|
||||||
|
{
|
||||||
|
return this->v_[LY];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Cmpt& Foam::SpatialVector<Cmpt>::lz()
|
||||||
|
{
|
||||||
|
return this->v_[LZ];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Foam::Vector<Cmpt> Foam::SpatialVector<Cmpt>::w() const
|
||||||
{
|
{
|
||||||
return Vector<Cmpt>(this->v_[0], this->v_[1], this->v_[2]);
|
return Vector<Cmpt>(this->v_[0], this->v_[1], this->v_[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Cmpt>
|
template<class Cmpt>
|
||||||
inline Foam::Vector<Cmpt> Foam::SpatialVector<Cmpt>::linear() const
|
inline Foam::Vector<Cmpt> Foam::SpatialVector<Cmpt>::l() const
|
||||||
{
|
{
|
||||||
return Vector<Cmpt>(this->v_[3], this->v_[4], this->v_[5]);
|
return Vector<Cmpt>(this->v_[3], this->v_[4], this->v_[5]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,7 @@ const char* const Foam::spatialVector::vsType::typeName = "spatialVector";
|
|||||||
template<>
|
template<>
|
||||||
const char* const Foam::spatialVector::vsType::componentNames[] =
|
const char* const Foam::spatialVector::vsType::componentNames[] =
|
||||||
{
|
{
|
||||||
"x", "y", "z"
|
"wx", "wy", "wz", "lx", "ly", "lz"
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|||||||
@ -148,8 +148,8 @@ inline Foam::spatialVector Foam::spatialTransform::operator&
|
|||||||
{
|
{
|
||||||
return spatialVector
|
return spatialVector
|
||||||
(
|
(
|
||||||
E_ & v.angular(),
|
E_ & v.w(),
|
||||||
E_ & (v.linear() - (r_ ^ v.angular()))
|
E_ & (v.l() - (r_ ^ v.w()))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,11 +169,11 @@ inline Foam::spatialVector Foam::spatialTransform::transpose::operator&
|
|||||||
const spatialVector& f
|
const spatialVector& f
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
vector ETfl(X_.E().T() & f.linear());
|
vector ETfl(X_.E().T() & f.l());
|
||||||
|
|
||||||
return spatialVector
|
return spatialVector
|
||||||
(
|
(
|
||||||
(X_.E().T() & f.angular()) + (X_.r() ^ ETfl),
|
(X_.E().T() & f.w()) + (X_.r() ^ ETfl),
|
||||||
ETfl
|
ETfl
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -196,8 +196,8 @@ inline Foam::spatialVector Foam::spatialTransform::dual::operator&
|
|||||||
{
|
{
|
||||||
return spatialVector
|
return spatialVector
|
||||||
(
|
(
|
||||||
X_.E() & (f.angular() - (X_.r() ^ f.linear())),
|
X_.E() & (f.w() - (X_.r() ^ f.l())),
|
||||||
X_.E() & f.linear()
|
X_.E() & f.l()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user