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.name() != runTime.constant()
8  && runTime.name() != "0"
9  )
10  {
11  typeIOobject<IOdictionary> io
12  (
13  "time",
14  runTime.name(),
15  "uniform",
16  runTime,
17  IOobject::READ_IF_PRESENT,
18  IOobject::NO_WRITE,
19  false
20  );
21 
22  if (io.headerOk())
23  {
24  IOdictionary timeObject
25  (
26  IOobject
27  (
28  "time",
29  runTime.name(),
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.name();
45  }
46  }
47 
48  Info<< "\nTime [" << timeName << "] = " << runTime.name() << nl;
word timeName
Definition: getTimeIndex.H:3
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
messageStream Info
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
static const char nl
Definition: Ostream.H:260