1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 inline Vector<Cmpt>::Vector()
40 // Construct given VectorSpace
42 inline Vector<Cmpt>::Vector(const VectorSpace<Vector<Cmpt>, Cmpt, 3>& vs)
44 VectorSpace<Vector<Cmpt>, Cmpt, 3>(vs)
48 // Construct given three Cmpts
50 inline Vector<Cmpt>::Vector(const Cmpt& vx, const Cmpt& vy, const Cmpt& vz)
58 // Construct from Istream
60 inline Vector<Cmpt>::Vector(Istream& is)
62 VectorSpace<Vector<Cmpt>, Cmpt, 3>(is)
66 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
69 inline const Cmpt& Vector<Cmpt>::x() const
75 inline const Cmpt& Vector<Cmpt>::y() const
81 inline const Cmpt& Vector<Cmpt>::z() const
88 inline Cmpt& Vector<Cmpt>::x()
94 inline Cmpt& Vector<Cmpt>::y()
100 inline Cmpt& Vector<Cmpt>::z()
106 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
108 template <class Cmpt>
109 inline const Vector<Cmpt>& Vector<Cmpt>::centre
111 const Foam::List<Vector<Cmpt> >&
118 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
120 template <class Cmpt>
121 inline typename innerProduct<Vector<Cmpt>, Vector<Cmpt> >::type
122 operator&(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
124 return Cmpt(v1.x()*v2.x() + v1.y()*v2.y() + v1.z()*v2.z());
128 template <class Cmpt>
129 inline Vector<Cmpt> operator^(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
133 (v1.y()*v2.z() - v1.z()*v2.y()),
134 (v1.z()*v2.x() - v1.x()*v2.z()),
135 (v1.x()*v2.y() - v1.y()*v2.x())
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 } // End namespace Foam
144 // ************************************************************************* //