ENH: reconstructPar: -newTimes argument to reconstruct missing times

This commit is contained in:
mattijs
2012-06-22 16:40:52 +01:00
parent 36c651f164
commit 14aafe2b71

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -69,6 +69,11 @@ int main(int argc, char *argv[])
"noLagrangian", "noLagrangian",
"skip reconstructing lagrangian positions and fields" "skip reconstructing lagrangian positions and fields"
); );
argList::addBoolOption
(
"newTimes",
"only reconstruct new times (i.e. that do not exist already)"
);
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
@ -95,6 +100,10 @@ int main(int argc, char *argv[])
args.optionLookup("lagrangianFields")() >> selectedLagrangianFields; args.optionLookup("lagrangianFields")() >> selectedLagrangianFields;
} }
const bool newTimes = args.optionFound("newTimes");
// determine the processor count directly // determine the processor count directly
label nProcs = 0; label nProcs = 0;
while (isDir(args.path()/(word("processor") + name(nProcs)))) while (isDir(args.path()/(word("processor") + name(nProcs))))
@ -134,6 +143,8 @@ int main(int argc, char *argv[])
args args
); );
instantList masterTimeDirs = runTime.times();
if (timeDirs.empty()) if (timeDirs.empty())
{ {
FatalErrorIn(args.executable()) FatalErrorIn(args.executable())
@ -165,6 +176,14 @@ int main(int argc, char *argv[])
// Loop over all times // Loop over all times
forAll(timeDirs, timeI) forAll(timeDirs, timeI)
{ {
if (newTimes && findIndex(masterTimeDirs, timeDirs[timeI]) != -1)
{
Info<< "Skipping time " << timeDirs[timeI].name()
<< endl << endl;
continue;
}
// Set time for global database // Set time for global database
runTime.setTime(timeDirs[timeI], timeI); runTime.setTime(timeDirs[timeI], timeI);