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/foamToEnsightParts/getTimeIndex.H

44 lines
1 KiB
C
Raw Normal View History

2010-08-26 14:22:03 +00:00
// Read time index from */uniform/time, but treat 0 and constant specially
// or simply increment from the '-index' option if it was supplied
label timeIndex = 0;
2010-08-26 14:22:03 +00:00
if (optIndex)
{
timeIndex = indexingNumber++;
}
else if
(
runTime.timeName() != "constant"
&& runTime.timeName() != "0"
)
{
IOobject io
(
"time",
runTime.timeName(),
"uniform",
runTime,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
);
if (io.headerOk())
{
2010-08-26 14:22:03 +00:00
io.readOpt() = IOobject::MUST_READ;
IOdictionary timeObject(io);
timeObject.lookup("index") >> timeIndex;
}
else
{
Info<< "skip ... missing entry " << io.objectPath() << endl;
continue;
}
}
timeIndices.insert(timeIndex, timeDirs[timeI].value());
Info<< "\nTime [" << timeIndex << "] = " << runTime.timeName() << nl;