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