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 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 \*---------------------------------------------------------------------------*/
41 #ifndef VectorTemplate_H
42 #define VectorTemplate_H
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 i-th component. Consistency with VectorN
119 inline const Cmpt& operator()
124 //- Return i-th component. Consistency with VectorN
125 inline Cmpt& operator()
131 //- Return *this (used for point which is a typedef to Vector<scalar>.
132 inline const Vector<Cmpt>& centre
134 const Foam::List<Vector<Cmpt> >&
140 class typeOfRank<Cmpt, 1>
144 typedef Vector<Cmpt> type;
149 class symmTypeOfRank<Cmpt, 1>
153 typedef Vector<Cmpt> type;
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 } // End namespace Foam
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 #include "VectorTemplateI.H"
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 // ************************************************************************* //