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;
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;
114 if (nIndependentTransforms() == 0)
118 if (nIndependentTransforms() == 1)
120 return permutation[0]+1;
122 else if (nIndependentTransforms() == 2)
124 return (permutation[1]+1)*3 + (permutation[0]+1);
130 + (permutation[1]+1)*3
131 + (permutation[0]+1);
139 const label transformIndex
144 label t = transformIndex;
145 if (nIndependentTransforms() > 0)
147 permutation[0] = (t%3)-1;
148 if (nIndependentTransforms() > 1)
151 permutation[1] = (t%3)-1;
152 if (nIndependentTransforms() > 2)
155 permutation[2] = (t%3)-1;
165 <<
"transformIndex : " << transformIndex
166 <<
" has more than 3 fields."
177 const label transformIndex,
179 const bool isSendingSide,
183 const Pair<label>& transSign = patchTransformSign_[patchI];
189 if (matchTransI > -1 && matchTransI < 3)
205 if (permutation[matchTransI] != 0)
211 <<
"patch:" << mesh_.boundaryMesh()[patchI].name()
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);
230 scalar sumMagDiag =
mag(
R.xx())+
mag(
R.yy())+
mag(
R.zz());
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
248 <<
"patch:" << mesh_.boundaryMesh()[patchI].
name()
249 <<
" transform:" << matchTransI <<
" sign:" <<
sign
250 <<
" current transforms:" << permutation
256 permutation[matchTransI] = 0;
261 permutation[matchTransI] =
sign;
268 return encodeTransformIndex(permutation);
272 return transformIndex;
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
345 return encode(Pstream::myProcNo(), index, 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_;
425 return transformPermutations_;
431 return nullTransformIndex_;
438 return patchTransformSign_;
447 return transformPermutations_[transformIndex];
460 if (patchIs.
empty() || transforms_.empty())
462 return selectedTransformIs;
467 label patchI = iter.key();
469 const Pair<label>& transSign = patchTransformSign_[patchI];
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;
632 labelList transIs = transformIndicesForPatches(patchIs);
640 transPts[tII] = transformPermutations_[transIs[tII]].transformPosition