setTimeIndex.H
Go to the documentation of this file.
1 {
3 
4  if (sourceTimes.empty())
5  {
6  FatalErrorInFunction << "No result times in source "
7  << runTimeSource.caseName()
8  << exit(FatalError);
9  }
10 
11  label sourceTimeIndex = runTimeSource.timeIndex();
12  if (args.found("sourceTime"))
13  {
14  if (args["sourceTime"] == "latestTime")
15  {
16  sourceTimeIndex = sourceTimes.size() - 1;
17  }
18  else
19  {
20  sourceTimeIndex = Time::findClosestTimeIndex
21  (
23  args.get<scalar>("sourceTime")
24  );
25  }
26  }
27  else
28  {
29  sourceTimeIndex = Time::findClosestTimeIndex
30  (
32  runTimeTarget.time().value()
33  );
34  }
35 
37 
38  Info<< "\nSource time: " << runTimeSource.value()
39  << "\nTarget time: " << runTimeTarget.value()
40  << endl;
41 }
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:598
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
Time runTimeTarget(Time::controlDictName, args)
Time runTimeSource(Time::controlDictName, argsSrc)
instantList sourceTimes
Definition: setTimeIndex.H:1
T get(const label index) const
Get a value from the argument at index.
Definition: argListI.H:271
messageStream Info
Information stream (stdout output on master, null elsewhere)
List< instant > instantList
List of instants.
Definition: instantList.H:41
Foam::argList args(argc, argv)
label sourceTimeIndex
Definition: setTimeIndex.H:2
bool found(const word &optName) const
Return true if the named option is found.
Definition: argListI.H:171