FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

getTimeIndex.H

Go to the documentation of this file.
00001 // Read time index from */uniform/time, but treat 0 and constant specially
00002 // or simply increment from the '-index' option if it was supplied
00003 
00004     label timeIndex = 0;
00005 
00006     if (optIndex)
00007     {
00008         timeIndex = indexingNumber++;
00009     }
00010     else if
00011     (
00012         runTime.timeName() != "constant"
00013      && runTime.timeName() != "0"
00014     )
00015     {
00016         IOobject io
00017         (
00018             "time",
00019             runTime.timeName(),
00020             "uniform",
00021             runTime,
00022             IOobject::READ_IF_PRESENT,
00023             IOobject::NO_WRITE,
00024             false
00025         );
00026 
00027         if (io.headerOk())
00028         {
00029             io.readOpt() = IOobject::MUST_READ;
00030             IOdictionary timeObject(io);
00031 
00032             timeObject.lookup("index") >> timeIndex;
00033         }
00034         else
00035         {
00036             Info<< "skip ... missing entry " << io.objectPath() << endl;
00037             continue;
00038         }
00039     }
00040 
00041     timeIndices.insert(timeIndex, timeDirs[timeI].value());
00042     Info<< "\nTime [" << timeIndex << "] = " << runTime.timeName() << nl;
00043 
00044 
00045 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines