Go to the documentation of this file.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 #include <OpenFOAM/Vector2D_.H>
00027 
00028 
00029 
00030 namespace Foam
00031 {
00032 
00033 
00034 
00035 
00036 template <class Cmpt>
00037 inline SphericalTensor2D<Cmpt>::SphericalTensor2D()
00038 {}
00039 
00040 
00041 
00042 template <class Cmpt>
00043 inline SphericalTensor2D<Cmpt>::SphericalTensor2D
00044 (
00045     const VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>& vs
00046 )
00047 :
00048     VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>(vs)
00049 {}
00050 
00051 
00052 
00053 template <class Cmpt>
00054 inline SphericalTensor2D<Cmpt>::SphericalTensor2D(const Cmpt& stii)
00055 {
00056     this->v_[II] = stii;
00057 }
00058 
00059 
00060 
00061 template <class Cmpt>
00062 inline SphericalTensor2D<Cmpt>::SphericalTensor2D(Istream& is)
00063 :
00064     VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>(is)
00065 {}
00066 
00067 
00068 
00069 
00070 template <class Cmpt>
00071 inline const Cmpt&  SphericalTensor2D<Cmpt>::ii() const
00072 {
00073     return this->v_[II];
00074 }
00075 
00076 
00077 template <class Cmpt>
00078 inline Cmpt& SphericalTensor2D<Cmpt>::ii()
00079 {
00080     return this->v_[II];
00081 }
00082 
00083 
00084 
00085 
00086 
00087 template <class Cmpt>
00088 inline SphericalTensor2D<Cmpt>
00089 operator&
00090 (
00091     const SphericalTensor2D<Cmpt>& st1,
00092     const SphericalTensor2D<Cmpt>& st2
00093 )
00094 {
00095     return SphericalTensor2D<Cmpt>(st1.ii()*st2.ii());
00096 }
00097 
00098 
00099 
00100 template <class Cmpt>
00101 inline Vector2D<Cmpt>
00102 operator&(const SphericalTensor2D<Cmpt>& st, const Vector2D<Cmpt>& v)
00103 {
00104     return Vector2D<Cmpt>
00105     (
00106         st.ii()*v.x(),
00107                        st.ii()*v.y()
00108     );
00109 }
00110 
00111 
00112 
00113 template <class Cmpt>
00114 inline Vector2D<Cmpt>
00115 operator&(const Vector2D<Cmpt>& v, const SphericalTensor2D<Cmpt>& st)
00116 {
00117     return Vector2D<Cmpt>
00118     (
00119         v.x()*st.ii(),
00120                        v.y()*st.ii()
00121     );
00122 }
00123 
00124 
00125 
00126 template <class Cmpt>
00127 inline SphericalTensor2D<Cmpt>
00128 operator/(const scalar s, const SphericalTensor2D<Cmpt>& st)
00129 {
00130     return SphericalTensor2D<Cmpt>(s/st.ii());
00131 }
00132 
00133 
00134 
00135 template <class Cmpt>
00136 inline Cmpt tr(const SphericalTensor2D<Cmpt>& st)
00137 {
00138     return 2*st.ii();
00139 }
00140 
00141 
00142 
00143 template <class Cmpt>
00144 inline SphericalTensor2D<Cmpt> sph(const SphericalTensor2D<Cmpt>& st)
00145 {
00146     return st;
00147 }
00148 
00149 
00150 
00151 template <class Cmpt>
00152 inline Cmpt det(const SphericalTensor2D<Cmpt>& st)
00153 {
00154     return st.ii()*st.ii();
00155 }
00156 
00157 
00158 
00159 template <class Cmpt>
00160 inline SphericalTensor2D<Cmpt> inv(const SphericalTensor2D<Cmpt>& st)
00161 {
00162     return SphericalTensor2D<Cmpt>(1.0/st.ii()); 
00163 }
00164 
00165 
00166 template<class Cmpt>
00167 class outerProduct<SphericalTensor2D<Cmpt>, Cmpt>
00168 {
00169 public:
00170 
00171     typedef SphericalTensor2D<Cmpt> type;
00172 };
00173 
00174 template<class Cmpt>
00175 class outerProduct<Cmpt, SphericalTensor2D<Cmpt> >
00176 {
00177 public:
00178 
00179     typedef SphericalTensor2D<Cmpt> type;
00180 };
00181 
00182 
00183 template<class Cmpt>
00184 class innerProduct<SphericalTensor2D<Cmpt>, SphericalTensor2D<Cmpt> >
00185 {
00186 public:
00187 
00188     typedef SphericalTensor2D<Cmpt> type;
00189 };
00190 
00191 
00192 template<class Cmpt>
00193 class innerProduct<SphericalTensor2D<Cmpt>, Vector2D<Cmpt> >
00194 {
00195 public:
00196 
00197     typedef Vector2D<Cmpt> type;
00198 };
00199 
00200 template<class Cmpt>
00201 class innerProduct<Vector2D<Cmpt>, SphericalTensor2D<Cmpt> >
00202 {
00203 public:
00204 
00205     typedef Vector2D<Cmpt> type;
00206 };
00207 
00208 
00209 
00210 
00211 } 
00212 
00213