1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
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/>.
28 Templated 3D Vector derived from VectorSpace adding construction from
29 3 components, element access using x(), y() and z() member functions and
30 the inner-product (dot-product) and cross product operators.
32 A centre() member function which returns the Vector for which it is called
33 is defined so that point which is a typedef to Vector\<scalar\> behaves as
34 other shapes in the shape hierachy.
39 \*---------------------------------------------------------------------------*/
44 #include "VectorSpace.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 template<class T> class List;
53 /*---------------------------------------------------------------------------*\
54 Class Vector Declaration
55 \*---------------------------------------------------------------------------*/
60 public VectorSpace<Vector<Cmpt>, Cmpt, 3>
65 //- Equivalent type of labels used for valid component indexing
66 typedef Vector<label> labelType;
73 rank = 1 // Rank of Vector is 1
77 // Static data members
79 static const char* const typeName;
80 static const char* componentNames[];
81 static const Vector zero;
82 static const Vector one;
83 static const Vector max;
84 static const Vector min;
87 //- Component labeling enumeration
88 enum components { X, Y, Z };
96 //- Construct given VectorSpace
97 inline Vector(const VectorSpace<Vector<Cmpt>, Cmpt, 3>&);
99 //- Construct given three components
100 inline Vector(const Cmpt& vx, const Cmpt& vy, const Cmpt& vz);
102 //- Construct from Istream
103 inline Vector(Istream&);
110 inline const Cmpt& x() const;
111 inline const Cmpt& y() const;
112 inline const Cmpt& z() const;
118 //- Return *this (used for point which is a typedef to Vector<scalar>.
119 inline const Vector<Cmpt>& centre
121 const Foam::List<Vector<Cmpt> >&
127 class typeOfRank<Cmpt, 1>
131 typedef Vector<Cmpt> type;
136 class symmTypeOfRank<Cmpt, 1>
140 typedef Vector<Cmpt> type;
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 } // End namespace Foam
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 // ************************************************************************* //