diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index aec5e8ffd3..aeb05000b7 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -841,7 +841,7 @@ Foam::label Foam::globalMeshData::findTransform << abort(FatalError); } - return globalIndexAndTransform::subtractTransformIndex + return globalTransforms().subtractTransformIndex ( remoteTransformI, localTransformI @@ -859,7 +859,6 @@ void Foam::globalMeshData::calcGlobalEdgeSlaves() const const edgeList& edges = coupledPatch().edges(); const globalIndex& globalEdgeNumbers = globalEdgeNumbering(); - const pointField& localPoints = coupledPatch().localPoints(); // The whole problem with deducting edge-connectivity from @@ -920,7 +919,11 @@ void Foam::globalMeshData::calcGlobalEdgeSlaves() const { forAll(pEdges1, j) { - if (pEdges0[i] == pEdges1[j] && pEdges0[i] != edgeI) + if + ( + pEdges0[i] == pEdges1[j] + && pEdges0[i] != globalEdgeNumbers.toGlobal(edgeI) + ) { // Found a shared edge. Now check if the endpoints // go through the same transformation. diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H index 08537ed3c9..94d0cf5715 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H @@ -470,6 +470,17 @@ public: const bool isPosition ); + //- Helper: synchronise data without transforms + template + static void syncData + ( + List& pointData, + const labelListList& slaves, + const labelListList& transformedSlaves, + const mapDistribute& slavesMap, + const CombineOp& cop + ); + // Coupled point to coupled points. Coupled points are // points on any coupled patch. diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshDataTemplates.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshDataTemplates.C index 2a853e5970..93005abcac 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshDataTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshDataTemplates.C @@ -90,6 +90,59 @@ void Foam::globalMeshData::syncData } +template +void Foam::globalMeshData::syncData +( + List& elems, + const labelListList& slaves, + const labelListList& transformedSlaves, + const mapDistribute& slavesMap, + const CombineOp& cop +) +{ + // Pull slave data onto master + slavesMap.distribute(elems); + + // Combine master data with slave data + forAll(slaves, i) + { + Type& elem = elems[i]; + + const labelList& slavePoints = slaves[i]; + const labelList& transformSlavePoints = transformedSlaves[i]; + + if (slavePoints.size()+transformSlavePoints.size() > 0) + { + // Combine master with untransformed slave data + forAll(slavePoints, j) + { + cop(elem, elems[slavePoints[j]]); + } + + // Combine master with transformed slave data + forAll(transformSlavePoints, j) + { + cop(elem, elems[transformSlavePoints[j]]); + } + + + // Copy result back to slave slots + forAll(slavePoints, j) + { + elems[slavePoints[j]] = elem; + } + forAll(transformSlavePoints, j) + { + elems[transformSlavePoints[j]] = elem; + } + } + } + + // Push slave-slot data back to slaves + slavesMap.reverseDistribute(elems.size(), elems); +} + + template void Foam::globalMeshData::syncPointData ( diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C index ce2b0cfc21..9a1954c507 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C @@ -125,7 +125,7 @@ bool Foam::globalPoints::mergeInfo const labelPairList& nbrInfo, const label localPointI, labelPairList& myInfo -) +) const { bool anyChanged = false; @@ -167,7 +167,7 @@ bool Foam::globalPoints::mergeInfo ); // Combine mine and nbr transform - label t = globalIndexAndTransform::mergeTransformIndex + label t = globalTransforms_.mergeTransformIndex ( nbrTransform, myTransform @@ -315,27 +315,6 @@ bool Foam::globalPoints::storeInitialInfo } -Foam::FixedList Foam::globalPoints::transformBits -( - const label transformIndex -) const -{ - label t = transformIndex; - - // Decode permutation as 3 integers - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Note: FixedList for speed reasons. - FixedList permutation; - permutation[0] = (t%3)-1; - t /= 3; - permutation[1] = (t%3)-1; - t /= 3; - permutation[2] = (t%3)-1; - - return permutation; -} - - void Foam::globalPoints::printProcPoints ( const labelList& patchToMeshPoint, @@ -352,7 +331,8 @@ void Foam::globalPoints::printProcPoints Pout<< " localpoint:"; Pout<< index; Pout<< " through transform:" - << trafoI << " bits:" << transformBits(trafoI); + << trafoI << " bits:" + << globalTransforms_.decodeTransformIndex(trafoI); if (procI == Pstream::myProcNo()) { diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H index b4cad63052..8b4372a89a 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H @@ -162,12 +162,12 @@ class globalPoints ) const; //- Merge info from neighbour into my data - static bool mergeInfo + bool mergeInfo ( const labelPairList& nbrInfo, const label localPointI, labelPairList& myInfo - ); + ) const; //- From mesh point to 'local point'. Is the mesh point itself // if meshToPatchPoint is empty. @@ -198,9 +198,7 @@ class globalPoints const label localPointI ); - //- Get the signs for the individual transforms - FixedList transformBits(const label transformIndex) const; - + //- Debug printing void printProcPoints ( const labelList& patchToMeshPoint, diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C index dc93a7dfeb..d135e2b73a 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C @@ -91,6 +91,43 @@ void Foam::syncTools::syncPointMap { const polyBoundaryMesh& patches = mesh.boundaryMesh(); + // Synchronize multiple shared points. + const globalMeshData& pd = mesh.globalData(); + + // Values on shared points. Keyed on global shared index. + Map sharedPointValues(0); + + if (pd.nGlobalPoints() > 0) + { + // meshPoint per local index + const labelList& sharedPtLabels = pd.sharedPointLabels(); + // global shared index per local index + const labelList& sharedPtAddr = pd.sharedPointAddr(); + + sharedPointValues.resize(sharedPtAddr.size()); + + // Fill my entries in the shared points + forAll(sharedPtLabels, i) + { + label meshPointI = sharedPtLabels[i]; + + typename Map::const_iterator fnd = + pointValues.find(meshPointI); + + if (fnd != pointValues.end()) + { + combine + ( + sharedPointValues, + cop, + sharedPtAddr[i], // index + fnd() // value + ); + } + } + } + + if (Pstream::parRun()) { PstreamBuffers pBufs(Pstream::nonBlocking); @@ -254,8 +291,6 @@ void Foam::syncTools::syncPointMap } // Synchronize multiple shared points. - const globalMeshData& pd = mesh.globalData(); - if (pd.nGlobalPoints() > 0) { // meshPoint per local index @@ -263,30 +298,6 @@ void Foam::syncTools::syncPointMap // global shared index per local index const labelList& sharedPtAddr = pd.sharedPointAddr(); - // Values on shared points. Keyed on global shared index. - Map sharedPointValues(sharedPtAddr.size()); - - - // Fill my entries in the shared points - forAll(sharedPtLabels, i) - { - label meshPointI = sharedPtLabels[i]; - - typename Map::const_iterator fnd = - pointValues.find(meshPointI); - - if (fnd != pointValues.end()) - { - combine - ( - sharedPointValues, - cop, - sharedPtAddr[i], // index - fnd() // value - ); - } - } - // Reduce on master. if (Pstream::parRun()) @@ -367,13 +378,7 @@ void Foam::syncTools::syncPointMap if (sharedFnd != sharedPointValues.end()) { - combine - ( - pointValues, - cop, - iter(), // index - sharedFnd() // value - ); + pointValues.set(iter(), sharedFnd()); } } } @@ -779,6 +784,23 @@ void Foam::syncTools::syncEdgeMap // // const polyBoundaryMesh& patches = mesh.boundaryMesh(); // +// // Synchronize multiple shared points. +// const globalMeshData& pd = mesh.globalData(); +// +// // Values on shared points. +// Field sharedPts(0); +// if (pd.nGlobalPoints() > 0) +// { +// // Values on shared points. +// sharedPts.setSize(pd.nGlobalPoints(), nullValue); +// +// forAll(pd.sharedPointLabels(), i) +// { +// label meshPointI = pd.sharedPointLabels()[i]; +// // Fill my entries in the shared points +// sharedPts[pd.sharedPointAddr()[i]] = pointValues[meshPointI]; +// } +// } // // if (Pstream::parRun()) // { @@ -899,16 +921,6 @@ void Foam::syncTools::syncEdgeMap // // if (pd.nGlobalPoints() > 0) // { -// // Values on shared points. -// Field sharedPts(pd.nGlobalPoints(), nullValue); -// -// forAll(pd.sharedPointLabels(), i) -// { -// label meshPointI = pd.sharedPointLabels()[i]; -// // Fill my entries in the shared points -// sharedPts[pd.sharedPointAddr()[i]] = pointValues[meshPointI]; -// } -// // // Combine on master. // Pstream::listCombineGather(sharedPts, cop); // Pstream::listCombineScatter(sharedPts); @@ -1208,6 +1220,8 @@ void Foam::syncTools::syncEdgePositions const globalMeshData& gd = mesh.globalData(); const labelList& meshEdges = gd.coupledPatchMeshEdges(); + const globalIndexAndTransform& git = gd.globalTransforms(); + const mapDistribute& map = gd.globalEdgeSlavesMap(); List cppFld(UIndirectList(edgeValues, meshEdges)); @@ -1216,8 +1230,8 @@ void Foam::syncTools::syncEdgePositions cppFld, gd.globalEdgeSlaves(), gd.globalEdgeTransformedSlaves(), - gd.globalEdgeSlavesMap(), - gd.globalTransforms(), + map, + git, cop, true //position? ); @@ -1505,140 +1519,28 @@ void Foam::syncTools::syncPointList << mesh.nPoints() << abort(FatalError); } - const polyBoundaryMesh& patches = mesh.boundaryMesh(); + const globalMeshData& gd = mesh.globalData(); + const labelList& meshPoints = gd.coupledPatch().meshPoints(); - if (Pstream::parRun()) + List cppFld(gd.globalPointSlavesMap().constructSize()); + forAll(meshPoints, i) { - PstreamBuffers pBufs(Pstream::nonBlocking); - - // Send - - forAll(patches, patchI) - { - if - ( - isA(patches[patchI]) - && patches[patchI].nPoints() > 0 - ) - { - const processorPolyPatch& procPatch = - refCast(patches[patchI]); - - List patchInfo(procPatch.nPoints()); - - const labelList& meshPts = procPatch.meshPoints(); - const labelList& nbrPts = procPatch.neighbPoints(); - - forAll(nbrPts, pointI) - { - label nbrPointI = nbrPts[pointI]; - patchInfo[nbrPointI] = pointValues[meshPts[pointI]]; - } - - UOPstream toNbr(procPatch.neighbProcNo(), pBufs); - toNbr << patchInfo; - } - } - - - pBufs.finishedSends(); - - // Receive and combine. - - forAll(patches, patchI) - { - if - ( - isA(patches[patchI]) - && patches[patchI].nPoints() > 0 - ) - { - const processorPolyPatch& procPatch = - refCast(patches[patchI]); - - List nbrPatchInfo(procPatch.nPoints()); - { - // We do not know the number of points on the other side - // so cannot use Pstream::read. - UIPstream fromNbr(procPatch.neighbProcNo(), pBufs); - fromNbr >> nbrPatchInfo; - } - - const labelList& meshPts = procPatch.meshPoints(); - - forAll(meshPts, pointI) - { - label meshPointI = meshPts[pointI]; - unsigned int pointVal = pointValues[meshPointI]; - cop(pointVal, nbrPatchInfo[pointI]); - pointValues[meshPointI] = pointVal; - } - } - } + cppFld[i] = pointValues[meshPoints[i]]; } - // Do the cyclics. - forAll(patches, patchI) + globalMeshData::syncData + ( + cppFld, + gd.globalPointSlaves(), + gd.globalPointTransformedSlaves(), + gd.globalPointSlavesMap(), + cop + ); + + // Extract back to mesh + forAll(meshPoints, i) { - if (isA(patches[patchI])) - { - const cyclicPolyPatch& cycPatch = - refCast(patches[patchI]); - - if (cycPatch.owner()) - { - // Owner does all. - - const edgeList& coupledPoints = cycPatch.coupledPoints(); - const labelList& meshPts = cycPatch.meshPoints(); - const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch(); - const labelList& nbrMeshPts = nbrPatch.meshPoints(); - - forAll(coupledPoints, i) - { - const edge& e = coupledPoints[i]; - label meshPoint0 = meshPts[e[0]]; - label meshPoint1 = nbrMeshPts[e[1]]; - - unsigned int val0 = pointValues[meshPoint0]; - unsigned int val1 = pointValues[meshPoint1]; - unsigned int t = val0; - - cop(val0, val1); - pointValues[meshPoint0] = val0; - cop(val1, t); - pointValues[meshPoint1] = val1; - } - } - } - } - - // Synchronize multiple shared points. - const globalMeshData& pd = mesh.globalData(); - - if (pd.nGlobalPoints() > 0) - { - // Values on shared points. Use unpacked storage for ease! - List sharedPts(pd.nGlobalPoints(), nullValue); - - forAll(pd.sharedPointLabels(), i) - { - label meshPointI = pd.sharedPointLabels()[i]; - // Fill my entries in the shared points - sharedPts[pd.sharedPointAddr()[i]] = pointValues[meshPointI]; - } - - // Combine on master. - Pstream::listCombineGather(sharedPts, cop); - Pstream::listCombineScatter(sharedPts); - - // Now we will all have the same information. Merge it back with - // my local information. - forAll(pd.sharedPointLabels(), i) - { - label meshPointI = pd.sharedPointLabels()[i]; - pointValues[meshPointI] = sharedPts[pd.sharedPointAddr()[i]]; - } + pointValues[meshPoints[i]] = cppFld[i]; } } @@ -1664,140 +1566,28 @@ void Foam::syncTools::syncEdgeList << mesh.nEdges() << abort(FatalError); } - const polyBoundaryMesh& patches = mesh.boundaryMesh(); + const globalMeshData& gd = mesh.globalData(); + const labelList& meshEdges = gd.coupledPatchMeshEdges(); - if (Pstream::parRun()) + List cppFld(gd.globalEdgeSlavesMap().constructSize()); + forAll(meshEdges, i) { - PstreamBuffers pBufs(Pstream::nonBlocking); - - // Send - - forAll(patches, patchI) - { - if - ( - isA(patches[patchI]) - && patches[patchI].nEdges() > 0 - ) - { - const processorPolyPatch& procPatch = - refCast(patches[patchI]); - - List patchInfo(procPatch.nEdges()); - - const labelList& meshEdges = procPatch.meshEdges(); - const labelList& neighbEdges = procPatch.neighbEdges(); - - forAll(neighbEdges, edgeI) - { - label nbrEdgeI = neighbEdges[edgeI]; - patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]]; - } - - UOPstream toNbr(procPatch.neighbProcNo(), pBufs); - toNbr << patchInfo; - } - } - - pBufs.finishedSends(); - - // Receive and combine. - - forAll(patches, patchI) - { - if - ( - isA(patches[patchI]) - && patches[patchI].nEdges() > 0 - ) - { - const processorPolyPatch& procPatch = - refCast(patches[patchI]); - - // Receive from neighbour. - List nbrPatchInfo(procPatch.nEdges()); - - { - UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs); - fromNeighb >> nbrPatchInfo; - } - - const labelList& meshEdges = procPatch.meshEdges(); - - forAll(meshEdges, edgeI) - { - unsigned int patchVal = nbrPatchInfo[edgeI]; - label meshEdgeI = meshEdges[edgeI]; - unsigned int edgeVal = edgeValues[meshEdgeI]; - cop(edgeVal, patchVal); - edgeValues[meshEdgeI] = edgeVal; - } - } - } + cppFld[i] = edgeValues[meshEdges[i]]; } - // Do the cyclics. - forAll(patches, patchI) + globalMeshData::syncData + ( + cppFld, + gd.globalEdgeSlaves(), + gd.globalEdgeTransformedSlaves(), + gd.globalEdgeSlavesMap(), + cop + ); + + // Extract back to mesh + forAll(meshEdges, i) { - if (isA(patches[patchI])) - { - const cyclicPolyPatch& cycPatch = - refCast(patches[patchI]); - - if (cycPatch.owner()) - { - // Owner does all. - const edgeList& coupledEdges = cycPatch.coupledEdges(); - const labelList& meshEdges = cycPatch.meshEdges(); - const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch(); - const labelList& nbrMeshEdges = nbrPatch.meshEdges(); - - forAll(coupledEdges, i) - { - const edge& e = coupledEdges[i]; - - label edge0 = meshEdges[e[0]]; - label edge1 = nbrMeshEdges[e[1]]; - - unsigned int val0 = edgeValues[edge0]; - unsigned int t = val0; - unsigned int val1 = edgeValues[edge1]; - - cop(t, val1); - edgeValues[edge0] = t; - cop(val1, val0); - edgeValues[edge1] = val1; - } - } - } - } - - // Synchronize multiple shared edges. - const globalMeshData& pd = mesh.globalData(); - - if (pd.nGlobalEdges() > 0) - { - // Values on shared edges. Use unpacked storage for ease! - List sharedPts(pd.nGlobalEdges(), nullValue); - - forAll(pd.sharedEdgeLabels(), i) - { - label meshEdgeI = pd.sharedEdgeLabels()[i]; - // Fill my entries in the shared edges - sharedPts[pd.sharedEdgeAddr()[i]] = edgeValues[meshEdgeI]; - } - - // Combine on master. - Pstream::listCombineGather(sharedPts, cop); - Pstream::listCombineScatter(sharedPts); - - // Now we will all have the same information. Merge it back with - // my local information. - forAll(pd.sharedEdgeLabels(), i) - { - label meshEdgeI = pd.sharedEdgeLabels()[i]; - edgeValues[meshEdgeI] = sharedPts[pd.sharedEdgeAddr()[i]]; - } + edgeValues[meshEdges[i]] = cppFld[i]; } } diff --git a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.H b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.H index 556071d6ac..5b7d2fc238 100644 --- a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.H +++ b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.H @@ -138,11 +138,17 @@ private: bool checkBothSigns ) const; + //- Encode transform index. Hardcoded to 3 independent transforms max. + inline label encodeTransformIndex + ( + const FixedList& permutationIndices + ) const; + //- Decode transform index. Hardcoded to 3 independent transforms max. - inline static FixedList decodeTransformIndex + inline FixedList decodeTransformIndex ( const label transformIndex - ); + ) const; //- Disallow default bitwise copy construct globalIndexAndTransform(const globalIndexAndTransform&); @@ -153,6 +159,10 @@ private: public: + //- Declare friendship with the entry class for IO + friend class globalPoints; + + // Constructors //- Construct from components @@ -184,25 +194,25 @@ public: ) const; //- Combine two transformIndices - static inline label mergeTransformIndex + inline label mergeTransformIndex ( const label transformIndex0, const label transformIndex1 - ); + ) const; //- Combine two transformIndices - static inline label minimumTransformIndex + inline label minimumTransformIndex ( const label transformIndex0, const label transformIndex1 - ); + ) const; //- Subtract two transformIndices - static inline label subtractTransformIndex + inline label subtractTransformIndex ( const label transformIndex0, const label transformIndex1 - ); + ) const; //- Encode index and bare index as components on own processor inline static labelPair encode diff --git a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransformI.H b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransformI.H index 13d987bbaf..7de6eab86c 100644 --- a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransformI.H +++ b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransformI.H @@ -118,20 +118,56 @@ Foam::label Foam::globalIndexAndTransform::encodeTransformIndex } +Foam::label Foam::globalIndexAndTransform::encodeTransformIndex +( + const FixedList& permutation +) const +{ + if (nIndependentTransforms() == 0) + { + return 0; + } + if (nIndependentTransforms() == 1) + { + return permutation[0]+1; + } + else if (nIndependentTransforms() == 2) + { + return (permutation[1]+1)*3 + (permutation[0]+1); + } + else + { + return + (permutation[2]+1)*9 + + (permutation[1]+1)*3 + + (permutation[0]+1); + } +} + + Foam::FixedList Foam::globalIndexAndTransform::decodeTransformIndex ( const label transformIndex -) +) const { - FixedList permutation; + FixedList permutation(0); label t = transformIndex; - permutation[0] = (t%3)-1; - t /= 3; - permutation[1] = (t%3)-1; - t /= 3; - permutation[2] = (t%3)-1; + if (nIndependentTransforms() > 0) + { + permutation[0] = (t%3)-1; + if (nIndependentTransforms() > 1) + { + t /= 3; + permutation[1] = (t%3)-1; + if (nIndependentTransforms() > 2) + { + t /= 3; + permutation[2] = (t%3)-1; + } + } + } # ifdef FULLDEBUG t /= 3; @@ -222,10 +258,7 @@ Foam::label Foam::globalIndexAndTransform::addToTransformIndex // Re-encode permutation // ~~~~~~~~~~~~~~~~~~~~~ - return - (permutation[2]+1)*9 - + (permutation[1]+1)*3 - + (permutation[0]+1); + return encodeTransformIndex(permutation); } else { @@ -238,7 +271,7 @@ Foam::label Foam::globalIndexAndTransform::mergeTransformIndex ( const label transformIndex0, const label transformIndex1 -) +) const { FixedList permutation0 = decodeTransformIndex(transformIndex0); FixedList permutation1 = decodeTransformIndex(transformIndex1); @@ -269,10 +302,7 @@ Foam::label Foam::globalIndexAndTransform::mergeTransformIndex << exit(FatalError); } } - return - (permutation0[2]+1)*9 - + (permutation0[1]+1)*3 - + (permutation0[0]+1); + return encodeTransformIndex(permutation0); } @@ -280,7 +310,7 @@ Foam::label Foam::globalIndexAndTransform::minimumTransformIndex ( const label transformIndex0, const label transformIndex1 -) +) const { FixedList permutation0 = decodeTransformIndex(transformIndex0); FixedList permutation1 = decodeTransformIndex(transformIndex1); @@ -315,10 +345,7 @@ Foam::label Foam::globalIndexAndTransform::minimumTransformIndex << exit(FatalError); } } - return - (permutation0[2]+1)*9 - + (permutation0[1]+1)*3 - + (permutation0[0]+1); + return encodeTransformIndex(permutation0); } @@ -326,7 +353,7 @@ Foam::label Foam::globalIndexAndTransform::subtractTransformIndex ( const label transformIndex0, const label transformIndex1 -) +) const { FixedList permutation0 = decodeTransformIndex(transformIndex0); FixedList permutation1 = decodeTransformIndex(transformIndex1); @@ -336,10 +363,7 @@ Foam::label Foam::globalIndexAndTransform::subtractTransformIndex permutation0[i] -= permutation1[i]; } - return - (permutation0[2]+1)*9 - + (permutation0[1]+1)*3 - + (permutation0[0]+1); + return encodeTransformIndex(permutation0); }