setTimeIndex.H
Go to the documentation of this file.
2  label sourceTimeIndex = runTimeSource.timeIndex();
3  if (args.optionFound("sourceTime"))
4  {
5  if (args["sourceTime"] == "latestTime")
6  {
7  sourceTimeIndex = sourceTimes.size() - 1;
8  }
9  else
10  {
11  sourceTimeIndex = Time::findClosestTimeIndex
12  (
13  sourceTimes,
14  args.optionRead<scalar>("sourceTime")
15  );
16  }
17  }
18  else
19  {
20  sourceTimeIndex = Time::findClosestTimeIndex
21  (
22  sourceTimes,
23  runTimeTarget.time().value()
24  );
25  }
26 
27  runTimeSource.setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex);
28 
29  Info<< "\nSource time: " << runTimeSource.value()
30  << "\nTarget time: " << runTimeTarget.value()
31  << endl;
List< instant > instantList
List of instants.
Definition: instantList.H:42
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
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
bool optionFound(const word &opt) const
Return true if the named option is found.
Definition: argListI.H:114
Time runTimeTarget(Time::controlDictName, args)
Time runTimeSource(Time::controlDictName, argsSrc)
T optionRead(const word &opt) const
Read a value from the named option.
Definition: argListI.H:193
instantList sourceTimes
Definition: setTimeIndex.H:1
messageStream Info
Foam::argList args(argc, argv)