52 void Foam::cyclicTransform::update()
54 if (!transformComplete_)
59 switch (transformType_)
69 if (rotationAngle_ == 0)
78 if (
mag(rotationCentre_) == 0)
93 if (
mag(separation_) == 0)
106 bool Foam::cyclicTransform::set
109 const scalar lengthScale,
110 const scalar matchTolerance
114 if (t.transformType_ == UNSPECIFIED)
121 if (transformType_ != UNSPECIFIED)
124 if (transformType_ != t.transformType_)
130 const scalar lengthTolerance = lengthScale*matchTolerance;
135 if (transformType_ == ROTATIONAL)
137 const scalar
dot = rotationAxis_ & t.rotationAxis_;
139 if (
mag(dot) < 1 - matchTolerance)
146 (rotationAxis_ & (rotationCentre_ - t.rotationCentre_))
153 if (transformComplete_ && t.transformComplete_)
168 if (transformType_ == TRANSLATIONAL)
170 if (transformComplete_ && t.transformComplete_)
172 if (
mag(separation_ - t.separation_) > lengthTolerance)
181 if (!transformComplete_ && t.transformComplete_)
200 const bool defaultIsNone
208 transformComplete_(transformType_ ==
NONE),
216 const bool defaultIsNone
225 {
"transformType",
"transform"},
249 {
"separation",
"separationVector"}
256 transformType_ ==
NONE 259 && dict.
found(
"rotationAngle")
263 && (dict.
found(
"separation") || dict.
found(
"separationVector"))
268 if (transformComplete_)
282 const scalar matchTolerance
291 const scalar lengthScale =
sqrt(
mag(area));
294 if (!transformComplete_ && nbrTransform.transformType_ !=
UNSPECIFIED)
296 if (!
set(
inv(nbrTransform), lengthScale, matchTolerance))
300 <<
" and neighbour patch " << nbrName
338 const scalar matchTolerance
353 if (areas.
size() == 0 || nbrAreas.
size() == 0)
return;
362 const point ctr =
sum(ctrs*magAreas)/
sum(magAreas);
363 const point nbrCtr =
sum(nbrCtrs*magNbrAreas)/
sum(magNbrAreas);
366 const scalar lengthScale =
sqrt(
sum(magAreas));
369 if (!transformComplete_)
379 const scalar
dot = normal & negNbrNormal;
388 :
mag(delta) > lengthScale*rootSmall
400 if (transformType_ != oldTransformType)
406 normal*(negNbrNormal & midNormal)
407 - negNbrNormal*(normal & midNormal)
411 ^ (normal - negNbrNormal);
416 mag(axis) > lengthScale*rootSmall
427 acos(
min(
max(normalPerpA & negNbrNormalPerpA, -1), 1));
429 -
sign((normalPerpA ^ negNbrNormalPerpA) & rotationAxis_)
433 if (transformType_ != oldTransformType)
444 rotationCentre_ =
inv(A) &
b;
456 transformComplete_ =
true;
462 Info<<
"Transformation calculated between patches " << name
473 const point nbrCtrT =
476 const scalar ctrNbrCtrTDistance =
mag(ctr - nbrCtrT);
478 if (ctrNbrCtrTDistance > lengthScale*matchTolerance)
481 <<
"The distance between the centre of patch " << name
482 <<
" and the transformed centre of patch " << nbrName <<
" is " 483 << ctrNbrCtrTDistance <<
"." 485 <<
"This is greater than the match tolerance of " 486 << lengthScale*matchTolerance <<
" for the patch." 488 <<
"Check that the patches are geometrically similar and that any " 489 <<
"transformations defined between them are correct" 491 <<
"It might be possible to fix this problem by increasing the " 492 <<
"\"matchTolerance\" setting for this patch in the boundary " 519 writeEntry(os,
"rotationAxis", rotationAxis_);
520 writeEntry(os,
"rotationCentre", rotationCentre_);
522 if (transformComplete_)
524 writeEntry(os,
"rotationAngle", rotationAngle_);
530 if (transformComplete_)
552 c1.rotationAxis_ =
normalised(t.transform(c1.rotationAxis_));
553 c1.rotationCentre_ = t.transformPosition(c1.rotationCentre_);
558 if (c1.transformComplete_)
560 c1.separation_ = t.transform(c1.separation_);
564 if (c1.transformComplete_)
579 if (c1.transformComplete_)
581 c1.rotationAngle_ = - c1.rotationAngle_;
587 if (c1.transformComplete_)
589 c1.separation_ = - c1.separation_;
593 if (c1.transformComplete_)
dimensionedScalar sign(const dimensionedScalar &ds)
dimensionedScalar acos(const dimensionedScalar &ds)
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#define forAll(list, i)
Loop across all elements in list.
tensor R() const
The rotation tensor corresponding the quaternion.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
scalar radToDeg(const scalar rad)
Conversion from radians to degrees.
Ostream & indent(Ostream &os)
Indent stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Unit conversion functions.
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
void size(const label)
Override size to be inconsistent with allocated storage.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m K].
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Initialise the NamedEnum HashTable from the static list of names.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
const dimensionedScalar c1
First radiation constant: default SI units: [W/m^2].
T lookupOrDefaultBackwardsCompatible(const wordList &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T, trying a list of keywords in sequence.
Form normalised(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
A class for handling words, derived from string.
dimensionSet cmptMag(const dimensionSet &)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
Quaternion class used to perform rotations in 3D space.
label findMax(const ListType &, const label start=0)
Find index of max element (and larger than given element).
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Istream and Ostream manipulators taking arguments.
defineTypeNameAndDebug(combustionModel, 0)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define R(A, B, C, D, E, F, K, M)
static Vector< scalar > uniform(const scalar &s)
Return a VectorSpace with all elements = s.
dimensioned< scalar > mag(const dimensioned< Type > &)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
ITstream & lookupBackwardsCompatible(const wordList &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream, trying a list of keywords.
virtual int precision() const =0
Get precision of output field.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.