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:
@ -50,12 +50,6 @@ Foam::twoPhaseMixtureThermo::twoPhaseMixtureThermo
|
||||
thermo1_(nullptr),
|
||||
thermo2_(nullptr)
|
||||
{
|
||||
// Note: we're writing files to be read in immediately afterwards.
|
||||
// Avoid any thread-writing problems.
|
||||
float bufSz =
|
||||
fileOperations::collatedFileOperation::maxThreadFileBufferSize;
|
||||
fileOperations::collatedFileOperation::maxThreadFileBufferSize = 0;
|
||||
|
||||
{
|
||||
volScalarField T1(IOobject::groupName("T", phase1Name()), T_);
|
||||
T1.write();
|
||||
@ -66,9 +60,9 @@ Foam::twoPhaseMixtureThermo::twoPhaseMixtureThermo
|
||||
T2.write();
|
||||
}
|
||||
|
||||
fileOperations::collatedFileOperation::maxThreadFileBufferSize =
|
||||
bufSz;
|
||||
|
||||
// Note: we're writing files to be read in immediately afterwards.
|
||||
// Avoid any thread-writing problems.
|
||||
fileHandler().flush();
|
||||
|
||||
thermo1_ = rhoThermo::New(U.mesh(), phase1Name());
|
||||
thermo2_ = rhoThermo::New(U.mesh(), phase2Name());
|
||||
|
||||
Reference in New Issue
Block a user