1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Templated 2D Vector derived from VectorSpace adding construction from
29 2 components, element access using x() and y() member functions and
30 the inner-product (dot-product).
35 \*---------------------------------------------------------------------------*/
37 #ifndef Vector2DTemplate_H
38 #define Vector2DTemplate_H
40 #include "VectorSpace.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 /*---------------------------------------------------------------------------*\
48 Class Vector2D Declaration
49 \*---------------------------------------------------------------------------*/
54 public VectorSpace<Vector2D<Cmpt>, Cmpt, 2>
63 rank = 1 // Rank of Vector2D is 1
67 // Static data members
69 static const char* const typeName;
70 static const char* componentNames[];
71 static const Vector2D zero;
72 static const Vector2D one;
73 static const Vector2D max;
74 static const Vector2D min;
77 //- Component labeling enumeration
78 enum components { X, Y };
86 //- Construct given VectorSpace
87 inline Vector2D(const VectorSpace<Vector2D<Cmpt>, Cmpt, 2>&);
89 //- Construct given two components
90 inline Vector2D(const Cmpt& vx, const Cmpt& vy);
92 //- Construct from Istream
93 inline Vector2D(Istream&);
100 inline const Cmpt& x() const;
101 inline const Cmpt& y() const;
106 //- Return i-th component. Consistency with VectorN
107 inline const Cmpt& operator()
112 //- Return i-th component. Consistency with VectorN
113 inline Cmpt& operator()
121 //- perp dot product (dot product with perpendicular vector)
122 inline scalar perp(const Vector2D<Cmpt>& b) const;
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 } // End namespace Foam
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 // Include inline implementations
133 #include "Vector2DTemplateI.H"
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 // ************************************************************************* //