30 bool Foam::globalIndexAndTransform::less::operator()
36 label procA = gi_.processor(a);
37 label procB = gi_.processor(
b);
43 else if (procA > procB)
50 label indexA = gi_.index(a);
51 label indexB = gi_.index(
b);
57 else if (indexA > indexB)
64 label transformA = gi_.transformIndex(a);
65 label transformB = gi_.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;
111 const label transformIndex
114 labelList permutation(transforms_.size(), 0);
116 label t = transformIndex;
119 permutation[i] = (t%3)-1;
129 const label transformIndex,
131 const bool isSendingSide,
139 if (matchTransI >= transforms_.size())
142 <<
"patch:" << mesh_.boundaryMesh()[
patchi].name()
143 <<
" transform:" << matchTransI
144 <<
" out of possible transforms:" << transforms_
148 else if (matchTransI == -1)
151 return transformIndex;
156 labelList permutation(decodeTransformIndex(transformIndex));
170 if (permutation[matchTransI] != 0)
176 <<
"patch:" << mesh_.boundaryMesh()[
patchi].name()
177 <<
" transform:" << matchTransI <<
" sign:" << sign
178 <<
" current transforms:" << permutation
181 else if (sign == permutation[matchTransI])
188 bool antiCyclic =
false;
194 scalar sumDiag =
tr(T);
197 if (
mag(sumMagDiag-3) < tol &&
mag(sumDiag+1) < tol)
206 permutation[matchTransI] = 0;
211 <<
"More than one patch accessing the same transform " 212 <<
"but not of the same sign." <<
endl 213 <<
"patch:" << mesh_.boundaryMesh()[
patchi].
name()
214 <<
" transform:" << matchTransI <<
" sign:" << sign
215 <<
" current transforms:" << permutation
221 permutation[matchTransI] = 0;
226 permutation[matchTransI] =
sign;
233 return encodeTransformIndex(permutation);
240 const label transformIndex0,
241 const label transformIndex1
244 if (transformIndex0 == transformIndex1)
246 return transformIndex0;
251 labelList permutation0(decodeTransformIndex(transformIndex0));
255 if (permutation0[i] != 0)
261 labelList permutation1(decodeTransformIndex(transformIndex1));
265 if (permutation1[i] != 0)
273 return transformIndex0;
277 return transformIndex1;
284 const label transformIndex0,
285 const label transformIndex1
288 labelList permutation0(decodeTransformIndex(transformIndex0));
289 labelList permutation1(decodeTransformIndex(transformIndex1));
293 permutation0[i] -= permutation1[i];
296 return encodeTransformIndex(permutation0);
303 const label transformIndex
306 return encode(Pstream::myProcNo(), index, transformIndex);
314 const label transformIndex
317 if (transformIndex < 0 || transformIndex >= transformPermutations_.size())
320 <<
"TransformIndex " << transformIndex
321 <<
" is outside allowed range of 0 to " 322 << transformPermutations_.size() - 1
326 if (proci >
labelMax/transformPermutations_.size())
329 <<
"Overflow : encoding processor " << proci
330 <<
" in base " << transformPermutations_.size()
331 <<
" exceeds capability of label (" <<
labelMax 332 <<
"). Please recompile with larger datatype for label." 339 transformIndex + proci*transformPermutations_.size()
349 return globalIAndTransform.
first();
358 return globalIAndTransform.
second()/transformPermutations_.size();
367 return globalIAndTransform.
second()%transformPermutations_.size();
373 return transforms_.size();
387 return transformPermutations_;
393 return nullTransformIndex_;
400 return patchTransformSign_;
418 labelList permutation(transforms_.size(), 0);
422 if (patchis.
empty() || transforms_.empty())
424 return selectedTransformIs;
429 label patchi = iter.key();
435 if (matchTransI > -1)
440 if (permutation[matchTransI] != 0)
446 if (permutation[matchTransI] != sign)
449 <<
"More than one patch accessing the same transform " 450 <<
"but not of the same sign." 456 permutation[matchTransI] =
sign;
465 return selectedTransformIs;
473 selectedTransformIs.setSize(nSelTrans);
492 if (transforms_.size() > nUsedTrans)
494 if (permutation[0] == 0)
499 else if (permutation[1] == 0)
504 else if (permutation[2] == 0)
511 tempPermutation[a] = a;
512 tempPermutation[
b] = permutation[
b];
516 tempPermutation[a] = permutation[a];
517 tempPermutation[
b] = a;
521 tempPermutation[a] = permutation[a];
522 tempPermutation[
b] = permutation[
b];
532 tempPermutation[0] = 0;
533 tempPermutation[1] = 0;
534 tempPermutation[2] = permutation[2];
538 tempPermutation[0] = 0;
539 tempPermutation[1] = permutation[1];
540 tempPermutation[2] = 0;
544 tempPermutation[0] = 0;
545 tempPermutation[1] = permutation[1];
546 tempPermutation[2] = permutation[2];
550 tempPermutation[0] = permutation[0];
551 tempPermutation[1] = 0;
552 tempPermutation[2] = 0;
556 tempPermutation[0] = permutation[0];
557 tempPermutation[1] = 0;
558 tempPermutation[2] = permutation[2];
562 tempPermutation[0] = permutation[0];
563 tempPermutation[1] = permutation[1];
564 tempPermutation[2] = 0;
568 tempPermutation[0] = permutation[0];
569 tempPermutation[1] = permutation[1];
570 tempPermutation[2] = permutation[2];
579 <<
"Only 1-3 transforms are possible." 584 return selectedTransformIs;
601 transformPermutations_[transIs[tII]].transformPosition(pt);
dimensionedScalar sign(const dimensionedScalar &ds)
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > 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)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
void size(const label)
Override size to be inconsistent with allocated storage.
bool empty() const
Return true if the hash table is empty.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m K].
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
An ordered pair of two objects of type <T> with first() and second() elements.
virtual const fileName & name() const
Return the name of the stream.
Pair< label > labelPair
Label pair.
static const label labelMax
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
errorManip< error > abort(error &err)
const Type & second() const
Return second.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensioned< scalar > mag(const dimensioned< Type > &)
const Type & first() const
Return first.
static const label labelMin