Go to the documentation of this file.
28 #include <type_traits>
66 this->v_[XX] = st.
ii(); this->v_[XY] =
Zero; this->v_[XZ] =
Zero;
67 this->v_[YX] =
Zero; this->v_[YY] = st.
ii(); this->v_[YZ] =
Zero;
68 this->v_[ZX] =
Zero; this->v_[ZY] =
Zero; this->v_[ZZ] = st.
ii();
75 this->v_[XX] = st.
xx(); this->v_[XY] = st.
xy(); this->v_[XZ] = st.
xz();
76 this->v_[YX] = st.
xy(); this->v_[YY] = st.
yy(); this->v_[YZ] = st.
yz();
77 this->v_[ZX] = st.
xz(); this->v_[ZY] = st.
yz(); this->v_[ZZ] = st.
zz();
115 const Cmpt txx,
const Cmpt txy,
const Cmpt txz,
116 const Cmpt tyx,
const Cmpt tyy,
const Cmpt tyz,
117 const Cmpt tzx,
const Cmpt tzy,
const Cmpt tzz
120 this->v_[XX] = txx; this->v_[XY] = txy; this->v_[XZ] = txz;
121 this->v_[YX] = tyx; this->v_[YY] = tyy; this->v_[YZ] = tyz;
122 this->v_[ZX] = tzx; this->v_[ZY] = tzy; this->v_[ZZ] = tzz;
129 template<
class, Foam::direction, Foam::direction>
class Block2,
138 Tensor::msType(
block)
280 return Vector<Cmpt>(this->v_[XX], this->v_[XY], this->v_[XZ]);
287 return Vector<Cmpt>(this->v_[YX], this->v_[YY], this->v_[YZ]);
294 return Vector<Cmpt>(this->v_[ZX], this->v_[ZY], this->v_[ZZ]);
301 return Vector<Cmpt>(this->v_[XX], this->v_[YX], this->v_[ZX]);
308 return Vector<Cmpt>(this->v_[XY], this->v_[YY], this->v_[ZY]);
315 return Vector<Cmpt>(this->v_[XZ], this->v_[YZ], this->v_[ZZ]);
320 template<Foam::direction Col>
323 if (Col == 0)
return cx();
324 else if (Col == 1)
return cy();
325 else if (Col == 2)
return cz();
327 static_assert(Col < 3,
"Invalid column access");
337 case 0:
return cx();
break;
338 case 1:
return cy();
break;
339 case 2:
return cz();
break;
350 template<Foam::direction Row>
353 if (Row == 0)
return x();
354 else if (Row == 1)
return y();
355 else if (Row == 2)
return z();
357 static_assert(Row < 3,
"Invalid row access");
367 case 0:
return x();
break;
368 case 1:
return y();
break;
369 case 2:
return z();
break;
380 template<Foam::direction Col>
385 this->v_[XX] = v.
x();
386 this->v_[YX] = v.
y();
387 this->v_[ZX] = v.
z();
391 this->v_[XY] = v.
x();
392 this->v_[YY] = v.
y();
393 this->v_[ZY] = v.
z();
397 this->v_[XZ] = v.
x();
398 this->v_[YZ] = v.
y();
399 this->v_[ZZ] = v.
z();
402 static_assert(Col < 3,
"Invalid column access");
407 template<Foam::direction Row>
412 this->v_[XX] = v.
x(); this->v_[XY] = v.
y(); this->v_[XZ] = v.
z();
416 this->v_[YX] = v.
x(); this->v_[YY] = v.
y(); this->v_[YZ] = v.
z();
420 this->v_[ZX] = v.
x(); this->v_[ZY] = v.
y(); this->v_[ZZ] = v.
z();
423 static_assert(Row < 3,
"Invalid row access");
435 this->v_[XX] =
x.x(); this->v_[XY] =
y.x(); this->v_[XZ] = z.
x();
436 this->v_[YX] =
x.y(); this->v_[YY] =
y.y(); this->v_[YZ] = z.
y();
437 this->v_[ZX] =
x.z(); this->v_[ZY] =
y.z(); this->v_[ZZ] = z.
z();
449 this->v_[XX] =
x.x(); this->v_[XY] =
x.y(); this->v_[XZ] =
x.z();
450 this->v_[YX] =
y.x(); this->v_[YY] =
y.y(); this->v_[YZ] =
y.z();
451 this->v_[ZX] = z.
x(); this->v_[ZY] = z.
y(); this->v_[ZZ] = z.
z();
460 case 0: col<0>(v);
break;
461 case 1: col<1>(v);
break;
462 case 2: col<2>(v);
break;
476 case 0: row<0>(v);
break;
477 case 1: row<1>(v);
break;
478 case 2: row<2>(v);
break;
490 return Vector<Cmpt>(this->v_[XX], this->v_[YY], this->v_[ZZ]);
497 this->v_[XX] = v.
x(); this->v_[YY] = v.
y(); this->v_[ZZ] = v.
z();
558 *
this = this->inner(t);
563 template<
class Cmpt2>
576 this->v_[XX] = st.
ii(); this->v_[XY] =
Zero; this->v_[XZ] =
Zero;
577 this->v_[YX] =
Zero; this->v_[YY] = st.
ii(); this->v_[YZ] =
Zero;
578 this->v_[ZX] =
Zero; this->v_[ZY] =
Zero; this->v_[ZZ] = st.
ii();
585 this->v_[XX] = st.
xx(); this->v_[XY] = st.
xy(); this->v_[XZ] = st.
xz();
586 this->v_[YX] = st.
xy(); this->v_[YY] = st.
yy(); this->v_[YZ] = st.
yz();
587 this->v_[ZX] = st.
xz(); this->v_[ZY] = st.
yz(); this->v_[ZZ] = st.
zz();
594 this->v_[XX] =
tr.x().x();
595 this->v_[XY] =
tr.x().y();
596 this->v_[XZ] =
tr.x().z();
598 this->v_[YX] =
tr.y().x();
599 this->v_[YY] =
tr.y().y();
600 this->v_[YZ] =
tr.y().z();
602 this->v_[ZX] =
tr.z().x();
603 this->v_[ZY] =
tr.z().y();
604 this->v_[ZZ] =
tr.z().z();
619 return t.
xx() + t.
yy() + t.
zz();
640 t.
xx(), 0.5*(t.
xy() + t.
yx()), 0.5*(t.
xz() + t.
zx()),
641 t.
yy(), 0.5*(t.
yz() + t.
zy()),
653 2*t.
xx(), (t.
xy() + t.
yx()), (t.
xz() + t.
zx()),
654 2*t.
yy(), (t.
yz() + t.
zy()),
736 if (
mag(dett) < SMALL)
739 <<
"Tensor is not invertible due to the zero determinant:"
740 <<
"det(Tensor) = " <<
mag(dett)
745 return cof(t).
T()/dett;
802 st1.
ii() + t2.
xx(), t2.
xy(), t2.
xz(),
803 t2.
yx(), st1.
ii() + t2.
yy(), t2.
yz(),
804 t2.
zx(), t2.
zy(), st1.
ii() + t2.
zz()
816 t1.
xx() + st2.
ii(), t1.
xy(), t1.
xz(),
817 t1.
yx(), t1.
yy() + st2.
ii(), t1.
yz(),
818 t1.
zx(), t1.
zy(), t1.
zz() + st2.
ii()
830 st1.
xx() + t2.
xx(), st1.
xy() + t2.
xy(), st1.
xz() + t2.
xz(),
831 st1.
xy() + t2.
yx(), st1.
yy() + t2.
yy(), st1.
yz() + t2.
yz(),
832 st1.
xz() + t2.
zx(), st1.
yz() + t2.
zy(), st1.
zz() + t2.
zz()
844 t1.
xx() + st2.
xx(), t1.
xy() + st2.
xy(), t1.
xz() + st2.
xz(),
845 t1.
yx() + st2.
xy(), t1.
yy() + st2.
yy(), t1.
yz() + st2.
yz(),
846 t1.
zx() + st2.
xz(), t1.
zy() + st2.
yz(), t1.
zz() + st2.
zz()
858 st1.
ii() - t2.
xx(), -t2.
xy(), -t2.
xz(),
859 -t2.
yx(), st1.
ii() - t2.
yy(), -t2.
yz(),
860 -t2.
zx(), -t2.
zy(), st1.
ii() - t2.
zz()
872 t1.
xx() - st2.
ii(), t1.
xy(), t1.
xz(),
873 t1.
yx(), t1.
yy() - st2.
ii(), t1.
yz(),
874 t1.
zx(), t1.
zy(), t1.
zz() - st2.
ii()
886 st1.
xx() - t2.
xx(), st1.
xy() - t2.
xy(), st1.
xz() - t2.
xz(),
887 st1.
xy() - t2.
yx(), st1.
yy() - t2.
yy(), st1.
yz() - t2.
yz(),
888 st1.
xz() - t2.
zx(), st1.
yz() - t2.
zy(), st1.
zz() - t2.
zz()
900 t1.
xx() - st2.
xx(), t1.
xy() - st2.
xy(), t1.
xz() - st2.
xz(),
901 t1.
yx() - st2.
xy(), t1.
yy() - st2.
yy(), t1.
yz() - st2.
yz(),
902 t1.
zx() - st2.
xz(), t1.
zy() - st2.
yz(), t1.
zz() - st2.
zz()
930 inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt>>
::type
947 <<
" is not divisible due to a zero value in Cmpt:"
964 inline typename innerProduct<Tensor<Cmpt>, Tensor<Cmpt>>
::type
1000 template<
class Cmpt>
1006 st1.
xx()*t2.
xx() + st1.
xy()*t2.
yx() + st1.
xz()*t2.
zx(),
1007 st1.
xx()*t2.
xy() + st1.
xy()*t2.
yy() + st1.
xz()*t2.
zy(),
1008 st1.
xx()*t2.
xz() + st1.
xy()*t2.
yz() + st1.
xz()*t2.
zz(),
1010 st1.
xy()*t2.
xx() + st1.
yy()*t2.
yx() + st1.
yz()*t2.
zx(),
1011 st1.
xy()*t2.
xy() + st1.
yy()*t2.
yy() + st1.
yz()*t2.
zy(),
1012 st1.
xy()*t2.
xz() + st1.
yy()*t2.
yz() + st1.
yz()*t2.
zz(),
1014 st1.
xz()*t2.
xx() + st1.
yz()*t2.
yx() + st1.
zz()*t2.
zx(),
1015 st1.
xz()*t2.
xy() + st1.
yz()*t2.
yy() + st1.
zz()*t2.
zy(),
1022 template<
class Cmpt>
1028 t1.
xx()*st2.
xx() + t1.
xy()*st2.
xy() + t1.
xz()*st2.
xz(),
1029 t1.
xx()*st2.
xy() + t1.
xy()*st2.
yy() + t1.
xz()*st2.
yz(),
1030 t1.
xx()*st2.
xz() + t1.
xy()*st2.
yz() + t1.
xz()*st2.
zz(),
1032 t1.
yx()*st2.
xx() + t1.
yy()*st2.
xy() + t1.
yz()*st2.
xz(),
1033 t1.
yx()*st2.
xy() + t1.
yy()*st2.
yy() + t1.
yz()*st2.
yz(),
1034 t1.
yx()*st2.
xz() + t1.
yy()*st2.
yz() + t1.
yz()*st2.
zz(),
1036 t1.
zx()*st2.
xx() + t1.
zy()*st2.
xy() + t1.
zz()*st2.
xz(),
1037 t1.
zx()*st2.
xy() + t1.
zy()*st2.
yy() + t1.
zz()*st2.
yz(),
1044 template<
class Cmpt>
1045 inline typename innerProduct<Tensor<Cmpt>, Vector<Cmpt>>
::type
1050 t.
xx()*v.
x() + t.
xy()*v.
y() + t.
xz()*v.
z(),
1051 t.
yx()*v.
x() + t.
yy()*v.
y() + t.
yz()*v.
z(),
1052 t.
zx()*v.
x() + t.
zy()*v.
y() + t.
zz()*v.
z()
1058 template<
class Cmpt>
1059 inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt>>
::type
1064 v.
x()*t.
xx() + v.
y()*t.
yx() + v.
z()*t.
zx(),
1065 v.
x()*t.
xy() + v.
y()*t.
yy() + v.
z()*t.
zy(),
1066 v.
x()*t.
xz() + v.
y()*t.
yz() + v.
z()*t.
zz()
1072 template<
class Cmpt>
1076 return (st1.
ii()*t2.
xx() + st1.
ii()*t2.
yy() + st1.
ii()*t2.
zz());
1081 template<
class Cmpt>
1085 return (t1.
xx()*st2.
ii() + t1.
yy()*st2.
ii() + t1.
zz()*st2.
ii());
1090 template<
class Cmpt>
1096 st1.
xx()*t2.
xx() + st1.
xy()*t2.
xy() + st1.
xz()*t2.
xz() +
1097 st1.
xy()*t2.
yx() + st1.
yy()*t2.
yy() + st1.
yz()*t2.
yz() +
1104 template<
class Cmpt>
1110 t1.
xx()*st2.
xx() + t1.
xy()*st2.
xy() + t1.
xz()*st2.
xz() +
1111 t1.
yx()*st2.
xy() + t1.
yy()*st2.
yy() + t1.
yz()*st2.
yz() +
1118 template<
class Cmpt>
1119 inline typename outerProduct<Vector<Cmpt>, Vector<Cmpt>>
::type
1124 v1.
x()*v2.
x(), v1.
x()*v2.
y(), v1.
x()*v2.
z(),
1125 v1.
y()*v2.
x(), v1.
y()*v2.
y(), v1.
y()*v2.
z(),
1126 v1.
z()*v2.
x(), v1.
z()*v2.
y(), v1.
z()*v2.
z()
1133 template<
class Cmpt>
1142 template<
class Cmpt>
1151 template<
class Cmpt>
1160 template<
class Cmpt>
1169 template<
class Cmpt>
1178 template<
class Cmpt>
1187 template<
class Cmpt>
1196 template<
class Cmpt>
A templated (3 x 3) tensor of objects of <T> derived from MatrixSpace.
const Cmpt & x() const
Access to the vector x component.
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
Creates a single block of cells from point coordinates, numbers of cells in each direction and an exp...
A templated (3 x 3) symmetric tensor of objects of <T>, effectively containing 6 elements,...
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Cmpt invariantIII(const SymmTensor< Cmpt > &st)
Return the 3rd invariant of a SymmTensor.
dimensionedTensor skew(const dimensionedTensor &dt)
Tensor< Cmpt > inv() const
Return inverse.
Vector< Cmpt > z() const
Extract vector for row 2.
tmp< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
Cmpt invariantI(const SymmTensor< Cmpt > &st)
Return the 1st invariant of a SymmTensor.
static constexpr const zero Zero
Global zero (0)
tmp< faMatrix< Type > > operator-(const faMatrix< Type > &)
Tensor< Cmpt > inner(const Tensor< Cmpt > &t2) const
Inner-product of this with another Tensor.
Cmpt tr(const Tensor< Cmpt > &t)
Return the trace of a Tensor.
Vector< Cmpt > cy() const
Extract vector for column 1.
dimensionedSymmTensor dev2(const dimensionedSymmTensor &dt)
dimensioned< Type > T() const
Return transpose.
const Cmpt & z() const
Access to the vector z component.
Vector< Cmpt > row() const
Extract vector for given row.
Tensor & operator=(const Tensor &)=default
Copy assignment.
void operator&=(const Tensor< Cmpt > &t)
Assign inner-product of this with another Tensor.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Tensor< Cmpt > schur(const Tensor< Cmpt > &t2) const
Schur-product of this with another Tensor.
Vector< Cmpt > cz() const
Extract vector for column 2.
Vector< Cmpt > x() const
Extract vector for row 0.
Vector< Cmpt > diag() const
Extract the diagonal as a vector.
SphericalTensor< Cmpt > sph(const DiagTensor< Cmpt > &dt)
Return the spherical part of a DiagTensor as a SphericalTensor.
dimensioned< typename scalarProduct< Type1, Type2 >::type > operator&&(const dimensioned< Type1 > &, const dimensioned< Type2 > &)
Cmpt invariantII(const SymmTensor< Cmpt > &st)
Return the 2nd invariant of a SymmTensor.
errorManip< error > abort(error &err)
dimensionedSymmTensor cof(const dimensionedSymmTensor &dt)
A templated (3 x 3) diagonal tensor of objects of <T>, effectively containing 1 element,...
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
const Cmpt & y() const
Access to the vector y component.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Vector< Cmpt > y() const
Extract vector for row 1.
Vector< Cmpt > cx() const
Extract vector for column 0.
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
tmp< faMatrix< Type > > operator+(const faMatrix< Type > &, const faMatrix< Type > &)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
tmp< faMatrix< Type > > operator*(const areaScalarField &, const faMatrix< Type > &)
void cols(const Vector< Cmpt > &x, const Vector< Cmpt > &y, const Vector< Cmpt > &z)
Set column values.
Tensor()=default
Default construct.
Tensor< Cmpt > T() const
Return non-Hermitian transpose.
const dimensionedScalar c
Speed of light in a vacuum.
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
dimensionedScalar det(const dimensionedSphericalTensor &dt)
Vector< Cmpt > col() const
Extract vector for given column.
void rows(const Vector< Cmpt > &x, const Vector< Cmpt > &y, const Vector< Cmpt > &z)
Set row values.
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)