mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +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:
@ -43,7 +43,6 @@ Description
|
||||
#include "faceZoneSet.H"
|
||||
#include "pointZoneSet.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "collatedFileOperation.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -91,6 +90,7 @@ void removeZone
|
||||
{
|
||||
WarningInFunction << "Failed writing zone " << setName << endl;
|
||||
}
|
||||
fileHandler().flush();
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,11 +199,6 @@ polyMesh::readUpdateState meshReadUpdate(polyMesh& mesh)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Specific to topoSet/setSet: quite often we want to block upon writing
|
||||
// a set so we can immediately re-read it. So avoid use of threading
|
||||
// for set writing.
|
||||
fileOperations::collatedFileOperation::maxThreadFileBufferSize = 0;
|
||||
|
||||
timeSelector::addOptions(true, false);
|
||||
#include "addDictOption.H"
|
||||
#include "addRegionOption.H"
|
||||
@ -307,6 +302,7 @@ int main(int argc, char *argv[])
|
||||
<< "Failed writing set "
|
||||
<< currentSet().objectPath() << endl;
|
||||
}
|
||||
fileHandler().flush();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -347,6 +343,7 @@ int main(int argc, char *argv[])
|
||||
<< "Failed writing set "
|
||||
<< currentSet().objectPath() << endl;
|
||||
}
|
||||
fileHandler().flush();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -359,6 +356,7 @@ int main(int argc, char *argv[])
|
||||
<< "Failed writing set "
|
||||
<< currentSet().objectPath() << endl;
|
||||
}
|
||||
fileHandler().flush();
|
||||
break;
|
||||
|
||||
case topoSetSource::INVERT:
|
||||
@ -370,6 +368,7 @@ int main(int argc, char *argv[])
|
||||
<< "Failed writing set "
|
||||
<< currentSet().objectPath() << endl;
|
||||
}
|
||||
fileHandler().flush();
|
||||
break;
|
||||
|
||||
case topoSetSource::REMOVE:
|
||||
|
||||
Reference in New Issue
Block a user