From 8ad1daeb7601b432033978985a772820cd5ad2a3 Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Sun, 6 Nov 2011 17:50:55 +0100 Subject: [PATCH] Enable decomposition of faMeshes & remove n-squared algorithmns --- .../decomposePar/decomposePar.C | 4 +- .../decomposePar/faMeshDecomposition.C | 80 ++++++++++--------- 2 files changed, 44 insertions(+), 40 deletions(-) diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index 4738e8621..b6fb439f3 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -910,8 +910,8 @@ int main(int argc, char *argv[]) IOobject faMeshBoundaryIOobj ( - "boundary", - mesh.time().findInstance(mesh.dbDir()/fvMesh::meshSubDir, "boundary"), + "faBoundary", + mesh.time().findInstance(mesh.dbDir()/faMesh::meshSubDir, "faBoundary"), faMesh::meshSubDir, mesh, IOobject::MUST_READ, diff --git a/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C index 833391b3c..3eab66e2d 100644 --- a/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C @@ -62,22 +62,25 @@ void faMeshDecomposition::distributeFaces() ) ); - labelIOList faceProcAddressing + labelHashSet faceProcAddressingHash ( - IOobject + labelIOList ( - "faceProcAddressing", - "constant", - procMesh.meshSubDir, - procMesh, - IOobject::MUST_READ, - IOobject::NO_WRITE + IOobject + ( + "faceProcAddressing", + "constant", + procMesh.meshSubDir, + procMesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) ) ); forAll (faceLabels(), faceI) { - if (findIndex(faceProcAddressing, faceLabels()[faceI] + 1) > -1) + if (faceProcAddressingHash.found(faceLabels()[faceI] + 1)) { faceToProc_[faceI] = procI; } @@ -209,18 +212,30 @@ void faMeshDecomposition::decomposeMesh(const bool filterEmptyPatches) ) ); - labelIOList fvFaceProcAddressing - ( - IOobject + HashTable > fvFaceProcAddressingHash; + + { + labelIOList fvFaceProcAddressing ( - "faceProcAddressing", - "constant", - procFvMesh.meshSubDir, - procFvMesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ); + IOobject + ( + "faceProcAddressing", + "constant", + procFvMesh.meshSubDir, + procFvMesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + forAll(fvFaceProcAddressing, faceI) + { + fvFaceProcAddressingHash.insert + ( + fvFaceProcAddressing[faceI], faceI + ); + } + }; const labelList& curProcFaceAddressing = procFaceAddressing_[procI]; @@ -231,11 +246,10 @@ void faMeshDecomposition::decomposeMesh(const bool filterEmptyPatches) forAll(curProcFaceAddressing, faceI) { curFaceLabels[faceI] = - findIndex + fvFaceProcAddressingHash.find ( - fvFaceProcAddressing, - faceLabels()[curProcFaceAddressing[faceI]]+1 - ); + faceLabels()[curProcFaceAddressing[faceI]] + 1 + )(); } // create processor finite area mesh @@ -248,8 +262,7 @@ void faMeshDecomposition::decomposeMesh(const bool filterEmptyPatches) const indirectPrimitivePatch& patch = this->patch(); const Map