openfoam/applications/utilities/preProcessing/mapFieldsPar/setTimeIndex.H
Henry Weller 0aa05185db mapFieldsPar: updated to enable mapping from source patches (instead of recreating)
- patchFields now get mapped (instead of created)
  - with -consistent it now maps all patches except for processor ones (they are
    the only ones that are processor-local)
  - all constraint patches get evaluated after mapping to bring them up to date.

Patch contributed by Mattijs Janssens
2016-06-21 14:16:18 +01:00

42 lines
1.0 KiB
C

{
instantList sourceTimes = runTimeSource.times();
if (sourceTimes.empty())
{
FatalErrorInFunction << "No result times in source "
<< runTimeSource.caseName()
<< exit(FatalError);
}
label sourceTimeIndex = runTimeSource.timeIndex();
if (args.optionFound("sourceTime"))
{
if (args["sourceTime"] == "latestTime")
{
sourceTimeIndex = sourceTimes.size() - 1;
}
else
{
sourceTimeIndex = Time::findClosestTimeIndex
(
sourceTimes,
args.optionRead<scalar>("sourceTime")
);
}
}
else
{
sourceTimeIndex = Time::findClosestTimeIndex
(
sourceTimes,
runTimeTarget.time().value()
);
}
runTimeSource.setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex);
Info<< "\nSource time: " << runTimeSource.value()
<< "\nTarget time: " << runTimeTarget.value()
<< endl;
}