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  IOdictionary timeObject
25  (
26  IOobject
27  (
28  "time",
29  runTime.timeName(),
30  "uniform",
31  runTime,
32  IOobject::MUST_READ_IF_MODIFIED,
33  IOobject::NO_WRITE,
34  false
35  )
36  );
37 
38  label index;
39  timeObject.lookup("index") >> index;
40  timeName = Foam::name(index);
41  }
42  else
43  {
44  timeName = runTime.timeName();
45  }
46  }
47 
48  Info<< "\nTime [" << timeName << "] = " << runTime.timeName() << nl;
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
engineTime & runTime
word timeName
Definition: getTimeIndex.H:3
static const char nl
Definition: Ostream.H:260
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
messageStream Info