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 Tensor<Cmpt>::Tensor()
00037 {}
00038
00039
00040
00041 template <class Cmpt>
00042 inline Tensor<Cmpt>::Tensor(const VectorSpace<Tensor<Cmpt>, Cmpt, 9>& vs)
00043 :
00044 VectorSpace<Tensor<Cmpt>, Cmpt, 9>(vs)
00045 {}
00046
00047
00048
00049 template <class Cmpt>
00050 inline Tensor<Cmpt>::Tensor(const SphericalTensor<Cmpt>& st)
00051 {
00052 this->v_[XX] = st.ii(); this->v_[XY] = 0; this->v_[XZ] = 0;
00053 this->v_[YX] = 0; this->v_[YY] = st.ii(); this->v_[YZ] = 0;
00054 this->v_[ZX] = 0; this->v_[ZY] = 0; this->v_[ZZ] = st.ii();
00055 }
00056
00057
00058
00059 template <class Cmpt>
00060 inline Tensor<Cmpt>::Tensor(const SymmTensor<Cmpt>& st)
00061 {
00062 this->v_[XX] = st.xx(); this->v_[XY] = st.xy(); this->v_[XZ] = st.xz();
00063 this->v_[YX] = st.xy(); this->v_[YY] = st.yy(); this->v_[YZ] = st.yz();
00064 this->v_[ZX] = st.xz(); this->v_[ZY] = st.yz(); this->v_[ZZ] = st.zz();
00065 }
00066
00067
00068
00069 template <class Cmpt>
00070 inline Tensor<Cmpt>::Tensor
00071 (
00072 const Cmpt txx, const Cmpt txy, const Cmpt txz,
00073 const Cmpt tyx, const Cmpt tyy, const Cmpt tyz,
00074 const Cmpt tzx, const Cmpt tzy, const Cmpt tzz
00075 )
00076 {
00077 this->v_[XX] = txx; this->v_[XY] = txy; this->v_[XZ] = txz;
00078 this->v_[YX] = tyx; this->v_[YY] = tyy; this->v_[YZ] = tyz;
00079 this->v_[ZX] = tzx; this->v_[ZY] = tzy; this->v_[ZZ] = tzz;
00080 }
00081
00082
00083
00084 template <class Cmpt>
00085 inline Tensor<Cmpt>::Tensor(Istream& is)
00086 :
00087 VectorSpace<Tensor<Cmpt>, Cmpt, 9>(is)
00088 {}
00089
00090
00091
00092
00093 template <class Cmpt>
00094 inline const Vector<Cmpt>& Tensor<Cmpt>::x() const
00095 {
00096 return reinterpret_cast<const Vector<Cmpt>&>(this->v_[XX]);
00097 }
00098
00099 template <class Cmpt>
00100 inline const Vector<Cmpt>& Tensor<Cmpt>::y() const
00101 {
00102 return reinterpret_cast<const Vector<Cmpt>&>(this->v_[YX]);
00103 }
00104
00105 template <class Cmpt>
00106 inline const Vector<Cmpt>& Tensor<Cmpt>::z() const
00107 {
00108 return reinterpret_cast<const Vector<Cmpt>&>(this->v_[ZX]);
00109 }
00110
00111
00112 template <class Cmpt>
00113 inline Vector<Cmpt>& Tensor<Cmpt>::x()
00114 {
00115 return reinterpret_cast<Vector<Cmpt>&>(this->v_[XX]);
00116 }
00117
00118 template <class Cmpt>
00119 inline Vector<Cmpt>& Tensor<Cmpt>::y()
00120 {
00121 return reinterpret_cast<Vector<Cmpt>&>(this->v_[YX]);
00122 }
00123
00124 template <class Cmpt>
00125 inline Vector<Cmpt>& Tensor<Cmpt>::z()
00126 {
00127 return reinterpret_cast<Vector<Cmpt>&>(this->v_[ZX]);
00128 }
00129
00130
00131 template <class Cmpt>
00132 inline const Cmpt& Tensor<Cmpt>::xx() const
00133 {
00134 return this->v_[XX];
00135 }
00136
00137 template <class Cmpt>
00138 inline const Cmpt& Tensor<Cmpt>::xy() const
00139 {
00140 return this->v_[XY];
00141 }
00142
00143 template <class Cmpt>
00144 inline const Cmpt& Tensor<Cmpt>::xz() const
00145 {
00146 return this->v_[XZ];
00147 }
00148
00149
00150 template <class Cmpt>
00151 inline const Cmpt& Tensor<Cmpt>::yx() const
00152 {
00153 return this->v_[YX];
00154 }
00155
00156 template <class Cmpt>
00157 inline const Cmpt& Tensor<Cmpt>::yy() const
00158 {
00159 return this->v_[YY];
00160 }
00161
00162 template <class Cmpt>
00163 inline const Cmpt& Tensor<Cmpt>::yz() const
00164 {
00165 return this->v_[YZ];
00166 }
00167
00168
00169 template <class Cmpt>
00170 inline const Cmpt& Tensor<Cmpt>::zx() const
00171 {
00172 return this->v_[ZX];
00173 }
00174
00175 template <class Cmpt>
00176 inline const Cmpt& Tensor<Cmpt>::zy() const
00177 {
00178 return this->v_[ZY];
00179 }
00180
00181 template <class Cmpt>
00182 inline const Cmpt& Tensor<Cmpt>::zz() const
00183 {
00184 return this->v_[ZZ];
00185 }
00186
00187
00188 template <class Cmpt>
00189 inline Cmpt& Tensor<Cmpt>::xx()
00190 {
00191 return this->v_[XX];
00192 }
00193
00194 template <class Cmpt>
00195 inline Cmpt& Tensor<Cmpt>::xy()
00196 {
00197 return this->v_[XY];
00198 }
00199
00200 template <class Cmpt>
00201 inline Cmpt& Tensor<Cmpt>::xz()
00202 {
00203 return this->v_[XZ];
00204 }
00205
00206
00207 template <class Cmpt>
00208 inline Cmpt& Tensor<Cmpt>::yx()
00209 {
00210 return this->v_[YX];
00211 }
00212
00213 template <class Cmpt>
00214 inline Cmpt& Tensor<Cmpt>::yy()
00215 {
00216 return this->v_[YY];
00217 }
00218
00219 template <class Cmpt>
00220 inline Cmpt& Tensor<Cmpt>::yz()
00221 {
00222 return this->v_[YZ];
00223 }
00224
00225
00226 template <class Cmpt>
00227 inline Cmpt& Tensor<Cmpt>::zx()
00228 {
00229 return this->v_[ZX];
00230 }
00231
00232 template <class Cmpt>
00233 inline Cmpt& Tensor<Cmpt>::zy()
00234 {
00235 return this->v_[ZY];
00236 }
00237
00238 template <class Cmpt>
00239 inline Cmpt& Tensor<Cmpt>::zz()
00240 {
00241 return this->v_[ZZ];
00242 }
00243
00244
00245
00246 template <class Cmpt>
00247 inline Tensor<Cmpt> Tensor<Cmpt>::T() const
00248 {
00249 return Tensor<Cmpt>
00250 (
00251 xx(), yx(), zx(),
00252 xy(), yy(), zy(),
00253 xz(), yz(), zz()
00254 );
00255 }
00256
00257
00258
00259
00260 template <class Cmpt>
00261 inline void Tensor<Cmpt>::operator=(const SphericalTensor<Cmpt>& st)
00262 {
00263 this->v_[XX] = st.ii(); this->v_[XY] = 0; this->v_[XZ] = 0;
00264 this->v_[YX] = 0; this->v_[YY] = st.ii(); this->v_[YZ] = 0;
00265 this->v_[ZX] = 0; this->v_[ZY] = 0; this->v_[ZZ] = st.ii();
00266 }
00267
00268
00269 template <class Cmpt>
00270 inline void Tensor<Cmpt>::operator=(const SymmTensor<Cmpt>& st)
00271 {
00272 this->v_[XX] = st.xx(); this->v_[XY] = st.xy(); this->v_[XZ] = st.xz();
00273 this->v_[YX] = st.xy(); this->v_[YY] = st.yy(); this->v_[YZ] = st.yz();
00274 this->v_[ZX] = st.xz(); this->v_[ZY] = st.yz(); this->v_[ZZ] = st.zz();
00275 }
00276
00277
00278
00279
00280
00281 template <class Cmpt>
00282 inline Vector<Cmpt> operator*(const Tensor<Cmpt>& t)
00283 {
00284 return Vector<Cmpt>(t.yz(), -t.xz(), t.xy());
00285 }
00286
00287
00288
00289 template <class Cmpt>
00290 inline Tensor<Cmpt> operator*(const Vector<Cmpt>& v)
00291 {
00292 return Tensor<Cmpt>
00293 (
00294 0, -v.z(), v.y(),
00295 v.z(), 0, -v.x(),
00296 -v.y(), v.x(), 0
00297 );
00298 }
00299
00300
00301
00302 template <class Cmpt>
00303 inline typename innerProduct<Tensor<Cmpt>, Tensor<Cmpt> >::type
00304 operator&(const Tensor<Cmpt>& t1, const Tensor<Cmpt>& t2)
00305 {
00306 return Tensor<Cmpt>
00307 (
00308 t1.xx()*t2.xx() + t1.xy()*t2.yx() + t1.xz()*t2.zx(),
00309 t1.xx()*t2.xy() + t1.xy()*t2.yy() + t1.xz()*t2.zy(),
00310 t1.xx()*t2.xz() + t1.xy()*t2.yz() + t1.xz()*t2.zz(),
00311
00312 t1.yx()*t2.xx() + t1.yy()*t2.yx() + t1.yz()*t2.zx(),
00313 t1.yx()*t2.xy() + t1.yy()*t2.yy() + t1.yz()*t2.zy(),
00314 t1.yx()*t2.xz() + t1.yy()*t2.yz() + t1.yz()*t2.zz(),
00315
00316 t1.zx()*t2.xx() + t1.zy()*t2.yx() + t1.zz()*t2.zx(),
00317 t1.zx()*t2.xy() + t1.zy()*t2.yy() + t1.zz()*t2.zy(),
00318 t1.zx()*t2.xz() + t1.zy()*t2.yz() + t1.zz()*t2.zz()
00319 );
00320 }
00321
00322
00323
00324 template <class Cmpt>
00325 inline typename innerProduct<Tensor<Cmpt>, Vector<Cmpt> >::type
00326 operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
00327 {
00328 return Vector<Cmpt>
00329 (
00330 t.xx()*v.x() + t.xy()*v.y() + t.xz()*v.z(),
00331 t.yx()*v.x() + t.yy()*v.y() + t.yz()*v.z(),
00332 t.zx()*v.x() + t.zy()*v.y() + t.zz()*v.z()
00333 );
00334 }
00335
00336
00337
00338 template <class Cmpt>
00339 inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt> >::type
00340 operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
00341 {
00342 return Vector<Cmpt>
00343 (
00344 v.x()*t.xx() + v.y()*t.yx() + v.z()*t.zx(),
00345 v.x()*t.xy() + v.y()*t.yy() + v.z()*t.zy(),
00346 v.x()*t.xz() + v.y()*t.yz() + v.z()*t.zz()
00347 );
00348 }
00349
00350
00351
00352 template <class Cmpt>
00353 inline typename outerProduct<Vector<Cmpt>, Vector<Cmpt> >::type
00354 operator*(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
00355 {
00356 return Tensor<Cmpt>
00357 (
00358 v1.x()*v2.x(), v1.x()*v2.y(), v1.x()*v2.z(),
00359 v1.y()*v2.x(), v1.y()*v2.y(), v1.y()*v2.z(),
00360 v1.z()*v2.x(), v1.z()*v2.y(), v1.z()*v2.z()
00361 );
00362 }
00363
00364
00365
00366 template <class Cmpt>
00367 inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt> >::type
00368 operator/(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
00369 {
00370 return inv(t) & v;
00371 }
00372
00373
00374
00375
00376
00377 template <class Cmpt>
00378 inline Cmpt tr(const Tensor<Cmpt>& t)
00379 {
00380 return t.xx() + t.yy() + t.zz();
00381 }
00382
00383
00384
00385 template <class Cmpt>
00386 inline SphericalTensor<Cmpt> sph(const Tensor<Cmpt>& t)
00387 {
00388 return (1.0/3.0)*tr(t);
00389 }
00390
00391
00392
00393 template <class Cmpt>
00394 inline SymmTensor<Cmpt> symm(const Tensor<Cmpt>& t)
00395 {
00396 return SymmTensor<Cmpt>
00397 (
00398 t.xx(), 0.5*(t.xy() + t.yx()), 0.5*(t.xz() + t.zx()),
00399 t.yy(), 0.5*(t.yz() + t.zy()),
00400 t.zz()
00401 );
00402 }
00403
00404
00405
00406 template <class Cmpt>
00407 inline SymmTensor<Cmpt> twoSymm(const Tensor<Cmpt>& t)
00408 {
00409 return SymmTensor<Cmpt>
00410 (
00411 2*t.xx(), (t.xy() + t.yx()), (t.xz() + t.zx()),
00412 2*t.yy(), (t.yz() + t.zy()),
00413 2*t.zz()
00414 );
00415 }
00416
00417
00418
00419 template <class Cmpt>
00420 inline Tensor<Cmpt> skew(const Tensor<Cmpt>& t)
00421 {
00422 return Tensor<Cmpt>
00423 (
00424 0.0, 0.5*(t.xy() - t.yx()), 0.5*(t.xz() - t.zx()),
00425 0.5*(t.yx() - t.xy()), 0.0, 0.5*(t.yz() - t.zy()),
00426 0.5*(t.zx() - t.xz()), 0.5*(t.zy() - t.yz()), 0.0
00427 );
00428 }
00429
00430
00431
00432 template <class Cmpt>
00433 inline const Tensor<Cmpt>& skew(const SymmTensor<Cmpt>& st)
00434 {
00435 return Tensor<Cmpt>::zero;
00436 }
00437
00438
00439
00440 template <class Cmpt>
00441 inline Tensor<Cmpt> dev(const Tensor<Cmpt>& t)
00442 {
00443 return t - SphericalTensor<Cmpt>::oneThirdI*tr(t);
00444 }
00445
00446
00447
00448 template <class Cmpt>
00449 inline Tensor<Cmpt> dev2(const Tensor<Cmpt>& t)
00450 {
00451 return t - SphericalTensor<Cmpt>::twoThirdsI*tr(t);
00452 }
00453
00454
00455
00456 template <class Cmpt>
00457 inline Cmpt det(const Tensor<Cmpt>& t)
00458 {
00459 return
00460 (
00461 t.xx()*t.yy()*t.zz() + t.xy()*t.yz()*t.zx()
00462 + t.xz()*t.yx()*t.zy() - t.xx()*t.yz()*t.zy()
00463 - t.xy()*t.yx()*t.zz() - t.xz()*t.yy()*t.zx()
00464 );
00465 }
00466
00467
00468
00469 template <class Cmpt>
00470 inline Tensor<Cmpt> cof(const Tensor<Cmpt>& t)
00471 {
00472 return Tensor<Cmpt>
00473 (
00474 t.yy()*t.zz() - t.zy()*t.yz(),
00475 t.zx()*t.yz() - t.yx()*t.zz(),
00476 t.yx()*t.zy() - t.yy()*t.zx(),
00477
00478 t.xz()*t.zy() - t.xy()*t.zz(),
00479 t.xx()*t.zz() - t.xz()*t.zx(),
00480 t.xy()*t.zx() - t.xx()*t.zy(),
00481
00482 t.xy()*t.yz() - t.xz()*t.yy(),
00483 t.yx()*t.xz() - t.xx()*t.yz(),
00484 t.xx()*t.yy() - t.yx()*t.xy()
00485 );
00486 }
00487
00488
00489
00490 template <class Cmpt>
00491 inline Tensor<Cmpt> inv(const Tensor<Cmpt>& t, const Cmpt dett)
00492 {
00493 return Tensor<Cmpt>
00494 (
00495 t.yy()*t.zz() - t.zy()*t.yz(),
00496 t.xz()*t.zy() - t.xy()*t.zz(),
00497 t.xy()*t.yz() - t.xz()*t.yy(),
00498
00499 t.zx()*t.yz() - t.yx()*t.zz(),
00500 t.xx()*t.zz() - t.xz()*t.zx(),
00501 t.yx()*t.xz() - t.xx()*t.yz(),
00502
00503 t.yx()*t.zy() - t.yy()*t.zx(),
00504 t.xy()*t.zx() - t.xx()*t.zy(),
00505 t.xx()*t.yy() - t.yx()*t.xy()
00506 )/dett;
00507 }
00508
00509
00510
00511 template <class Cmpt>
00512 inline Tensor<Cmpt> inv(const Tensor<Cmpt>& t)
00513 {
00514 return inv(t, det(t));
00515 }
00516
00517
00518
00519 template <class Cmpt>
00520 inline Cmpt invariantI(const Tensor<Cmpt>& t)
00521 {
00522 return tr(t);
00523 }
00524
00525
00526
00527 template <class Cmpt>
00528 inline Cmpt invariantII(const Tensor<Cmpt>& t)
00529 {
00530 return
00531 (
00532 0.5*sqr(tr(t))
00533 - 0.5*
00534 (
00535 t.xx()*t.xx() + t.xy()*t.xy() + t.xz()*t.xz()
00536 + t.yx()*t.yx() + t.yy()*t.yy() + t.yz()*t.yz()
00537 + t.zx()*t.zx() + t.zy()*t.zy() + t.zz()*t.zz()
00538 )
00539 );
00540 }
00541
00542
00543
00544 template <class Cmpt>
00545 inline Cmpt invariantIII(const Tensor<Cmpt>& t)
00546 {
00547 return det(t);
00548 }
00549
00550
00551
00552
00553 template <class Cmpt>
00554 inline Tensor<Cmpt>
00555 operator+(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
00556 {
00557 return Tensor<Cmpt>
00558 (
00559 st1.ii() + t2.xx(), t2.xy(), t2.xz(),
00560 t2.yx(), st1.ii() + t2.yy(), t2.yz(),
00561 t2.zx(), t2.zy(), st1.ii() + t2.zz()
00562 );
00563 }
00564
00565
00566 template <class Cmpt>
00567 inline Tensor<Cmpt>
00568 operator+(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
00569 {
00570 return Tensor<Cmpt>
00571 (
00572 t1.xx() + st2.ii(), t1.xy(), t1.xz(),
00573 t1.yx(), t1.yy() + st2.ii(), t1.yz(),
00574 t1.zx(), t1.zy(), t1.zz() + st2.ii()
00575 );
00576 }
00577
00578
00579 template <class Cmpt>
00580 inline Tensor<Cmpt>
00581 operator-(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
00582 {
00583 return Tensor<Cmpt>
00584 (
00585 st1.ii() - t2.xx(), -t2.xy(), -t2.xz(),
00586 -t2.yx(), st1.ii() - t2.yy(), -t2.yz(),
00587 -t2.zx(), -t2.zy(), st1.ii() - t2.zz()
00588 );
00589 }
00590
00591
00592 template <class Cmpt>
00593 inline Tensor<Cmpt>
00594 operator-(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
00595 {
00596 return Tensor<Cmpt>
00597 (
00598 t1.xx() - st2.ii(), t1.xy(), t1.xz(),
00599 t1.yx(), t1.yy() - st2.ii(), t1.yz(),
00600 t1.zx(), t1.zy(), t1.zz() - st2.ii()
00601 );
00602 }
00603
00604
00605
00606 template <class Cmpt>
00607 inline Tensor<Cmpt>
00608 operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
00609 {
00610 return Tensor<Cmpt>
00611 (
00612 st1.ii()*t2.xx(), st1.ii()*t2.xy(), st1.ii()*t2.xz(),
00613 st1.ii()*t2.yx(), st1.ii()*t2.yy(), st1.ii()*t2.yz(),
00614 st1.ii()*t2.zx(), st1.ii()*t2.zy(), st1.ii()*t2.zz()
00615 );
00616 }
00617
00618
00619
00620 template <class Cmpt>
00621 inline Tensor<Cmpt>
00622 operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
00623 {
00624 return Tensor<Cmpt>
00625 (
00626 t1.xx()*st2.ii(), t1.xy()*st2.ii(), t1.xz()*st2.ii(),
00627 t1.yx()*st2.ii(), t1.yy()*st2.ii(), t1.yz()*st2.ii(),
00628 t1.zx()*st2.ii(), t1.zy()*st2.ii(), t1.zz()*st2.ii()
00629 );
00630 }
00631
00632
00633
00634 template <class Cmpt>
00635 inline Cmpt
00636 operator&&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
00637 {
00638 return(st1.ii()*t2.xx() + st1.ii()*t2.yy() + st1.ii()*t2.zz());
00639 }
00640
00641
00642
00643 template <class Cmpt>
00644 inline Cmpt
00645 operator&&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
00646 {
00647 return(t1.xx()*st2.ii() + t1.yy()*st2.ii() + t1.zz()*st2.ii());
00648 }
00649
00650 template<class Cmpt>
00651 class typeOfSum<SphericalTensor<Cmpt>, Tensor<Cmpt> >
00652 {
00653 public:
00654
00655 typedef Tensor<Cmpt> type;
00656 };
00657
00658 template<class Cmpt>
00659 class typeOfSum<Tensor<Cmpt>, SphericalTensor<Cmpt> >
00660 {
00661 public:
00662
00663 typedef Tensor<Cmpt> type;
00664 };
00665
00666 template<class Cmpt>
00667 class innerProduct<SphericalTensor<Cmpt>, Tensor<Cmpt> >
00668 {
00669 public:
00670
00671 typedef Tensor<Cmpt> type;
00672 };
00673
00674 template<class Cmpt>
00675 class innerProduct<Tensor<Cmpt>, SphericalTensor<Cmpt> >
00676 {
00677 public:
00678
00679 typedef Tensor<Cmpt> type;
00680 };
00681
00682
00683
00684
00685 template <class Cmpt>
00686 inline Tensor<Cmpt>
00687 operator+(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
00688 {
00689 return Tensor<Cmpt>
00690 (
00691 st1.xx() + t2.xx(), st1.xy() + t2.xy(), st1.xz() + t2.xz(),
00692 st1.xy() + t2.yx(), st1.yy() + t2.yy(), st1.yz() + t2.yz(),
00693 st1.xz() + t2.zx(), st1.yz() + t2.zy(), st1.zz() + t2.zz()
00694 );
00695 }
00696
00697
00698 template <class Cmpt>
00699 inline Tensor<Cmpt>
00700 operator+(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
00701 {
00702 return Tensor<Cmpt>
00703 (
00704 t1.xx() + st2.xx(), t1.xy() + st2.xy(), t1.xz() + st2.xz(),
00705 t1.yx() + st2.xy(), t1.yy() + st2.yy(), t1.yz() + st2.yz(),
00706 t1.zx() + st2.xz(), t1.zy() + st2.yz(), t1.zz() + st2.zz()
00707 );
00708 }
00709
00710
00711 template <class Cmpt>
00712 inline Tensor<Cmpt>
00713 operator-(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
00714 {
00715 return Tensor<Cmpt>
00716 (
00717 st1.xx() - t2.xx(), st1.xy() - t2.xy(), st1.xz() - t2.xz(),
00718 st1.xy() - t2.yx(), st1.yy() - t2.yy(), st1.yz() - t2.yz(),
00719 st1.xz() - t2.zx(), st1.yz() - t2.zy(), st1.zz() - t2.zz()
00720 );
00721 }
00722
00723
00724 template <class Cmpt>
00725 inline Tensor<Cmpt>
00726 operator-(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
00727 {
00728 return Tensor<Cmpt>
00729 (
00730 t1.xx() - st2.xx(), t1.xy() - st2.xy(), t1.xz() - st2.xz(),
00731 t1.yx() - st2.xy(), t1.yy() - st2.yy(), t1.yz() - st2.yz(),
00732 t1.zx() - st2.xz(), t1.zy() - st2.yz(), t1.zz() - st2.zz()
00733 );
00734 }
00735
00736
00737
00738 template <class Cmpt>
00739 inline Tensor<Cmpt>
00740 operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
00741 {
00742 return Tensor<Cmpt>
00743 (
00744 st1.xx()*t2.xx() + st1.xy()*t2.yx() + st1.xz()*t2.zx(),
00745 st1.xx()*t2.xy() + st1.xy()*t2.yy() + st1.xz()*t2.zy(),
00746 st1.xx()*t2.xz() + st1.xy()*t2.yz() + st1.xz()*t2.zz(),
00747
00748 st1.xy()*t2.xx() + st1.yy()*t2.yx() + st1.yz()*t2.zx(),
00749 st1.xy()*t2.xy() + st1.yy()*t2.yy() + st1.yz()*t2.zy(),
00750 st1.xy()*t2.xz() + st1.yy()*t2.yz() + st1.yz()*t2.zz(),
00751
00752 st1.xz()*t2.xx() + st1.yz()*t2.yx() + st1.zz()*t2.zx(),
00753 st1.xz()*t2.xy() + st1.yz()*t2.yy() + st1.zz()*t2.zy(),
00754 st1.xz()*t2.xz() + st1.yz()*t2.yz() + st1.zz()*t2.zz()
00755 );
00756 }
00757
00758
00759
00760 template <class Cmpt>
00761 inline Tensor<Cmpt>
00762 operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
00763 {
00764 return Tensor<Cmpt>
00765 (
00766 t1.xx()*st2.xx() + t1.xy()*st2.xy() + t1.xz()*st2.xz(),
00767 t1.xx()*st2.xy() + t1.xy()*st2.yy() + t1.xz()*st2.yz(),
00768 t1.xx()*st2.xz() + t1.xy()*st2.yz() + t1.xz()*st2.zz(),
00769
00770 t1.yx()*st2.xx() + t1.yy()*st2.xy() + t1.yz()*st2.xz(),
00771 t1.yx()*st2.xy() + t1.yy()*st2.yy() + t1.yz()*st2.yz(),
00772 t1.yx()*st2.xz() + t1.yy()*st2.yz() + t1.yz()*st2.zz(),
00773
00774 t1.zx()*st2.xx() + t1.zy()*st2.xy() + t1.zz()*st2.xz(),
00775 t1.zx()*st2.xy() + t1.zy()*st2.yy() + t1.zz()*st2.yz(),
00776 t1.zx()*st2.xz() + t1.zy()*st2.yz() + t1.zz()*st2.zz()
00777 );
00778 }
00779
00780
00781
00782 template <class Cmpt>
00783 inline Cmpt
00784 operator&&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
00785 {
00786 return
00787 (
00788 st1.xx()*t2.xx() + st1.xy()*t2.xy() + st1.xz()*t2.xz() +
00789 st1.xy()*t2.yx() + st1.yy()*t2.yy() + st1.yz()*t2.yz() +
00790 st1.xz()*t2.zx() + st1.yz()*t2.zy() + st1.zz()*t2.zz()
00791 );
00792 }
00793
00794
00795
00796 template <class Cmpt>
00797 inline Cmpt
00798 operator&&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
00799 {
00800 return
00801 (
00802 t1.xx()*st2.xx() + t1.xy()*st2.xy() + t1.xz()*st2.xz() +
00803 t1.yx()*st2.xy() + t1.yy()*st2.yy() + t1.yz()*st2.yz() +
00804 t1.zx()*st2.xz() + t1.zy()*st2.yz() + t1.zz()*st2.zz()
00805 );
00806 }
00807
00808 template<class Cmpt>
00809 class typeOfSum<SymmTensor<Cmpt>, Tensor<Cmpt> >
00810 {
00811 public:
00812
00813 typedef Tensor<Cmpt> type;
00814 };
00815
00816 template<class Cmpt>
00817 class typeOfSum<Tensor<Cmpt>, SymmTensor<Cmpt> >
00818 {
00819 public:
00820
00821 typedef Tensor<Cmpt> type;
00822 };
00823
00824
00825 template<class Cmpt>
00826 class innerProduct<SymmTensor<Cmpt>, Tensor<Cmpt> >
00827 {
00828 public:
00829
00830 typedef Tensor<Cmpt> type;
00831 };
00832
00833 template<class Cmpt>
00834 class innerProduct<Tensor<Cmpt>, SymmTensor<Cmpt> >
00835 {
00836 public:
00837
00838 typedef Tensor<Cmpt> type;
00839 };
00840
00841
00842
00843
00844 }
00845
00846