Test-Field.H
Go to the documentation of this file.
1 #include <iostream>
2 
3 template<class C>
4 class Vector;
5 
6 template<class C>
7 Vector<C> operator+(const Vector<C>& v1, const Vector<C>& v2);
8 
9 template<class C>
10 std::ostream& operator<<(std::ostream& os, const Vector<C>& v);
11 
12 
13 /*---------------------------------------------------------------------------*\
14  Class Vector Declaration
15 \*---------------------------------------------------------------------------*/
16 
17 template<class C>
18 class Vector
19 {
20 
21  double X, Y;
22 
23 public:
24 
25  inline Vector(const double x, const double y);
26 
27  C x() const
28  {
29  return X;
30  }
31 
32  C y() const
33  {
34  return Y;
35  }
36 
37  friend Vector<C> operator+ <C>(const Vector<C>& v1, const Vector<C>& v2);
38 
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  }
44 };
45 
46 template<class C>
47 inline Vector<C>::Vector(const double x, const double y)
48 {
49  X = x;
50  Y = y;
51 }
52 
53 
54 template<class C>
55 inline Vector<C> operator+(const Vector<C>& v1, const Vector<C>& v2)
56 {
57  return Vector<C>(v1.X+v2.X, v1.Y+v2.Y);
58 }
Vector::operator<<
friend std::ostream & operator<<(std::ostream &os, const Vector< C > &v)
Definition: Test-Field.H:39
Vector::x
C x() const
Definition: Test-Field.H:27
C
volScalarField & C
Definition: readThermalProperties.H:104
Vector::X
double X
Definition: Test-Field.H:21
Vector::Vector
Vector(const double x, const double y)
Definition: Test-Field.H:47
operator<<
std::ostream & operator<<(std::ostream &os, const Vector< C > &v)
Definition: Test-Field.H:39
x
x
Definition: LISASMDCalcMethod2.H:52
Vector::y
C y() const
Definition: Test-Field.H:32
Vector::Y
double Y
Definition: Test-Field.H:21
Vector
Definition: Test-Field.H:4
operator+
Vector< C > operator+(const Vector< C > &v1, const Vector< C > &v2)
Definition: Test-Field.H:55
Y
PtrList< volScalarField > & Y
Definition: createFields.H:36
y
scalar y
Definition: LISASMDCalcMethod1.H:14