Commit 97b0882e authored by Henry Weller's avatar Henry Weller
Browse files

timeSelector: Add support for -newTimes option

    //- Return the set of times selected based on the argList options
    //  including support for \b -newTimes in which times are selected
    //  if the file <fName> does not exist in the time directory.
    //  Also set the runTime to the first instance or the
    //  \c constant/ directory if no instances are specified or available
    static instantList select
    (
        Time& runTime,
        const argList& args,
        const word& fName
    );

This is experimental functionality and currently on test in the yPlus
post-processing utility.
parent 633fee4f
......@@ -191,7 +191,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
instantList timeDirs = timeSelector::select(runTime, args, "yPlus");
#include "createNamedMesh.H"
const bool compressible = args.optionFound("compressible");
......
......@@ -97,7 +97,7 @@ Foam::List<bool> Foam::timeSelector::selected(const instantList& Times) const
}
Foam::List<Foam::instant> Foam::timeSelector::select(const instantList& Times)
Foam::instantList Foam::timeSelector::select(const instantList& Times)
const
{
return subset(selected(Times), Times);
......@@ -143,6 +143,11 @@ void Foam::timeSelector::addOptions
"latestTime",
"select the latest time"
);
argList::addBoolOption
(
"newTimes",
"select the new times"
);
argList::addOption
(
"time",
......@@ -152,7 +157,7 @@ void Foam::timeSelector::addOptions
}
Foam::List<Foam::instant> Foam::timeSelector::select
Foam::instantList Foam::timeSelector::select
(
const instantList& timeDirs,
const argList& args,
......@@ -244,17 +249,20 @@ Foam::List<Foam::instant> Foam::timeSelector::select
}
Foam::List<Foam::instant> Foam::timeSelector::select0
Foam::instantList Foam::timeSelector::select0
(
Time& runTime,
const argList& args
)
{
instantList timeDirs = timeSelector::select
instantList timeDirs
(
runTime.times(),
args,
runTime.constant()
timeSelector::select
(
runTime.times(),
args,
runTime.constant()
)
);
if (timeDirs.empty())
......@@ -272,7 +280,7 @@ Foam::List<Foam::instant> Foam::timeSelector::select0
}
Foam::List<Foam::instant> Foam::timeSelector::selectIfPresent
Foam::instantList Foam::timeSelector::selectIfPresent
(
Time& runTime,
const argList& args
......@@ -297,4 +305,32 @@ Foam::List<Foam::instant> Foam::timeSelector::selectIfPresent
}
Foam::instantList Foam::timeSelector::select
(
Time& runTime,
const argList& args,
const word& fName
)
{
instantList timeDirs(timeSelector::select0(runTime, args));
if (timeDirs.size() && args.optionFound("newTimes"))
{
List<bool> selectTimes(timeDirs.size(), true);
forAll(timeDirs, timeI)
{
selectTimes[timeI] =
!exists(runTime.path()/timeDirs[timeI].name()/fName);
}
return subset(selectTimes, timeDirs);
}
else
{
return timeDirs;
}
}
// ************************************************************************* //
......@@ -159,6 +159,18 @@ public:
Time& runTime,
const argList& args
);
//- Return the set of times selected based on the argList options
// including support for \b -newTimes in which times are selected
// if the file <fName> does not exist in the time directory.
// Aslso set the runTime to the first instance or the
// \c constant/ directory if no instances are specified or available
static instantList select
(
Time& runTime,
const argList& args,
const word& fName
);
};
......
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