getTimeIndex.H
Go to the documentation of this file.
1 // Read time index from */uniform/time, but treat 0 and constant specially
2 
3  word timeName = "0";
4 
5  if
6  (
7  runTime.timeName() != runTime.constant()
8  && runTime.timeName() != "0"
9  )
10  {
11  IOobject io
12  (
13  "time",
14  runTime.timeName(),
15  "uniform",
16  runTime,
17  IOobject::READ_IF_PRESENT,
18  IOobject::NO_WRITE,
19  false
20  );
21 
22  if (io.typeHeaderOk<IOdictionary>(true))
23  {
24  const label timeIndex = IOdictionary(io).get<label>("index");
26  }
27  else
28  {
29  timeName = runTime.timeName();
30  }
31  }
32 
33  Info<< "\nTime [" << timeName << "] = " << runTime.timeName() << nl;
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
timeName
word timeName
Definition: getTimeIndex.H:3
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
timeIndex
label timeIndex
Definition: getTimeIndex.H:30