diff --git a/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructor.H b/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructor.H index 201ce66811..71ac334133 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructor.H +++ b/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructor.H @@ -151,18 +151,20 @@ public: const IOobject& fieldIoObject ); - //- Reconstruct and write all volume fields + //- Reconstruct and write all/selected volume fields template void reconstructFvVolumeFields ( - const IOobjectList& objects + const IOobjectList& objects, + const HashSet& selectedFields ); - //- Reconstruct and write all volume fields + //- Reconstruct and write all/selected volume fields template void reconstructFvSurfaceFields ( - const IOobjectList& objects + const IOobjectList& objects, + const HashSet& selectedFields ); }; diff --git a/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructorReconstructFields.C b/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructorReconstructFields.C index 06f4f6a634..2ad0735ccf 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructorReconstructFields.C +++ b/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructorReconstructFields.C @@ -131,7 +131,7 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField forAll(cp, faceI) { // Subtract one to take into account offsets for - // face direction. + // face direction. reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart; } @@ -151,7 +151,7 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField forAll(cp, faceI) { // Subtract one to take into account offsets for - // face direction. + // face direction. label curF = cp[faceI] - 1; // Is the face on the boundary? @@ -282,7 +282,7 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField // It is necessary to create a copy of the addressing array to // take care of the face direction offset trick. - // + // { labelList curAddr(faceProcAddressing_[procI]); @@ -342,7 +342,7 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField forAll(cp, faceI) { // Subtract one to take into account offsets for - // face direction. + // face direction. reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart; } @@ -452,11 +452,12 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField } -// Reconstruct and write all volume fields +// Reconstruct and write all/selected volume fields template void Foam::fvFieldReconstructor::reconstructFvVolumeFields ( - const IOobjectList& objects + const IOobjectList& objects, + const HashSet& selectedFields ) { const word& fieldClassName = @@ -468,27 +469,29 @@ void Foam::fvFieldReconstructor::reconstructFvVolumeFields { Info<< " Reconstructing " << fieldClassName << "s\n" << endl; - for - ( - IOobjectList::const_iterator fieldIter = fields.begin(); - fieldIter != fields.end(); - ++fieldIter - ) + forAllConstIter(IOobjectList, fields, fieldIter) { - Info<< " " << fieldIter()->name() << endl; + if + ( + !selectedFields.size() + || selectedFields.found(fieldIter()->name()) + ) + { + Info<< " " << fieldIter()->name() << endl; - reconstructFvVolumeField(*fieldIter())().write(); + reconstructFvVolumeField(*fieldIter())().write(); + } } - Info<< endl; } } -// Reconstruct and write all surface fields +// Reconstruct and write all/selected surface fields template void Foam::fvFieldReconstructor::reconstructFvSurfaceFields ( - const IOobjectList& objects + const IOobjectList& objects, + const HashSet& selectedFields ) { const word& fieldClassName = @@ -500,18 +503,19 @@ void Foam::fvFieldReconstructor::reconstructFvSurfaceFields { Info<< " Reconstructing " << fieldClassName << "s\n" << endl; - for - ( - IOobjectList::const_iterator fieldIter = fields.begin(); - fieldIter != fields.end(); - ++fieldIter - ) + forAllConstIter(IOobjectList, fields, fieldIter) { - Info<< " " << fieldIter()->name() << endl; + if + ( + !selectedFields.size() + || selectedFields.found(fieldIter()->name()) + ) + { + Info<< " " << fieldIter()->name() << endl; - reconstructFvSurfaceField(*fieldIter())().write(); + reconstructFvSurfaceField(*fieldIter())().write(); + } } - Info<< endl; } } diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index db14efe3e5..50818f4db9 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -48,9 +48,17 @@ int main(int argc, char *argv[]) argList::noParallel(); timeSelector::addOptions(); # include "addRegionOption.H" + argList::validOptions.insert("fields", "\"(list of fields)\""); + # include "setRootCase.H" # include "createTime.H" + HashSet selectedFields; + if (args.options().found("fields")) + { + IStringStream(args.options()["fields"])() >> selectedFields; + } + // determine the processor count directly label nProcs = 0; while (dir(args.path()/(word("processor") + name(nProcs)))) @@ -184,13 +192,37 @@ int main(int argc, char *argv[]) procMeshes.boundaryProcAddressing() ); - fvReconstructor.reconstructFvVolumeFields(objects); - fvReconstructor.reconstructFvVolumeFields(objects); - fvReconstructor.reconstructFvVolumeFields(objects); - fvReconstructor.reconstructFvVolumeFields(objects); - fvReconstructor.reconstructFvVolumeFields(objects); + fvReconstructor.reconstructFvVolumeFields + ( + objects, + selectedFields + ); + fvReconstructor.reconstructFvVolumeFields + ( + objects, + selectedFields + ); + fvReconstructor.reconstructFvVolumeFields + ( + objects, + selectedFields + ); + fvReconstructor.reconstructFvVolumeFields + ( + objects, + selectedFields + ); + fvReconstructor.reconstructFvVolumeFields + ( + objects, + selectedFields + ); - fvReconstructor.reconstructFvSurfaceFields(objects); + fvReconstructor.reconstructFvSurfaceFields + ( + objects, + selectedFields + ); } else {