mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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.
This commit is contained in:
@ -191,7 +191,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
instantList timeDirs = timeSelector::select(runTime, args, "yPlus");
|
||||||
#include "createNamedMesh.H"
|
#include "createNamedMesh.H"
|
||||||
|
|
||||||
const bool compressible = args.optionFound("compressible");
|
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
|
const
|
||||||
{
|
{
|
||||||
return subset(selected(Times), Times);
|
return subset(selected(Times), Times);
|
||||||
@ -143,6 +143,11 @@ void Foam::timeSelector::addOptions
|
|||||||
"latestTime",
|
"latestTime",
|
||||||
"select the latest time"
|
"select the latest time"
|
||||||
);
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"newTimes",
|
||||||
|
"select the new times"
|
||||||
|
);
|
||||||
argList::addOption
|
argList::addOption
|
||||||
(
|
(
|
||||||
"time",
|
"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 instantList& timeDirs,
|
||||||
const argList& args,
|
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,
|
Time& runTime,
|
||||||
const argList& args
|
const argList& args
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
instantList timeDirs = timeSelector::select
|
instantList timeDirs
|
||||||
(
|
(
|
||||||
runTime.times(),
|
timeSelector::select
|
||||||
args,
|
(
|
||||||
runTime.constant()
|
runTime.times(),
|
||||||
|
args,
|
||||||
|
runTime.constant()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (timeDirs.empty())
|
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,
|
Time& runTime,
|
||||||
const argList& args
|
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,
|
Time& runTime,
|
||||||
const argList& args
|
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
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user