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 
00003     word timeName = "0";
00004 
00005     if
00006     (
00007         runTime.timeName() != "constant"
00008      && runTime.timeName() != "0"
00009     )
00010     {
00011         IOobject io
00012         (
00013             "time",
00014             runTime.timeName(),
00015             "uniform",
00016             runTime,
00017             IOobject::READ_IF_PRESENT,
00018             IOobject::NO_WRITE,
00019             false
00020         );
00021 
00022         if (io.headerOk())
00023         {
00024             IOdictionary timeObject
00025             (
00026                 IOobject
00027                 (
00028                     "time",
00029                     runTime.timeName(),
00030                     "uniform",
00031                     runTime,
00032                     IOobject::MUST_READ,
00033                     IOobject::NO_WRITE,
00034                     false
00035                 )
00036             );
00037 
00038             label index;
00039             timeObject.lookup("index") >> index;
00040             timeName = Foam::name(index);
00041         }
00042         else
00043         {
00044             timeName = runTime.timeName();
00045             // Info<< "skip ... missing entry " << io.objectPath() << endl;
00046             // continue;
00047         }
00048     }
00049 
00050     Info<< "\nTime [" << timeName << "] = " << runTime.timeName() << nl;
00051 
00052 
00053 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines