- instead of dict.lookup(name) >> val; can use dict.readEntry(name, val); for checking of input token sizes. This helps catch certain types of input errors: { key1 ; // <- Missing value key2 1234 // <- Missing ';' terminator key3 val; } STYLE: readIfPresent() instead of 'if found ...' in a few more places.
44 lines
1.0 KiB
C
44 lines
1.0 KiB
C
// 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;
|
|
|
|
if (optIndex)
|
|
{
|
|
timeIndex = indexingNumber++;
|
|
}
|
|
else if
|
|
(
|
|
runTime.timeName() != runTime.constant()
|
|
&& runTime.timeName() != "0"
|
|
)
|
|
{
|
|
IOobject io
|
|
(
|
|
"time",
|
|
runTime.timeName(),
|
|
"uniform",
|
|
runTime,
|
|
IOobject::READ_IF_PRESENT,
|
|
IOobject::NO_WRITE,
|
|
false // no register
|
|
);
|
|
|
|
if (io.typeHeaderOk<IOdictionary>(true, false))
|
|
{
|
|
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
|
IOdictionary timeObject(io);
|
|
|
|
timeObject.readEntry("index", timeIndex);
|
|
}
|
|
else
|
|
{
|
|
Info<< "skip ... missing entry " << io.objectPath() << endl;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
Info<< nl << "Time [" << timeIndex << "] = " << runTime.timeName() << nl;
|
|
|
|
// end-of-file
|