Commit 31e1b1ba authored by Mark Olesen's avatar Mark Olesen
Browse files

timeSelector : added -latestTime0 to allow 0/ in the latest time selection

parent 9a0a0d05
......@@ -133,6 +133,7 @@ void Foam::timeSelector::addOptions
argList::validOptions.insert("noZero", "");
argList::validOptions.insert("time", "time");
argList::validOptions.insert("latestTime", "");
argList::validOptions.insert("latestTime0", "");
}
......@@ -169,11 +170,23 @@ Foam::List<Foam::instant> Foam::timeSelector::select
if (args.options().found("time"))
{
// can match 0/, but never constant/
selectTimes = timeSelector
(
IStringStream(args.options()["time"])()
).selected(timeDirs);
}
else if (args.options().found("latestTime0"))
{
selectTimes = false;
const label latestIdx = timeDirs.size() - 1;
// avoid false match on constant/
if (latestIdx != constantIdx)
{
selectTimes[latestIdx] = true;
}
}
else if (args.options().found("latestTime"))
{
selectTimes = false;
......@@ -186,9 +199,9 @@ Foam::List<Foam::instant> Foam::timeSelector::select
}
}
// special treatment for constant/
if (constantIdx >= 0)
{
// only add constant/ if specifically requested
selectTimes[constantIdx] = args.options().found("constant");
}
......@@ -197,11 +210,22 @@ Foam::List<Foam::instant> Foam::timeSelector::select
{
if (args.options().found("noZero"))
{
// exclude 0/ if specifically requested
selectTimes[zeroIdx] = false;
}
else if (argList::validOptions.found("zeroTime"))
{
selectTimes[zeroIdx] = args.options().found("zeroTime");
// with -zeroTime enabled
if (args.options().found("zeroTime"))
{
// include 0/ if specifically requested
selectTimes[zeroIdx] = true;
}
else
{
// normally drop 0/, except with -latestTime0 option
selectTimes[zeroIdx] = args.options().found("latestTime0");
}
}
}
......
Markdown is supported
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