openfoam/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H
mattijs e424059208 ENH: glboal file handling: initial commit
Moved file path handling to regIOobject and made it type specific so
now every object can have its own rules. Examples:
- faceZones are now processor local (and don't search up anymore)
- timeStampMaster is now no longer hardcoded inside IOdictionary
  (e.g. uniformDimensionedFields support it as well)
- the distributedTriSurfaceMesh is properly processor-local; no need
  for fileModificationChecking manipulation.
2016-01-25 13:03:15 +00:00

52 lines
1.2 KiB
C

// Read time index from */uniform/time, but treat 0 and constant specially
word timeName = "0";
if
(
runTime.timeName() != runTime.constant()
&& runTime.timeName() != "0"
)
{
IOobject io
(
"time",
runTime.timeName(),
"uniform",
runTime,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
);
if (io.typeHeaderOk<IOdictionary>(true))
{
IOdictionary timeObject
(
IOobject
(
"time",
runTime.timeName(),
"uniform",
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
);
label index;
timeObject.lookup("index") >> index;
timeName = Foam::name(index);
}
else
{
timeName = runTime.timeName();
// Info<< "skip ... missing entry " << io.objectPath() << endl;
// continue;
}
}
Info<< "\nTime [" << timeName << "] = " << runTime.timeName() << nl;