42 v_((
sin(0.5*theta)/
mag(d))*d)
49 const scalar cosTheta,
53 scalar cosHalfTheta2 = 0.5*(cosTheta + 1);
54 w_ =
sqrt(cosHalfTheta2);
58 v_ =
sqrt(1 - cosHalfTheta2)*d;
62 v_ = (
sqrt(1 - cosHalfTheta2)/
mag(d))*d;
280 return *
this/
mag(*
this);
286 operator/=(
mag(*
this));
292 return quaternion(-(v() & u), w()*u + (v() ^ u));
304 return (
conjugate(*this).mulq0v(u)*(*
this)).v();
325 const scalar
w2 =
sqr(w());
326 const scalar x2 =
sqr(v().
x());
327 const scalar y2 =
sqr(v().
y());
328 const scalar z2 =
sqr(v().z());
330 const scalar txy = 2*v().x()*v().y();
331 const scalar twz = 2*w()*v().z();
332 const scalar txz = 2*v().x()*v().z();
333 const scalar twy = 2*w()*v().y();
334 const scalar tyz = 2*v().y()*v().z();
335 const scalar twx = 2*w()*v().x();
339 w2 + x2 - y2 - z2, txy - twz, txz + twy,
340 txy + twz,
w2 - x2 + y2 - z2, tyz - twx,
341 txz - twy, tyz + twx,
w2 - x2 - y2 + z2
377 const scalar
w2 =
sqr(w());
378 const scalar x2 =
sqr(v().
x());
379 const scalar y2 =
sqr(v().
y());
380 const scalar z2 =
sqr(v().z());
387 2*(v().
x()*v().
y() + w()*v().z()),
389 2*(w()*v().
y() - v().
x()*v().z()),
390 2*(v().
y()*v().z() + w()*v().
x()),
398 2*(v().
y()*v().z() - w()*v().
x()),
399 2*(v().
x()*v().z() + w()*v().
y()),
401 2*(v().
y()*v().z() + w()*v().
x()),
402 2*(w()*v().
y() - v().
x()*v().z())
409 2*(w()*v().z() - v().
x()*v().
y()),
411 2*(v().
y()*v().z() + w()*v().
x()),
412 2*(w()*v().
y() - v().
x()*v().z()),
420 2*(v().
x()*v().z() + w()*v().
y()),
421 2*(w()*v().
x() - v().
y()*v().z()),
423 2*(v().
x()*v().z() - w()*v().
y()),
424 2*(v().
y()*v().z() + w()*v().
x())
431 2*(v().
x()*v().z() + w()*v().
y()),
433 2*(w()*v().
x() - v().
y()*v().z()),
434 2*(v().
x()*v().
y() + w()*v().z()),
442 2*(v().
x()*v().
y() - w()*v().z()),
443 2*(v().
y()*v().z() + w()*v().
x()),
445 2*(v().
x()*v().
y() + w()*v().z()),
446 2*(w()*v().
x() - v().
y()*v().z())
453 2*(w()*v().
y() - v().
x()*v().z()),
455 2*(v().
x()*v().
y() + w()*v().z()),
456 2*(w()*v().
x() - v().
y()*v().z()),
464 2*(v().
y()*v().z() + w()*v().
x()),
465 2*(w()*v().z() - v().
x()*v().
y()),
467 2*(v().
y()*v().z() - w()*v().
x()),
468 2*(v().
x()*v().
y() + w()*v().z())
475 2*(w()*v().
x() - v().
y()*v().z()),
477 2*(v().
x()*v().z() + w()*v().
y()),
478 2*(w()*v().z() - v().
x()*v().
y()),
486 2*(v().
x()*v().
y() + w()*v().z()),
487 2*(w()*v().
y() - v().
x()*v().z()),
489 2*(v().
x()*v().
y() - w()*v().z()),
490 2*(v().
x()*v().z() + w()*v().
y())
497 2*(v().
y()*v().z() + w()*v().
x()),
499 2*(w()*v().z() - v().
x()*v().
y()),
500 2*(v().
x()*v().z() + w()*v().
y()),
508 2*(v().
x()*v().z() - w()*v().
y()),
509 2*(v().
x()*v().
y() + w()*v().z()),
511 2*(v().
x()*v().z() + w()*v().
y()),
512 2*(w()*v().z() - v().
x()*v().
y())
541 w() = w()*q.
w() - (v() & q.
v());
542 v() =
w0*q.
v() + q.
w()*v() + (v() ^ q.
v());
547 return operator*=(
inv(q));
598 scalar magSqrq =
magSqr(q);
629 return quaternion(q1.w() + q2.w(), q1.v() + q2.v());
645 return quaternion(q1.w() - q2.w(), q1.v() - q2.v());
651 return q1.
w()*q2.
w() + (q1.
v() & q2.
v());
663 q1.w()*q2.w() - (q1.v() & q2.v()),
664 q1.w()*q2.v() + q2.w()*q1.v() + (q1.v() ^ q2.v())
Quaternion class used to perform rotations in 3D space.
const vector & v() const
Vector part of the quaternion ( = axis of rotation)
quaternion normalised() const
quaternion()
Construct null.
vector eulerAngles(const rotationSequence rs) const
Return a vector of euler angles corresponding to the.
void operator-=(const quaternion &)
rotationSequence
Euler-angle rotation sequence.
tensor R() const
The rotation tensor corresponding the quaternion.
void operator+=(const quaternion &)
scalar w() const
Scalar part of the quaternion ( = cos(theta/2) for rotation)
static quaternion unit(const vector &v)
Return the unit quaternion (versor) from the given vector.
void operator*=(const quaternion &)
void operator=(const scalar)
vector transform(const vector &v) const
Rotate the given vector.
vector invTransform(const vector &v) const
Rotate the given vector anti-clockwise.
void operator/=(const quaternion &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const dimensionedScalar c2
Second radiation constant: default SI units: [m K].
bool operator!=(const particle &, const particle &)
bool equal(const T &s1, const T &s2)
dimensionedScalar asin(const dimensionedScalar &ds)
tensor rotationTensor(const vector &n1, const vector &n2)
Rotational transformation tensor from unit vector n1 to n2.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Tensor< scalar > tensor
Tensor of scalars.
errorManip< error > abort(error &err)
dimensionedScalar sin(const dimensionedScalar &ds)
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
Vector< scalar > vector
A scalar version of the templated Vector.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensionSet normalised(const dimensionSet &)
dimensioned< scalar > mag(const dimensioned< Type > &)
tmp< VolField< Type > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
tmp< fvMatrix< Type > > operator*(const volScalarField::Internal &, const fvMatrix< Type > &)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
quaternion conjugate(const quaternion &q)
Return the conjugate of the given quaternion.
quaternion normalise(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
tmp< fvMatrix< Type > > operator-(const fvMatrix< Type > &)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensionedScalar acos(const dimensionedScalar &ds)
tmp< fvMatrix< Type > > operator/(const fvMatrix< Type > &, const volScalarField::Internal &)