MRG: merged develop line back into integration branch

This commit is contained in:
Andrew Heather
2017-05-18 11:11:12 +01:00
514 changed files with 12134 additions and 16093 deletions

View File

@ -246,7 +246,7 @@ bool Foam::functionObjects::ensightWrite::write()
ensCase().setTime(t.value(), t.timeIndex());
}
wordHashSet candidates = subsetStrings(selectFields_, mesh_.names());
wordHashSet candidates(subsetStrings(selectFields_, mesh_.names()));
DynamicList<word> missing(selectFields_.size());
DynamicList<word> ignored(selectFields_.size());

View File

@ -48,11 +48,10 @@ namespace functionObjects
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::functionObjects::timeActivatedFileUpdate::updateFile
(
const bool checkFiles
)
void Foam::functionObjects::timeActivatedFileUpdate::updateFile()
{
modified_ = false;
label i = lastIndex_;
while
(
@ -68,19 +67,15 @@ 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_);
lastIndex_ = i;
if (checkFiles)
if (Pstream::master() || time_.distributed())
{
// Do an early check to avoid an additional iteration before
// any changes are picked up (see Time::run : does readModified
// before executing FOs). Note we have to protect the read
// constructor of *this from triggering this behaviour.
const_cast<Time&>(time_).Time::readModifiedObjects();
// 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;
}
}
@ -98,7 +93,8 @@ Foam::functionObjects::timeActivatedFileUpdate::timeActivatedFileUpdate
time_(runTime),
fileToUpdate_("unknown-fileToUpdate"),
timeVsFile_(),
lastIndex_(-1)
lastIndex_(-1),
modified_(false)
{
read(dict);
}
@ -142,8 +138,8 @@ bool Foam::functionObjects::timeActivatedFileUpdate::read
<< timeVsFile_[i].second() << endl;
}
// Copy starting files. Avoid recursion by not checking for modified files.
updateFile(false);
// Copy starting files
updateFile();
return true;
}
@ -151,7 +147,7 @@ bool Foam::functionObjects::timeActivatedFileUpdate::read
bool Foam::functionObjects::timeActivatedFileUpdate::execute()
{
updateFile(true);
updateFile();
return true;
}
@ -163,4 +159,10 @@ bool Foam::functionObjects::timeActivatedFileUpdate::write()
}
bool Foam::functionObjects::timeActivatedFileUpdate::filesModified() const
{
return modified_;
}
// ************************************************************************* //

View File

@ -106,11 +106,14 @@ class timeActivatedFileUpdate
//- Index of last file copied
label lastIndex_;
//- Has anything been copied?
bool modified_;
// Private Member Functions
//- Update file
void updateFile(const bool checkFiles);
void updateFile();
//- Disallow default bitwise copy construct
timeActivatedFileUpdate(const timeActivatedFileUpdate&);
@ -150,6 +153,9 @@ public:
//- Do nothing
virtual bool write();
//- Did any file get changed during execution?
virtual bool filesModified() const;
};