51 this->v_[XX] = st.
xx(); this->v_[XY] = st.
xy();
52 this->v_[YX] = st.
xy(); this->v_[YY] = st.
yy();
59 this->v_[XX] = st.
ii(); this->v_[XY] =
Zero;
60 this->v_[YX] =
Zero; this->v_[YY] = st.
ii();
71 this->v_[XX] =
x.x(); this->v_[XY] =
x.y();
72 this->v_[YX] =
y.x(); this->v_[YY] =
y.y();
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;
124 template<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;
152 template<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;
180 template<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");
199 template<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");
222 this->v_[XX] =
x.x(); this->v_[XY] =
y.x();
223 this->v_[YX] =
x.y(); this->v_[YY] =
y.y();
234 this->v_[XX] =
x.x(); this->v_[XY] =
x.y();
235 this->v_[YX] =
y.x(); this->v_[YY] =
y.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;
285 this->v_[XX] = v.
x(); this->v_[YY] = v.
y();
316 return (xx()*yy() - xy()*yx());
334 return this->adjunct().T();
373 const Cmpt detval = this->
det();
376 if (
mag(detval) < SMALL)
379 <<
"SymmTensor2D not properly invertible, determinant:" 380 << detval <<
" tensor:" << *
this <<
nl 385 return this->adjunct()/detval;
394 this->v_[XX] = st.
xx(); this->v_[XY] = st.
xy();
395 this->v_[YX] = st.
xy(); this->v_[YY] = st.
yy();
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()),
447 inline SymmTensor2D<Cmpt>
twoSymm(
const Tensor2D<Cmpt>& t)
451 t.xx() + t.xx(), t.xy() + t.yx(),
459 inline 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 471 inline Tensor2D<Cmpt>
dev(
const Tensor2D<Cmpt>& t)
495 inline Tensor2D<Cmpt>
cof(
const Tensor2D<Cmpt>& t)
503 inline 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;
521 inline Tensor2D<Cmpt>
inv(
const Tensor2D<Cmpt>& t)
529 inline Cmpt
invariantI(
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()
612 inline Tensor2D<Cmpt>
613 operator-(
const Tensor2D<Cmpt>& t1,
const SphericalTensor2D<Cmpt>& st2)
617 t1.xx() - st2.ii(), t1.xy(),
618 t1.yx(), t1.yy() - st2.ii()
625 inline Tensor2D<Cmpt>
626 operator-(
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()
638 inline Tensor2D<Cmpt>
639 operator-(
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()
651 inline Tensor2D<Cmpt>
652 operator/(
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>
684 inline Tensor2D<Cmpt>
685 operator&(
const SphericalTensor2D<Cmpt>& st1,
const Tensor2D<Cmpt>& t2)
687 return Tensor2D<Cmpt>
699 inline Tensor2D<Cmpt>
700 operator&(
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(),
731 inline Tensor2D<Cmpt>
732 operator&(
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()
775 operator&&(
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());
793 operator&&(
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()
806 operator&&(
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()
818 inline typename outerProduct<Vector2D<Cmpt>, Vector2D<Cmpt>>
::type 819 operator*(
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()
849 class innerProduct<Tensor2D<Cmpt>, Tensor2D<Cmpt>>
857 class innerProduct<SphericalTensor2D<Cmpt>, Tensor2D<Cmpt>>
861 typedef Tensor2D<Cmpt>
type;
873 class innerProduct<Tensor2D<Cmpt>, Vector2D<Cmpt>>
877 typedef Vector2D<Cmpt>
type;
890 class outerProduct<Vector2D<Cmpt>, Vector2D<Cmpt>>
Cmpt invariantII(const SymmTensor< Cmpt > &st)
Return the 2nd invariant of a SymmTensor.
Tensor2D< Cmpt > T() const
Return non-Hermitian transpose.
const Cmpt & xy() const noexcept
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const Cmpt & y() const noexcept
Access to the vector y component.
const Cmpt & xx() const noexcept
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const Cmpt & ii() const noexcept
dimensionedTensor skew(const dimensionedTensor &dt)
Vector2D< Cmpt > x() const
Extract vector for row 0.
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
Tensor2D< Cmpt > adjunct() const
Return adjunct matrix (transpose of cofactor matrix)
Tensor2D< Cmpt > schur(const Tensor2D< Cmpt > &t2) const
Schur-product of this with another Tensor2D.
const Cmpt & xy() const noexcept
dimensionSet operator &&(const dimensionSet &ds1, const dimensionSet &ds2)
Tensor2D< Cmpt > inv() const
Return inverse.
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
dimensionedScalar det(const dimensionedSphericalTensor &dt)
Vector2D< Cmpt > col() const
Extract vector for given column: compile-time check of index.
SphericalTensor< Cmpt > sph(const DiagTensor< Cmpt > &dt)
Return the spherical part of a DiagTensor as a SphericalTensor.
tmp< faMatrix< Type > > operator+(const faMatrix< Type > &, const faMatrix< Type > &)
Vector2D< Cmpt > y() const
Extract vector for row 1.
A templated (2 x 2) tensor of objects of <T> derived from VectorSpace.
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
const Cmpt & yy() const noexcept
const Cmpt & yx() const noexcept
scalar diagSqr() const
The L2-norm squared of the diagonal.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
Cmpt det() const
The determinate.
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
Tensor2D< Cmpt > inner(const Tensor2D< Cmpt > &t2) const
Inner-product of this with another Tensor2D.
Vector2D< Cmpt > cy() const
Extract vector for column 1.
void rows(const Vector2D< Cmpt > &x, const Vector2D< Cmpt > &y)
Set row values.
Vector2D< Cmpt > row() const
Extract vector for given row: compile-time check of index.
Tensor2D & operator=(const Tensor2D &)=default
Copy assignment.
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
errorManip< error > abort(error &err)
tmp< faMatrix< Type > > operator-(const faMatrix< Type > &)
Unary negation.
Vector2D< Cmpt > cx() const
Extract vector for column 0.
const Cmpt & x() const noexcept
Access to the vector x component.
void cols(const Vector2D< Cmpt > &x, const Vector2D< Cmpt > &y)
Set column values.
Tensor2D()=default
Default construct.
dimensionedSymmTensor dev2(const dimensionedSymmTensor &dt)
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
A templated (2 x 2) diagonal tensor of objects of <T>, effectively containing 1 element, derived from VectorSpace.
tmp< GeometricField< Type, faPatchField, areaMesh > > operator &(const faMatrix< Type > &, const DimensionedField< Type, areaMesh > &)
const Cmpt & xx() const noexcept
const dimensionedScalar c
Speed of light in a vacuum.
Cmpt invariantI(const SymmTensor< Cmpt > &st)
Return the 1st invariant of a SymmTensor.
A templated (2 x 2) symmetric tensor of objects of <T>, effectively containing 3 elements, derived from VectorSpace.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
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))
Templated 2D Vector derived from VectorSpace adding construction from 2 components, element access using x() and y() member functions and the inner-product (dot-product).
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) - 2 >::type type
const Cmpt & yy() const noexcept
dimensionedSymmTensor cof(const dimensionedSymmTensor &dt)
Vector2D< Cmpt > diag() const
Extract the diagonal as a vector.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Tensor2D< Cmpt > cof() const
Return cofactor matrix (transpose of adjunct matrix)
static constexpr const zero Zero
Global zero (0)