diff --git a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C index 1808fc84ab5b554a0af4aca1008d712de3586cb0..363000bad676bb4b17168ab4056093b6264ee71c 100644 --- a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C +++ b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C @@ -96,6 +96,7 @@ Foam::labelList Foam::decompositionMethod::decompose mesh, fineToCoarse, coarsePoints.size(), + true, // use global cell labels coarseCellCells ); @@ -158,6 +159,7 @@ void Foam::decompositionMethod::calcCellCells const polyMesh& mesh, const labelList& agglom, const label nCoarse, + const bool parallel, CompactListList<label>& cellCells ) { @@ -169,7 +171,7 @@ void Foam::decompositionMethod::calcCellCells // Create global cell numbers // ~~~~~~~~~~~~~~~~~~~~~~~~~~ - globalIndex globalAgglom(nCoarse); + globalIndex globalAgglom(nCoarse, Pstream::msgType(), parallel); // Get agglomerate owner on other side of coupled faces @@ -181,7 +183,7 @@ void Foam::decompositionMethod::calcCellCells { const polyPatch& pp = patches[patchI]; - if (pp.coupled()) + if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp))) { label faceI = pp.start(); label bFaceI = pp.start() - mesh.nInternalFaces(); @@ -203,77 +205,6 @@ void Foam::decompositionMethod::calcCellCells syncTools::swapBoundaryFaceList(mesh, globalNeighbour); - - //// Determine the cellCells (in agglomeration numbering) on coupled faces - //// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // - //labelListList globalCellCells(mesh.nFaces()-mesh.nInternalFaces()); - // - //// Current set of face neighbours for the current cell - //labelHashSet cCells; - // - //forAll(patches, patchI) - //{ - // const polyPatch& pp = patches[patchI]; - // - // if (pp.coupled()) - // { - // label faceI = pp.start(); - // label bFaceI = pp.start() - mesh.nInternalFaces(); - // - // forAll(pp, i) - // { - // label cellI = faceOwner[faceI]; - // label globalCellI = globalAgglom.toGlobal(agglom[cellI]); - // - // // First check if agglomerated across coupled patches at all - // // so we don't use memory if not needed - // if (globalNeighbour[bFaceI] == globalCellI) - // { - // cCells.clear(); - // - // const cell& cFaces = mesh.cells()[cellI]; - // - // forAll(cFaces, i) - // { - // if (mesh.isInternalFace(cFaces[i])) - // { - // label otherCellI = faceOwner[cFaces[i]]; - // if (otherCellI == cellI) - // { - // otherCellI = faceNeighbour[cFaces[i]]; - // } - // - // cCells.insert - // ( - // globalAgglom.toGlobal - // ( - // agglom[otherCellI] - // ) - // ); - // } - // } - // globalCellCells[bFaceI] = cCells.toc(); - // } - // - // bFaceI++; - // faceI++; - // } - // } - //} - // - //// Get the cell on the other side of coupled patches - //syncTools::syncBoundaryFaceList - //( - // mesh, - // globalCellCells, - // eqOp<labelList>(), - // dummyTransform() - //); - - - - // Count number of faces (internal + coupled) // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -293,7 +224,7 @@ void Foam::decompositionMethod::calcCellCells { const polyPatch& pp = patches[patchI]; - if (pp.coupled()) + if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp))) { label faceI = pp.start(); label bFaceI = pp.start()-mesh.nInternalFaces(); @@ -302,18 +233,6 @@ void Foam::decompositionMethod::calcCellCells { label own = agglom[faceOwner[faceI]]; - //const labelList& cCells = globalCellCells[bFaceI]; - // - //forAll(cCells, i) - //{ - // label globalNei = cCells[i]; - // - // // Allow only processor-local agglomeration - // if (globalAgglom.isLocal(globalNei)) - // { - // nFacesPerCell[own]++; - // } - //} label globalNei = globalNeighbour[bFaceI]; if ( @@ -365,18 +284,6 @@ void Foam::decompositionMethod::calcCellCells { label own = agglom[faceOwner[faceI]]; - //const labelList& cCells = globalCellCells[bFaceI]; - // - //forAll(cCells, i) - //{ - // label globalNei = cCells[i]; - // - // // Allow only processor-local agglomeration - // if (globalAgglom.isLocal(globalNei)) - // { - // m[offsets[own] + nFacesPerCell[own]++] = globalNei; - // } - //} label globalNei = globalNeighbour[bFaceI]; if ( diff --git a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.H b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.H index b81119fb0b204b2d8e23c697788c59819d37c83e..9e58cd5ddc9015f5f07a54da1557aef596181c79 100644 --- a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.H +++ b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.H @@ -57,15 +57,6 @@ protected: label nProcessors_; - //- Helper: determine (global) cellCells from mesh agglomeration. - static void calcCellCells - ( - const polyMesh& mesh, - const labelList& agglom, - const label nCoarse, - CompactListList<label>& cellCells - ); - private: // Private Member Functions @@ -224,6 +215,24 @@ public: const pointField& cc ); + + // Other + + //- Helper: determine (local or global) cellCells from mesh + // agglomeration. + // local : connections are in local indices. Coupled across + // cyclics but not processor patches. + // global : connections are in global indices. Coupled across + // cyclics and processor patches. + static void calcCellCells + ( + const polyMesh& mesh, + const labelList& agglom, + const label nCoarse, + const bool global, + CompactListList<label>& cellCells + ); + }; diff --git a/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C b/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C index 19ae049335608c0fce09323ed46b6f0e84b89e56..927df123abfbb74e6067087a2af4fcbed7aaa14e 100644 --- a/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C +++ b/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C @@ -383,7 +383,7 @@ Foam::labelList Foam::multiLevelDecomp::decompose ) { CompactListList<label> cellCells; - calcCellCells(mesh, identity(cc.size()), cc.size(), cellCells); + calcCellCells(mesh, identity(cc.size()), cc.size(), true, cellCells); labelField finalDecomp(cc.size(), 0); labelList cellMap(identity(cc.size())); diff --git a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C index b27b011e841004a7c799018c5f4be20749d092bb..54be6ad834a93dd7299f28079dde493ac349e213 100644 --- a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C +++ b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C @@ -755,7 +755,14 @@ Foam::labelList Foam::ptscotchDecomp::decompose CompactListList<label> cellCells; - calcCellCells(mesh, identity(mesh.nCells()), mesh.nCells(), cellCells); + calcCellCells + ( + mesh, + identity(mesh.nCells()), + mesh.nCells(), + true, + cellCells + ); // Decompose using default weights List<int> finalDecomp; @@ -807,7 +814,14 @@ Foam::labelList Foam::ptscotchDecomp::decompose // adjncy : contains neighbours (= edges in graph) // xadj(celli) : start of information in adjncy for celli CompactListList<label> cellCells; - calcCellCells(mesh, agglom, agglomPoints.size(), cellCells); + calcCellCells + ( + mesh, + agglom, + agglomPoints.size(), + true, + cellCells + ); // Decompose using weights List<int> finalDecomp; diff --git a/src/parallel/decompose/scotchDecomp/scotchDecomp.C b/src/parallel/decompose/scotchDecomp/scotchDecomp.C index ecfde107023300a8f7cf9d564dcd9d149e9e0670..d81af37b00a4acfb6471dfd3acd16637c59da1ec 100644 --- a/src/parallel/decompose/scotchDecomp/scotchDecomp.C +++ b/src/parallel/decompose/scotchDecomp/scotchDecomp.C @@ -589,7 +589,14 @@ Foam::labelList Foam::scotchDecomp::decompose // Calculate local or global (if Pstream::parRun()) connectivity CompactListList<label> cellCells; - calcCellCells(mesh, identity(mesh.nCells()), mesh.nCells(), cellCells); + calcCellCells + ( + mesh, + identity(mesh.nCells()), + mesh.nCells(), + true, + cellCells + ); // Decompose using default weights List<int> finalDecomp; @@ -634,7 +641,14 @@ Foam::labelList Foam::scotchDecomp::decompose // Calculate local or global (if Pstream::parRun()) connectivity CompactListList<label> cellCells; - calcCellCells(mesh, agglom, agglomPoints.size(), cellCells); + calcCellCells + ( + mesh, + agglom, + agglomPoints.size(), + true, + cellCells + ); // Decompose using weights List<int> finalDecomp;