This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/utilities/preProcessing/mapFields/setTimeIndex.H

20 lines
651 B
C

instantList sourceTimes = runTimeSource.times();
label sourceTimeIndex = runTimeSource.timeIndex();
if (args.options().found("sourceTime"))
{
if ((args.options()["sourceTime"]) == "latestTime")
{
sourceTimeIndex = sourceTimes.size() - 1;
}
else
{
scalar sourceTime =
readScalar(IStringStream(args.options()["sourceTime"])());
sourceTimeIndex = getTimeIndex(sourceTimes, sourceTime);
}
}
else
{
scalar sourceTime = runTimeTarget.time().value();
sourceTimeIndex = getTimeIndex(sourceTimes, sourceTime);
}