79 const Cmpt txx,
const Cmpt txy,
80 const Cmpt tyx,
const Cmpt tyy
83 this->
v_[
XX] = txx; this->
v_[
XY] = txy;
84 this->
v_[
YX] = tyx; this->
v_[
YY] = tyy;
124template<Foam::direction Idx>
127 if (Idx == 0)
return cx();
128 else if (Idx == 1)
return cy();
130 static_assert(Idx < 2,
"Invalid column access");
140 case 0:
return cx();
break;
141 case 1:
return cy();
break;
152template<Foam::direction Idx>
155 if (Idx == 0)
return x();
156 else if (Idx == 1)
return y();
158 static_assert(Idx < 2,
"Invalid row access");
168 case 0:
return x();
break;
169 case 1:
return y();
break;
180template<Foam::direction Idx>
185 this->v_[XX] = v.
x();
186 this->v_[YX] = v.
y();
190 this->v_[XY] = v.
x();
191 this->v_[YY] = v.
y();
194 static_assert(Idx < 2,
"Invalid column access");
199template<Foam::direction Idx>
204 this->v_[XX] = v.
x(); this->v_[XY] = v.
y();
208 this->v_[YX] = v.
x(); this->v_[YY] = v.
y();
211 static_assert(Idx < 2,
"Invalid row access");
218 const Vector2D<Cmpt>&
x,
219 const Vector2D<Cmpt>&
y
248 case 0: col<0>(v);
break;
249 case 1: col<1>(v);
break;
261 const Vector2D<Cmpt>& v
266 case 0: row<0>(v);
break;
267 case 1: row<1>(v);
break;
373 const Cmpt detval = this->
det();
376 if (
mag(detval) < SMALL)
379 <<
"SymmTensor2D not properly invertible, determinant:"
380 << detval <<
" tensor:" << *
this <<
nl
402 this->v_[XX] = st.
ii(); this->v_[XY] =
Zero;
403 this->v_[YX] =
Zero; this->v_[YY] = st.
ii();
418 return t.
xx() + t.
yy();
439 t.
xx(), 0.5*(t.
xy() + t.
yx()),
447inline SymmTensor2D<Cmpt>
twoSymm(
const Tensor2D<Cmpt>& t)
451 t.xx() + t.xx(), t.xy() + t.yx(),
459inline Tensor2D<Cmpt>
skew(
const Tensor2D<Cmpt>& t)
461 return Tensor2D<Cmpt>
463 Zero, 0.5*(t.xy() - t.yx()),
464 0.5*(t.yx() - t.xy()),
Zero
471inline Tensor2D<Cmpt>
dev(
const Tensor2D<Cmpt>& t)
495inline Tensor2D<Cmpt>
cof(
const Tensor2D<Cmpt>& t)
503inline Tensor2D<Cmpt>
inv(
const Tensor2D<Cmpt>& t,
const Cmpt detval)
509 <<
"Tensor2D not properly invertible, determinant:"
510 << detval <<
" tensor:" << t <<
nl
515 return t.adjunct()/detval;
521inline Tensor2D<Cmpt>
inv(
const Tensor2D<Cmpt>& t)
552 st1.
ii() + t2.
xx(), t2.
xy(),
553 t2.
yx(), st1.
ii() + t2.
yy()
565 t1.
xx() + st2.
ii(), t1.
xy(),
566 t1.
yx(), t1.
yy() + st2.
ii()
578 st1.
xx() + t2.
xx(), st1.
xy() + t2.
xy(),
579 st1.
xy() + t2.
yx(), st1.
yy() + t2.
yy()
591 t1.
xx() + st2.
xx(), t1.
xy() + st2.
xy(),
592 t1.
yx() + st2.
xy(), t1.
yy() + st2.
yy()
604 st1.
ii() - t2.
xx(), -t2.
xy(),
605 -t2.
yx(), st1.
ii() - t2.
yy()
613operator-(
const Tensor2D<Cmpt>& t1,
const SphericalTensor2D<Cmpt>& st2)
617 t1.xx() - st2.ii(), t1.xy(),
618 t1.yx(), t1.yy() - st2.ii()
626operator-(
const SymmTensor2D<Cmpt>& st1,
const Tensor2D<Cmpt>& t2)
628 return Tensor2D<Cmpt>
630 st1.xx() - t2.xx(), st1.xy() - t2.xy(),
631 st1.xy() - t2.yx(), st1.yy() - t2.yy()
639operator-(
const Tensor2D<Cmpt>& t1,
const SymmTensor2D<Cmpt>& st2)
641 return Tensor2D<Cmpt>
643 t1.xx() - st2.xx(), t1.xy() - st2.xy(),
644 t1.yx() - st2.xy(), t1.yy() - st2.yy()
652operator/(
const Tensor2D<Cmpt>& t,
const Cmpt
s)
658 <<
"Tensor2D = " << t
659 <<
" is not divisible due to a zero value in Cmpt:"
665 return Tensor2D<Cmpt>
685operator&(
const SphericalTensor2D<Cmpt>& st1,
const Tensor2D<Cmpt>& t2)
687 return Tensor2D<Cmpt>
700operator&(
const Tensor2D<Cmpt>& t1,
const SphericalTensor2D<Cmpt>& st2)
702 return Tensor2D<Cmpt>
720 st1.
xx()*t2.
xx() + st1.
xy()*t2.
yx(),
721 st1.
xx()*t2.
xy() + st1.
xy()*t2.
yy(),
723 st1.
xy()*t2.
xx() + st1.
yy()*t2.
yx(),
732operator&(
const Tensor2D<Cmpt>& t1,
const SymmTensor2D<Cmpt>& st2)
734 return Tensor2D<Cmpt>
736 t1.xx()*st2.xx() + t1.xy()*st2.xy(),
737 t1.xx()*st2.xy() + t1.xy()*st2.yy(),
739 t1.yx()*st2.xx() + t1.yy()*st2.xy(),
740 t1.yx()*st2.xy() + t1.yy()*st2.yy()
753 t.
xx()*v.
x() + t.
xy()*v.
y(),
754 t.
yx()*v.
x() + t.
yy()*v.
y()
766 v.
x()*t.
xx() + v.
y()*t.
yx(),
767 v.
x()*t.
xy() + v.
y()*t.
yy()
775operator&&(
const SphericalTensor2D<Cmpt>& st1,
const Tensor2D<Cmpt>& t2)
777 return (st1.ii()*t2.xx() + st1.ii()*t2.yy());
786 return (t1.
xx()*st2.
ii() + t1.
yy()*st2.
ii());
793operator&&(
const SymmTensor2D<Cmpt>& st1,
const Tensor2D<Cmpt>& t2)
797 st1.xx()*t2.xx() + st1.xy()*t2.xy()
798 + st1.xy()*t2.yx() + st1.yy()*t2.yy()
806operator&&(
const Tensor2D<Cmpt>& t1,
const SymmTensor2D<Cmpt>& st2)
810 t1.xx()*st2.xx() + t1.xy()*st2.xy()
811 + t1.yx()*st2.xy() + t1.yy()*st2.yy()
818inline typename outerProduct<Vector2D<Cmpt>, Vector2D<Cmpt>>
::type
819operator*(
const Vector2D<Cmpt>& v1,
const Vector2D<Cmpt>& v2)
821 return Tensor2D<Cmpt>
823 v1.x()*v2.x(), v1.x()*v2.y(),
824 v1.y()*v2.x(), v1.y()*v2.y()
849class innerProduct<Tensor2D<Cmpt>, Tensor2D<Cmpt>>
857class innerProduct<SphericalTensor2D<Cmpt>, Tensor2D<Cmpt>>
861 typedef Tensor2D<Cmpt>
type;
873class innerProduct<Tensor2D<Cmpt>, Vector2D<Cmpt>>
877 typedef Vector2D<Cmpt>
type;
890class outerProduct<Vector2D<Cmpt>, Vector2D<Cmpt>>
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A templated (2 x 2) diagonal tensor of objects of <T>, effectively containing 1 element,...
const Cmpt & ii() const noexcept
A templated (2 x 2) symmetric tensor of objects of <T>, effectively containing 3 elements,...
const Cmpt & yy() const noexcept
const Cmpt & xx() const noexcept
const Cmpt & xy() const noexcept
A templated (2 x 2) tensor of objects of <T> derived from VectorSpace.
scalar diagSqr() const
The L2-norm squared of the diagonal.
const Cmpt & yy() const noexcept
Tensor2D< Cmpt > adjunct() const
Return adjunct matrix (transpose of cofactor matrix).
Vector2D< Cmpt > y() const
Extract vector for row 1.
Vector2D< Cmpt > cy() const
Extract vector for column 1.
void cols(const Vector2D< Cmpt > &x, const Vector2D< Cmpt > &y)
Set column values.
Tensor2D()=default
Default construct.
Vector2D< Cmpt > row() const
Extract vector for given row: compile-time check of index.
Tensor2D< Cmpt > schur(const Tensor2D< Cmpt > &t2) const
Schur-product of this with another Tensor2D.
const Cmpt & yx() const noexcept
Tensor2D< Cmpt > cof() const
Return cofactor matrix (transpose of adjunct matrix).
Vector2D< Cmpt > x() const
Extract vector for row 0.
void rows(const Vector2D< Cmpt > &x, const Vector2D< Cmpt > &y)
Set row values.
Tensor2D & operator=(const Tensor2D &)=default
Copy assignment.
Cmpt det() const
The determinate.
Vector2D< Cmpt > cx() const
Extract vector for column 0.
Tensor2D< Cmpt > T() const
Return non-Hermitian transpose.
Tensor2D< Cmpt > inv() const
Return inverse.
const Cmpt & xx() const noexcept
Vector2D< Cmpt > diag() const
Extract the diagonal as a vector.
const Cmpt & xy() const noexcept
Vector2D< Cmpt > col() const
Extract vector for given column: compile-time check of index.
Tensor2D< Cmpt > inner(const Tensor2D< Cmpt > &t2) const
Inner-product of this with another Tensor2D.
Templated 2D Vector derived from VectorSpace adding construction from 2 components,...
const Cmpt & x() const noexcept
Access to the vector x component.
const Cmpt & y() const noexcept
Access to the vector y component.
static const Tensor2D< Cmpt > zero
VectorSpace< Tensor2D< Cmpt >, Cmpt, Ncmpts > vsType
typeOfRank< typenamepTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) -2 >::type type
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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))
tmp< faMatrix< Type > > operator-(const faMatrix< Type > &)
Unary negation.
dimensionedSymmTensor dev2(const dimensionedSymmTensor &dt)
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
dimensionedScalar det(const dimensionedSphericalTensor &dt)
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
tmp< faMatrix< Type > > operator+(const faMatrix< Type > &, const faMatrix< Type > &)
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
Cmpt invariantII(const SymmTensor2D< Cmpt > &st)
Return the 2nd invariant of a SymmTensor2D.
Cmpt invariantI(const SymmTensor2D< Cmpt > &st)
Return the 1st invariant of a SymmTensor2D.
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
dimensionedSymmTensor cof(const dimensionedSymmTensor &dt)
tmp< GeometricField< Type, faPatchField, areaMesh > > operator&(const faMatrix< Type > &, const DimensionedField< Type, areaMesh > &)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
SphericalTensor< Cmpt > sph(const DiagTensor< Cmpt > &dt)
Return the spherical part of a DiagTensor as a SphericalTensor.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
dimensioned< typename scalarProduct< Type1, Type2 >::type > operator&&(const dimensioned< Type1 > &, const dimensioned< Type2 > &)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
dimensionedTensor skew(const dimensionedTensor &dt)
constexpr char nl
The newline '\n' character (0x0a).