OpenFOAM logo
Open Source CFD Toolkit

checkTimeOption.H

Go to the documentation of this file.
00001     if (args.options().found("time"))
00002     {
00003         scalar time(readScalar(IStringStream(args.options()["time"])()));
00004 
00005         int nearestIndex = -1;
00006         scalar nearestDiff = Foam::GREAT;
00007 
00008         forAll(Times, timeIndex)
00009         {
00010             if (Times[timeIndex].name() == "constant") continue;
00011 
00012             scalar diff = fabs(Times[timeIndex].value() - time);
00013             if (diff < nearestDiff)
00014             {
00015                 nearestDiff = diff;
00016                 nearestIndex = timeIndex;
00017             }
00018         }
00019 
00020         startTime = nearestIndex;
00021         endTime = nearestIndex + 1;
00022     }
For further information go to www.openfoam.org