ENH: timeActivatedFileUpdate: avoid copying on master; simplified logic; Fixes #420.

This commit is contained in:
mattijs
2017-04-06 14:45:16 +01:00
parent 2da2970c7c
commit 498fa94cb3
7 changed files with 39 additions and 10 deletions

View File

@ -67,11 +67,14 @@ void Foam::functionObjects::timeActivatedFileUpdate::updateFile()
Log << nl << type() << ": copying file" << nl << timeVsFile_[i].second()
<< nl << "to:" << nl << fileToUpdate_ << nl << endl;
fileName destFile(fileToUpdate_ + Foam::name(pid()));
cp(timeVsFile_[i].second(), destFile);
mv(destFile, fileToUpdate_);
if (Pstream::master() || time_.distributed())
{
// Slaves do not copy if running non-distributed
fileName destFile(fileToUpdate_ + Foam::name(pid()));
cp(timeVsFile_[i].second(), destFile);
mv(destFile, fileToUpdate_);
}
lastIndex_ = i;
modified_ = true;
}
}