/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
inline Foam::Vector::Vector()
{}
template
inline Foam::Vector::Vector(const Foam::zero)
:
Vector::vsType(Zero)
{}
template
template
inline Foam::Vector::Vector
(
const VectorSpace, Cmpt2, 3>& vs
)
:
Vector::vsType(vs)
{}
template
inline Foam::Vector::Vector
(
const Cmpt& vx,
const Cmpt& vy,
const Cmpt& vz
)
{
this->v_[X] = vx;
this->v_[Y] = vy;
this->v_[Z] = vz;
}
template
inline Foam::Vector::Vector(Istream& is)
:
Vector::vsType(is)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
inline const Cmpt& Foam::Vector::x() const
{
return this->v_[X];
}
template
inline const Cmpt& Foam::Vector::y() const
{
return this->v_[Y];
}
template
inline const Cmpt& Foam::Vector::z() const
{
return this->v_[Z];
}
template
inline Cmpt& Foam::Vector::x()
{
return this->v_[X];
}
template
inline Cmpt& Foam::Vector::y()
{
return this->v_[Y];
}
template
inline Cmpt& Foam::Vector::z()
{
return this->v_[Z];
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
inline const Foam::Vector& Foam::Vector::centre
(
const Foam::List>&
)const
{
return *this;
}
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Dummy innerProduct for scalar to allow the construction of vtables for
// virtual member functions involving the inner-products of fields
// for which a "NotImplemented" specialisation for scalar is provided.
template
class innerProduct, scalar>
{
public:
typedef scalar type;
};
template
inline typename innerProduct, Vector>::type
operator&(const Vector& v1, const Vector& v2)
{
return Cmpt(v1.x()*v2.x() + v1.y()*v2.y() + v1.z()*v2.z());
}
template
inline Vector operator^(const Vector& v1, const Vector& v2)
{
return Vector
(
(v1.y()*v2.z() - v1.z()*v2.y()),
(v1.z()*v2.x() - v1.x()*v2.z()),
(v1.x()*v2.y() - v1.y()*v2.x())
);
}
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template
inline Vector perpendicular(const Vector& v)
{
Vector u(Zero);
u[findMin(cmptMag(v))] = 1;
return u ^ v;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //