initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / test / Field / testField.H
blobd43452fea7ea13c6b4157d989ca5baae96ddc8f1
1 #include <iostream>
3 template<class C>
4 class Vector;
6 template<class C>
7 Vector<C> operator+(const Vector<C>& v1, const Vector<C>& v2);
9 template<class C>
10 std::ostream& operator<<(std::ostream& os, const Vector<C>& v);
13 /*---------------------------------------------------------------------------*\
14                            Class Vector Declaration
15 \*---------------------------------------------------------------------------*/
17 template<class C>
18 class Vector
21     double X, Y;
23 public:
25     inline Vector(const double x, const double y);
27     C x() const
28     {
29         return X;
30     }
32     C y() const
33     {
34         return Y;
35     }
37     friend Vector<C> operator+ <C>(const Vector<C>& v1, const Vector<C>& v2);
39     friend std::ostream& operator<<(std::ostream& os, const Vector<C>& v)
40     {
41         os << v.X << '\t' << v.Y << '\n';
42         return os;
43     }
46 template<class C>
47 inline Vector<C>::Vector(const double x, const double y)
49     X = x;
50     Y = y;
54 template<class C>
55 inline Vector<C> operator+(const Vector<C>& v1, const Vector<C>& v2)
57     return Vector<C>(v1.X+v2.X, v1.Y+v2.Y);