Skip to content
Snippets Groups Projects
Commit b4fe2268 authored by mattijs's avatar mattijs
Browse files

BUG: changeDictionary: fixed commandline override of time

parent 7b606cb9
Branches
Tags
No related merge requests found
......@@ -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
......@@ -70,6 +70,7 @@ Usage
#include "IOPtrList.H"
#include "volFields.H"
#include "stringListOps.H"
#include "timeSelector.H"
using namespace Foam;
......@@ -252,12 +253,10 @@ int main(int argc, char *argv[])
"file",
"specify an alternative to system/changeDictionaryDict"
);
argList::addOption
(
"instance",
"name",
"specify alternate time instance - default is latest time"
);
// Add explicit time option
timeSelector::addOptions();
argList::addBoolOption
(
"literalRE",
......@@ -272,6 +271,17 @@ int main(int argc, char *argv[])
#include "setRootCase.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"
const word dictName("changeDictionaryDict");
......@@ -317,11 +327,6 @@ int main(int argc, char *argv[])
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
// fields (different per processor) as dictionaries.
......@@ -460,7 +465,7 @@ int main(int argc, char *argv[])
IOobject
(
fieldName,
instance,
runTime.timeName(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment