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"
92 if (
mag(permutationIndices[
b]) > 1)
95 <<
"permutationIndices " << permutationIndices
96 <<
"are illegal, they must all be only -1, 0 or +1"
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);
195 scalar sumMagDiag =
mag(
T.xx()) +
mag(
T.yy()) +
mag(
T.zz());
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
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_;
409 return transformPermutations_[transformIndex];
418 labelList permutation(transforms_.size(), 0);
422 if (patchis.
empty() || transforms_.empty())
424 return selectedTransformIs;
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);
479 selectedTransformIs[0] = encodeTransformIndex(permutation);
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];
514 selectedTransformIs[0] = encodeTransformIndex(tempPermutation);
516 tempPermutation[a] = permutation[a];
517 tempPermutation[
b] = a;
519 selectedTransformIs[1] = encodeTransformIndex(tempPermutation);
521 tempPermutation[a] = permutation[a];
522 tempPermutation[
b] = permutation[
b];
524 selectedTransformIs[2] = encodeTransformIndex(tempPermutation);
532 tempPermutation[0] = 0;
533 tempPermutation[1] = 0;
534 tempPermutation[2] = permutation[2];
536 selectedTransformIs[0] = encodeTransformIndex(tempPermutation);
538 tempPermutation[0] = 0;
539 tempPermutation[1] = permutation[1];
540 tempPermutation[2] = 0;
542 selectedTransformIs[1] = encodeTransformIndex(tempPermutation);
544 tempPermutation[0] = 0;
545 tempPermutation[1] = permutation[1];
546 tempPermutation[2] = permutation[2];
548 selectedTransformIs[2] = encodeTransformIndex(tempPermutation);
550 tempPermutation[0] = permutation[0];
551 tempPermutation[1] = 0;
552 tempPermutation[2] = 0;
554 selectedTransformIs[3] = encodeTransformIndex(tempPermutation);
556 tempPermutation[0] = permutation[0];
557 tempPermutation[1] = 0;
558 tempPermutation[2] = permutation[2];
560 selectedTransformIs[4] = encodeTransformIndex(tempPermutation);
562 tempPermutation[0] = permutation[0];
563 tempPermutation[1] = permutation[1];
564 tempPermutation[2] = 0;
566 selectedTransformIs[5] = encodeTransformIndex(tempPermutation);
568 tempPermutation[0] = permutation[0];
569 tempPermutation[1] = permutation[1];
570 tempPermutation[2] = permutation[2];
572 selectedTransformIs[6] = encodeTransformIndex(tempPermutation);
579 <<
"Only 1-3 transforms are possible."
584 return selectedTransformIs;
594 labelList transIs = transformIndicesForPatches(patchis);
601 transformPermutations_[transIs[tII]].transformPosition(pt);
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
bool empty() const
Return true if the hash table is empty.
virtual const fileName & name() const
Return the name of the stream.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
const Type & second() const
Return second.
const Type & first() const
Return first.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Pair< label > labelPair
Label pair.
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
dimensionedScalar sign(const dimensionedScalar &ds)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
errorManip< error > abort(error &err)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensioned< scalar > mag(const dimensioned< Type > &)
static const label labelMax
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
static const label labelMin