From 968c01fd205f0a8cb79f9afca87aa4bd3bbe3f04 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 1 Aug 2013 13:14:01 +0100 Subject: [PATCH] ENH: reconstructParMesh: added -cellDist option like decomposePar --- .../reconstructParMesh/reconstructParMesh.C | 78 ++++++++++++++++++- 1 file changed, 74 insertions(+), 4 deletions(-) diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C index 3085ff1897..b223446c26 100644 --- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C +++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,6 +48,7 @@ Description #include "faceCoupleInfo.H" #include "fvMeshAdder.H" #include "polyTopoChange.H" +#include "zeroGradientFvPatchFields.H" using namespace Foam; @@ -297,6 +298,12 @@ int main(int argc, char *argv[]) "fullMatch", "do (slower) geometric matching on all boundary faces" ); + argList::addBoolOption + ( + "cellDist", + "write cell distribution as a labelList - for use with 'manual' " + "decomposition method or as a volScalarField for post-processing." + ); #include "addTimeOptions.H" #include "addRegionOption.H" @@ -362,6 +369,7 @@ int main(int argc, char *argv[]) << nl << "This assumes a correct decomposition." << endl; } + bool writeCellDist = args.optionFound("cellDist"); int nProcs = 0; @@ -507,7 +515,7 @@ int main(int argc, char *argv[]) { // Construct empty mesh. Info<< "Constructing empty mesh to add to." << nl << endl; - polyMesh masterMesh + fvMesh masterMesh ( IOobject ( @@ -528,7 +536,7 @@ int main(int argc, char *argv[]) << " for time = " << databases[procI].timeName() << nl << endl; - polyMesh meshToAdd + fvMesh meshToAdd ( IOobject ( @@ -560,7 +568,7 @@ int main(int argc, char *argv[]) // Add elements to mesh Info<< "Adding to master mesh" << nl << endl; - autoPtr map = polyMeshAdder::add + autoPtr map = fvMeshAdder::add ( masterMesh, meshToAdd, @@ -608,6 +616,67 @@ int main(int argc, char *argv[]) << "Failed writing polyMesh." << exit(FatalError); } + + + + if (writeCellDist) + { + // Write the decomposition as labelList for use with 'manual' + // decomposition method. + labelIOList cellDecomposition + ( + IOobject + ( + "cellDecomposition", + masterMesh.facesInstance(), + masterMesh, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + masterMesh.nCells() + ); + + forAll(cellProcAddressing, procI) + { + const labelList& pCells = cellProcAddressing[procI]; + UIndirectList