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/postProcessing/dataConversion/foamToFieldview9/checkTimeOption.H

26 lines
607 B
C

if (args.options().found("time"))
{
scalar time(readScalar(IStringStream(args.options()["time"])()));
int nearestIndex = -1;
scalar nearestDiff = Foam::GREAT;
forAll(Times, timeIndex)
{
scalar diff = fabs(Times[timeIndex].value() - time);
if (diff < nearestDiff)
{
nearestDiff = diff;
nearestIndex = timeIndex;
}
}
startTime = nearestIndex;
endTime = nearestIndex + 1;
}
else
{
startTime = 0;
endTime = Times.size();
}