FreeFOAM The Cross-Platform CFD Toolkit
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() != "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.headerOk())
23  {
24  IOdictionary timeObject
25  (
26  IOobject
27  (
28  "time",
29  runTime.timeName(),
30  "uniform",
31  runTime,
32  IOobject::MUST_READ,
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  // Info<< "skip ... missing entry " << io.objectPath() << endl;
46  // continue;
47  }
48  }
49 
50  Info<< "\nTime [" << timeName << "] = " << runTime.timeName() << nl;
51 
52 
53 // ************************ vim: set sw=4 sts=4 et: ************************ //