mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
fileHandler: Added flush method
This method waits until all the threads have completed IO operations and then clears any cached information about the files on disk. This replaces the deactivation of threading by means of zeroing the buffer size when writing and reading of a file happen in sequence. It also allows paraFoam to update the list of available times. Patch contributed by Mattijs Janssens Resolves bug report https://bugs.openfoam.org/view.php?id=2962
This commit is contained in:
@ -611,6 +611,18 @@ bool Foam::fileOperations::collatedFileOperation::writeObject
|
||||
}
|
||||
}
|
||||
|
||||
void Foam::fileOperations::collatedFileOperation::flush() const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "collatedFileOperation::flush : clearing and waiting for thread"
|
||||
<< endl;
|
||||
}
|
||||
masterUncollatedFileOperation::flush();
|
||||
// Wait for thread to finish (note: also removes thread)
|
||||
writer_.waitAll();
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::fileOperations::collatedFileOperation::processorsDir
|
||||
(
|
||||
|
||||
@ -155,6 +155,9 @@ public:
|
||||
|
||||
// Other
|
||||
|
||||
//- Forcibly wait until all output done. Flush any cached data
|
||||
virtual void flush() const;
|
||||
|
||||
//- Actual name of processors dir
|
||||
virtual word processorsDir(const IOobject&) const;
|
||||
|
||||
|
||||
@ -991,6 +991,17 @@ Foam::label Foam::fileOperation::nProcs
|
||||
}
|
||||
|
||||
|
||||
void Foam::fileOperation::flush() const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "fileOperation::flush : clearing processor directories cache"
|
||||
<< endl;
|
||||
}
|
||||
procsDirs_.clear();
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::fileOperation::processorsCasePath
|
||||
(
|
||||
const IOobject& io,
|
||||
|
||||
@ -514,6 +514,9 @@ public:
|
||||
virtual void setTime(const Time&) const
|
||||
{}
|
||||
|
||||
//- Forcibly wait until all output done. Flush any cached data
|
||||
virtual void flush() const;
|
||||
|
||||
//- Generate path (like io.path) from root+casename with any
|
||||
// 'processorXXX' replaced by procDir (usually 'processsors')
|
||||
fileName processorsCasePath
|
||||
|
||||
@ -2561,6 +2561,13 @@ Foam::fileOperations::masterUncollatedFileOperation::NewOFstream
|
||||
}
|
||||
|
||||
|
||||
void Foam::fileOperations::masterUncollatedFileOperation::flush() const
|
||||
{
|
||||
fileOperation::flush();
|
||||
times_.clear();
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::fileOperations::masterUncollatedFileOperation::addWatch
|
||||
(
|
||||
const fileName& fName
|
||||
|
||||
@ -769,6 +769,9 @@ public:
|
||||
//- Callback for time change
|
||||
virtual void setTime(const Time&) const;
|
||||
|
||||
//- Forcibly wait until all output done. Flush any cached data
|
||||
virtual void flush() const;
|
||||
|
||||
//- Return cached times
|
||||
const HashPtrTable<instantList>& times() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user