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
29 Templated 2D Vector derived from VectorSpace adding construction from
30 2 components, element access using x() and y() member functions and
31 the inner-product (dot-product).
36 \*---------------------------------------------------------------------------*/
41 #include "VectorSpace.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 /*---------------------------------------------------------------------------*\
49 Class Vector2D Declaration
50 \*---------------------------------------------------------------------------*/
55 public VectorSpace<Vector2D<Cmpt>, Cmpt, 2>
64 rank = 1 // Rank of Vector2D is 1
68 // Static data members
70 static const char* const typeName;
71 static const char* componentNames[];
72 static const Vector2D zero;
73 static const Vector2D one;
74 static const Vector2D max;
75 static const Vector2D min;
78 //- Component labeling enumeration
79 enum components { X, Y };
87 //- Construct given VectorSpace
88 inline Vector2D(const VectorSpace<Vector2D<Cmpt>, Cmpt, 2>&);
90 //- Construct given two components
91 inline Vector2D(const Cmpt& vx, const Cmpt& vy);
93 //- Construct from Istream
94 inline Vector2D(Istream&);
101 inline const Cmpt& x() const;
102 inline const Cmpt& y() const;
110 //- perp dot product (dot product with perpendicular vector)
111 inline scalar perp(const Vector2D<Cmpt>& b) const;
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 } // End namespace Foam
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 // Include inline implementations
122 #include "Vector2DI.H"
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 // ************************************************************************* //