BUG: changeDictionary: fixed commandline override of time

This commit is contained in:
mattijs
2012-04-17 09:31:57 +01:00
parent 7b606cb9e8
commit b4fe2268a3

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
@ -70,6 +70,7 @@ Usage
#include "IOPtrList.H" #include "IOPtrList.H"
#include "volFields.H" #include "volFields.H"
#include "stringListOps.H" #include "stringListOps.H"
#include "timeSelector.H"
using namespace Foam; using namespace Foam;
@ -252,12 +253,10 @@ int main(int argc, char *argv[])
"file", "file",
"specify an alternative to system/changeDictionaryDict" "specify an alternative to system/changeDictionaryDict"
); );
argList::addOption
( // Add explicit time option
"instance", timeSelector::addOptions();
"name",
"specify alternate time instance - default is latest time"
);
argList::addBoolOption argList::addBoolOption
( (
"literalRE", "literalRE",
@ -272,6 +271,17 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
// Optionally override controlDict time with -time options
instantList times = timeSelector::selectIfPresent(runTime, args);
if (times.size() < 1)
{
FatalErrorIn(args.executable())
<< "No times selected." << exit(FatalError);
}
runTime.setTime(times[0], 0);
#include "createNamedMesh.H" #include "createNamedMesh.H"
const word dictName("changeDictionaryDict"); const word dictName("changeDictionaryDict");
@ -317,11 +327,6 @@ int main(int argc, char *argv[])
regionPrefix = regionName; regionPrefix = regionName;
} }
word instance = runTime.timeName();
if (args.options().found("instance"))
{
instance = args.options()["instance"];
}
// Make sure we do not use the master-only reading since we read // Make sure we do not use the master-only reading since we read
// fields (different per processor) as dictionaries. // fields (different per processor) as dictionaries.
@ -460,7 +465,7 @@ int main(int argc, char *argv[])
IOobject IOobject
( (
fieldName, fieldName,
instance, runTime.timeName(),
mesh, mesh,
IOobject::MUST_READ_IF_MODIFIED, IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE, IOobject::NO_WRITE,