mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: timeActivatedFileUpdate file check on non-master (fixes #2377)
ENH: report relative paths for output for easier reading
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -67,15 +67,20 @@ void Foam::functionObjects::timeActivatedFileUpdate::updateFile()
|
|||||||
|
|
||||||
if (i > lastIndex_)
|
if (i > lastIndex_)
|
||||||
{
|
{
|
||||||
Log << nl << type() << ": copying file" << nl << timeVsFile_[i].second()
|
const fileName& srcFile = timeVsFile_[i].second();
|
||||||
<< nl << "to:" << nl << fileToUpdate_ << nl << endl;
|
|
||||||
|
// Report case-relative path for information
|
||||||
|
Log << nl << type() << ": copying file" << nl
|
||||||
|
<< "from: " << time_.relativePath(srcFile, true) << nl
|
||||||
|
<< "to : " << time_.relativePath(fileToUpdate_, true) << nl
|
||||||
|
<< endl;
|
||||||
|
|
||||||
if (Pstream::master() || time_.distributed())
|
if (Pstream::master() || time_.distributed())
|
||||||
{
|
{
|
||||||
// Slaves do not copy if running non-distributed
|
// Slaves do not copy if running non-distributed
|
||||||
fileName destFile(fileToUpdate_ + Foam::name(pid()));
|
fileName tmpFile(fileToUpdate_ + Foam::name(pid()));
|
||||||
cp(timeVsFile_[i].second(), destFile);
|
Foam::cp(srcFile, tmpFile);
|
||||||
mv(destFile, fileToUpdate_);
|
Foam::mv(tmpFile, fileToUpdate_);
|
||||||
}
|
}
|
||||||
lastIndex_ = i;
|
lastIndex_ = i;
|
||||||
modified_ = true;
|
modified_ = true;
|
||||||
@ -122,16 +127,23 @@ bool Foam::functionObjects::timeActivatedFileUpdate::read
|
|||||||
|
|
||||||
forAll(timeVsFile_, i)
|
forAll(timeVsFile_, i)
|
||||||
{
|
{
|
||||||
timeVsFile_[i].second() = timeVsFile_[i].second().expand();
|
timeVsFile_[i].second().expand();
|
||||||
if (!isFile(timeVsFile_[i].second()))
|
const fileName& srcFile = timeVsFile_[i].second();
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "File: " << timeVsFile_[i].second() << " not found"
|
|
||||||
<< nl << exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Report case-relative path for information
|
||||||
Info<< " " << timeVsFile_[i].first() << tab
|
Info<< " " << timeVsFile_[i].first() << tab
|
||||||
<< timeVsFile_[i].second() << endl;
|
<< time_.relativePath(srcFile, true) << endl;
|
||||||
|
|
||||||
|
if (Pstream::master() || time_.distributed())
|
||||||
|
{
|
||||||
|
if (!Foam::isFile(srcFile))
|
||||||
|
{
|
||||||
|
// Report full path on error
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "File not found: " << srcFile << endl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy starting files
|
// Copy starting files
|
||||||
|
|||||||
Reference in New Issue
Block a user