00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 namespace Foam
00030 {
00031
00032
00033
00034
00035 template <class Cmpt>
00036 inline Vector<Cmpt>::Vector()
00037 {}
00038
00039
00040
00041 template <class Cmpt>
00042 inline Vector<Cmpt>::Vector(const VectorSpace<Vector<Cmpt>, Cmpt, 3>& vs)
00043 :
00044 VectorSpace<Vector<Cmpt>, Cmpt, 3>(vs)
00045 {}
00046
00047
00048
00049 template <class Cmpt>
00050 inline Vector<Cmpt>::Vector(const Cmpt& vx, const Cmpt& vy, const Cmpt& vz)
00051 {
00052 this->v_[X] = vx;
00053 this->v_[Y] = vy;
00054 this->v_[Z] = vz;
00055 }
00056
00057
00058
00059 template <class Cmpt>
00060 inline Vector<Cmpt>::Vector(Istream& is)
00061 :
00062 VectorSpace<Vector<Cmpt>, Cmpt, 3>(is)
00063 {}
00064
00065
00066
00067
00068 template <class Cmpt>
00069 inline const Cmpt& Vector<Cmpt>::x() const
00070 {
00071 return this->v_[X];
00072 }
00073
00074 template <class Cmpt>
00075 inline const Cmpt& Vector<Cmpt>::y() const
00076 {
00077 return this->v_[Y];
00078 }
00079
00080 template <class Cmpt>
00081 inline const Cmpt& Vector<Cmpt>::z() const
00082 {
00083 return this->v_[Z];
00084 }
00085
00086
00087 template <class Cmpt>
00088 inline Cmpt& Vector<Cmpt>::x()
00089 {
00090 return this->v_[X];
00091 }
00092
00093 template <class Cmpt>
00094 inline Cmpt& Vector<Cmpt>::y()
00095 {
00096 return this->v_[Y];
00097 }
00098
00099 template <class Cmpt>
00100 inline Cmpt& Vector<Cmpt>::z()
00101 {
00102 return this->v_[Z];
00103 }
00104
00105
00106
00107
00108
00109
00110
00111 template <class Cmpt>
00112 inline const Vector<Cmpt>& Vector<Cmpt>::centre(const List<Vector<Cmpt> >&)const
00113 {
00114 return *this;
00115 }
00116
00117
00118
00119
00120 template <class Cmpt>
00121 inline typename innerProduct<Vector<Cmpt>, Vector<Cmpt> >::type
00122 operator&(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
00123 {
00124 return Cmpt(v1.x()*v2.x() + v1.y()*v2.y() + v1.z()*v2.z());
00125 }
00126
00127
00128 template <class Cmpt>
00129 inline Vector<Cmpt> operator^(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
00130 {
00131 return Vector<Cmpt>
00132 (
00133 (v1.y()*v2.z() - v1.z()*v2.y()),
00134 (v1.z()*v2.x() - v1.x()*v2.z()),
00135 (v1.x()*v2.y() - v1.y()*v2.x())
00136 );
00137 }
00138
00139
00140
00141
00142 }
00143
00144