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;
177 const tensor& rotationTensor
182 + rotationTensor.
yy()
183 + rotationTensor.
zz();
190 v_[0] = (rotationTensor.
zy() - rotationTensor.
yz())*s;
191 v_[1] = (rotationTensor.
xz() - rotationTensor.
zx())*s;
192 v_[2] = (rotationTensor.
yx() - rotationTensor.
xy())*s;
198 rotationTensor.
xx() > rotationTensor.
yy()
199 && rotationTensor.
xx() > rotationTensor.
zz()
205 + rotationTensor.
xx()
206 - rotationTensor.
yy()
207 - rotationTensor.
zz()
210 w_ = (rotationTensor.
zy() - rotationTensor.
yz())/s;
212 v_[1] = (rotationTensor.
xy() + rotationTensor.
yx())/s;
213 v_[2] = (rotationTensor.
xz() + rotationTensor.
zx())/s;
217 rotationTensor.
yy() > rotationTensor.
zz()
223 + rotationTensor.
yy()
224 - rotationTensor.
xx()
225 - rotationTensor.
zz()
228 w_ = (rotationTensor.
xz() - rotationTensor.
xz())/s;
229 v_[0] = (rotationTensor.
xy() + rotationTensor.
yx())/s;
231 v_[2] = (rotationTensor.
yz() + rotationTensor.
zy())/s;
238 + rotationTensor.
zz()
239 - rotationTensor.
xx()
240 - rotationTensor.
yy()
243 w_ = (rotationTensor.
yx() - rotationTensor.
xy())/s;
244 v_[0] = (rotationTensor.
xz() + rotationTensor.
zx())/s;
245 v_[1] = (rotationTensor.
yz() + rotationTensor.
zy())/s;
280 return *
this/
mag(*
this);
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());
598 scalar magSqrq =
magSqr(q);
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())
tmp< fvMatrix< Type > > operator*(const volScalarField::Internal &, const fvMatrix< Type > &)
dimensionedScalar acos(const dimensionedScalar &ds)
tensor R() const
The rotation tensor corresponding the quaternion.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
static quaternion unit(const vector &v)
Return the unit quaternion (versor) from the given vector.
dimensionedScalar sqrt(const dimensionedScalar &ds)
scalar w() const
Scalar part of the quaternion ( = cos(theta/2) for rotation)
quaternion()
Construct null.
Vector< scalar > vector
A scalar version of the templated Vector.
tmp< fvMatrix< Type > > operator/(const fvMatrix< Type > &, const volScalarField::Internal &)
dimensionedScalar asin(const dimensionedScalar &ds)
void operator+=(const quaternion &)
tmp< GeometricField< Type, fvPatchField, volMesh > > operator &(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
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.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
quaternion conjugate(const quaternion &q)
Return the conjugate of the given quaternion.
dimensionedScalar cos(const dimensionedScalar &ds)
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
const vector & v() const
Vector part of the quaternion ( = axis of rotation)
Quaternion class used to perform rotations in 3D space.
tmp< fvMatrix< Type > > operator-(const fvMatrix< Type > &)
void operator=(const scalar)
errorManip< error > abort(error &err)
quaternion normalised() const
dimensioned< scalar > magSqr(const dimensioned< Type > &)
dimensionedScalar sin(const dimensionedScalar &ds)
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
quaternion normalise(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
void operator/=(const quaternion &)
vector eulerAngles(const rotationSequence rs) const
Return a vector of euler angles corresponding to the.
bool equal(const T &s1, const T &s2)
rotationSequence
Euler-angle rotation sequence.
dimensioned< scalar > mag(const dimensioned< Type > &)
vector invTransform(const vector &v) const
Rotate the given vector anti-clockwise.
bool operator!=(const particle &, const particle &)
Tensor< scalar > tensor
Tensor of scalars.
vector transform(const vector &v) const
Rotate the given vector.
void operator*=(const quaternion &)
void operator-=(const quaternion &)