1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 inline Vector<Cmpt>::Vector()
39 // Construct given VectorSpace
41 inline Vector<Cmpt>::Vector(const VectorSpace<Vector<Cmpt>, Cmpt, 3>& vs)
43 VectorSpace<Vector<Cmpt>, Cmpt, 3>(vs)
47 // Construct given three Cmpts
49 inline Vector<Cmpt>::Vector(const Cmpt& vx, const Cmpt& vy, const Cmpt& vz)
57 // Construct from Istream
59 inline Vector<Cmpt>::Vector(Istream& is)
61 VectorSpace<Vector<Cmpt>, Cmpt, 3>(is)
65 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
68 inline const Cmpt& Vector<Cmpt>::x() const
74 inline const Cmpt& Vector<Cmpt>::y() const
80 inline const Cmpt& Vector<Cmpt>::z() const
87 inline Cmpt& Vector<Cmpt>::x()
93 inline Cmpt& Vector<Cmpt>::y()
99 inline Cmpt& Vector<Cmpt>::z()
105 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
107 template <class Cmpt>
108 inline const Vector<Cmpt>& Vector<Cmpt>::centre
110 const Foam::List<Vector<Cmpt> >&
117 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
119 template <class Cmpt>
120 inline typename innerProduct<Vector<Cmpt>, Vector<Cmpt> >::type
121 operator&(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
123 return Cmpt(v1.x()*v2.x() + v1.y()*v2.y() + v1.z()*v2.z());
127 template <class Cmpt>
128 inline Vector<Cmpt> operator^(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
132 (v1.y()*v2.z() - v1.z()*v2.y()),
133 (v1.z()*v2.x() - v1.x()*v2.z()),
134 (v1.x()*v2.y() - v1.y()*v2.x())
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 } // End namespace Foam
143 // ************************************************************************* //