From 14aafe2b71711f52d6ddd55c77146285a9d8eac7 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Fri, 22 Jun 2012 16:40:52 +0100 Subject: [PATCH] ENH: reconstructPar: -newTimes argument to reconstruct missing times --- .../reconstructPar/reconstructPar.C | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index 37d4a04f222..b47a15a6e16 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,6 +69,11 @@ int main(int argc, char *argv[]) "noLagrangian", "skip reconstructing lagrangian positions and fields" ); + argList::addBoolOption + ( + "newTimes", + "only reconstruct new times (i.e. that do not exist already)" + ); # include "setRootCase.H" # include "createTime.H" @@ -95,6 +100,10 @@ int main(int argc, char *argv[]) args.optionLookup("lagrangianFields")() >> selectedLagrangianFields; } + + const bool newTimes = args.optionFound("newTimes"); + + // determine the processor count directly label nProcs = 0; while (isDir(args.path()/(word("processor") + name(nProcs)))) @@ -134,6 +143,8 @@ int main(int argc, char *argv[]) args ); + instantList masterTimeDirs = runTime.times(); + if (timeDirs.empty()) { FatalErrorIn(args.executable()) @@ -165,6 +176,14 @@ int main(int argc, char *argv[]) // Loop over all times forAll(timeDirs, timeI) { + if (newTimes && findIndex(masterTimeDirs, timeDirs[timeI]) != -1) + { + Info<< "Skipping time " << timeDirs[timeI].name() + << endl << endl; + continue; + } + + // Set time for global database runTime.setTime(timeDirs[timeI], timeI); -- GitLab