30 bool Foam::globalIndexAndTransform::less::operator()
36 label procA = globalIndexAndTransform::processor(a);
37 label procB = globalIndexAndTransform::processor(
b);
43 else if (procA > procB)
50 label indexA = globalIndexAndTransform::index(a);
51 label indexB = globalIndexAndTransform::index(
b);
57 else if (indexA > indexB)
64 label transformA = globalIndexAndTransform::transformIndex(a);
65 label transformB = globalIndexAndTransform::transformIndex(
b);
67 return transformA < transformB;
73 Foam::label Foam::globalIndexAndTransform::encodeTransformIndex
78 if (permutationIndices.
size() != transforms_.size())
81 <<
"permutationIndices " << permutationIndices
82 <<
"are of a different size to the number of independent transforms" 86 label transformIndex = 0;
92 if (
mag(permutationIndices[
b]) > 1)
95 <<
"permutationIndices " << permutationIndices
96 <<
"are illegal, they must all be only -1, 0 or +1" 100 transformIndex += (permutationIndices[
b] + 1)*w;
105 return transformIndex;
109 Foam::label Foam::globalIndexAndTransform::encodeTransformIndex
120 return permutation[0]+1;
124 return (permutation[1]+1)*3 + (permutation[0]+1);
130 + (permutation[1]+1)*3
131 + (permutation[0]+1);
137 Foam::globalIndexAndTransform::decodeTransformIndex
139 const label transformIndex
147 permutation[0] = (t%3)-1;
151 permutation[1] = (t%3)-1;
155 permutation[2] = (t%3)-1;
165 <<
"transformIndex : " << transformIndex
166 <<
" has more than 3 fields." 177 const label transformIndex,
179 const bool isSendingSide,
189 if (matchTransI > -1 && matchTransI < 3)
205 if (permutation[matchTransI] != 0)
212 <<
" transform:" << matchTransI <<
" sign:" << sign
213 <<
" current transforms:" << permutation
216 else if (sign == permutation[matchTransI])
223 bool antiCyclic =
false;
226 if (
mag(vt.
t()) < SMALL && vt.
hasR())
229 scalar sumDiag =
tr(R);
232 if (
mag(sumMagDiag-3) < tol &&
mag(sumDiag+1) < tol)
241 permutation[matchTransI] = 0;
246 <<
"More than one patch accessing the same transform " 247 <<
"but not of the same sign." <<
endl 249 <<
" transform:" << matchTransI <<
" sign:" << sign
250 <<
" current transforms:" << permutation
256 permutation[matchTransI] = 0;
261 permutation[matchTransI] =
sign;
268 return encodeTransformIndex(permutation);
279 const label transformIndex0,
280 const label transformIndex1
283 if (transformIndex0 == transformIndex1)
285 return transformIndex0;
294 if (permutation0[i] != 0)
304 if (permutation1[i] != 0)
312 return transformIndex0;
316 return transformIndex1;
323 const label transformIndex0,
324 const label transformIndex1
332 permutation0[i] -= permutation1[i];
335 return encodeTransformIndex(permutation0);
342 const label transformIndex
353 const label transformIndex
356 if (transformIndex < 0 || transformIndex >= base_)
359 <<
"TransformIndex " << transformIndex
360 <<
" is outside allowed range of 0 to " 368 <<
"Overflow : encoding processor " << proci <<
" in base " << base_
369 <<
" exceeds capability of label (" <<
labelMax 370 <<
"). Please recompile with larger datatype for label." 377 transformIndex + proci*base_
387 return globalIAndTransform.
first();
396 return globalIAndTransform.
second()/base_;
405 return globalIAndTransform.
second() % base_;
411 return transforms_.size();
425 return transformPermutations_;
431 return nullTransformIndex_;
438 return patchTransformSign_;
460 if (patchis.
empty() || transforms_.empty())
462 return selectedTransformIs;
467 label patchi = iter.key();
473 if (matchTransI > -1)
478 if (permutation[matchTransI] != 0)
484 if (permutation[matchTransI] != sign)
487 <<
"More than one patch accessing the same transform " 488 <<
"but not of the same sign." 494 permutation[matchTransI] =
sign;
503 return selectedTransformIs;
511 selectedTransformIs.
setSize(nSelTrans);
517 selectedTransformIs[0] = encodeTransformIndex(permutation);
530 if (transforms_.size() > nUsedTrans)
532 if (permutation[0] == 0)
537 else if (permutation[1] == 0)
542 else if (permutation[2] == 0)
549 tempPermutation[a] = a;
550 tempPermutation[
b] = permutation[
b];
552 selectedTransformIs[0] = encodeTransformIndex(tempPermutation);
554 tempPermutation[a] = permutation[a];
555 tempPermutation[
b] = a;
557 selectedTransformIs[1] = encodeTransformIndex(tempPermutation);
559 tempPermutation[a] = permutation[a];
560 tempPermutation[
b] = permutation[
b];
562 selectedTransformIs[2] = encodeTransformIndex(tempPermutation);
570 tempPermutation[0] = 0;
571 tempPermutation[1] = 0;
572 tempPermutation[2] = permutation[2];
574 selectedTransformIs[0] = encodeTransformIndex(tempPermutation);
576 tempPermutation[0] = 0;
577 tempPermutation[1] = permutation[1];
578 tempPermutation[2] = 0;
580 selectedTransformIs[1] = encodeTransformIndex(tempPermutation);
582 tempPermutation[0] = 0;
583 tempPermutation[1] = permutation[1];
584 tempPermutation[2] = permutation[2];
586 selectedTransformIs[2] = encodeTransformIndex(tempPermutation);
588 tempPermutation[0] = permutation[0];
589 tempPermutation[1] = 0;
590 tempPermutation[2] = 0;
592 selectedTransformIs[3] = encodeTransformIndex(tempPermutation);
594 tempPermutation[0] = permutation[0];
595 tempPermutation[1] = 0;
596 tempPermutation[2] = permutation[2];
598 selectedTransformIs[4] = encodeTransformIndex(tempPermutation);
600 tempPermutation[0] = permutation[0];
601 tempPermutation[1] = permutation[1];
602 tempPermutation[2] = 0;
604 selectedTransformIs[5] = encodeTransformIndex(tempPermutation);
606 tempPermutation[0] = permutation[0];
607 tempPermutation[1] = permutation[1];
608 tempPermutation[2] = permutation[2];
610 selectedTransformIs[6] = encodeTransformIndex(tempPermutation);
617 <<
"Only 1-3 transforms are possible." 622 return selectedTransformIs;
640 transPts[tII] = transformPermutations_[transIs[tII]].transformPosition
dimensionedScalar sign(const dimensionedScalar &ds)
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A 1D vector of objects of type <T> with a fixed size <Size>.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void size(const label)
Override size to be inconsistent with allocated storage.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
const Type & second() const
Return second.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type & first() const
Return first.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
An ordered pair of two objects of type <T> with first() and second() elements.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Pair< label > labelPair
Label pair.
static const label labelMax
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
bool empty() const
Return true if the hash table is empty.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
void setSize(const label)
Reset size of List.
#define R(A, B, C, D, E, F, K, M)
dimensioned< scalar > mag(const dimensioned< Type > &)
const word & name() const
Return name.