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:
Will Bainbridge
2018-06-27 11:45:58 +01:00
committed by mattijs
parent 70bc72c2df
commit 2ae4bf73d9
12 changed files with 71 additions and 37 deletions

View File

@ -108,7 +108,6 @@ Usage
#include "pointFieldDecomposer.H"
#include "lagrangianFieldDecomposer.H"
#include "decompositionModel.H"
#include "collatedFileOperation.H"
#include "faCFD.H"
#include "emptyFaPatch.H"
@ -523,12 +522,6 @@ int main(int argc, char *argv[])
// Decompose the mesh
if (!decomposeFieldsOnly)
{
// Disable buffering when writing mesh since we need to read
// it later on when decomposing the fields
float bufSz =
fileOperations::collatedFileOperation::maxThreadFileBufferSize;
fileOperations::collatedFileOperation::maxThreadFileBufferSize = 0;
mesh.decomposeMesh();
mesh.writeDecomposition(decomposeSets);
@ -587,8 +580,7 @@ int main(int argc, char *argv[])
<< " for use in manual decomposition." << endl;
}
fileOperations::collatedFileOperation::maxThreadFileBufferSize =
bufSz;
fileHandler().flush();
}
@ -1486,8 +1478,14 @@ int main(int argc, char *argv[])
fieldDecomposer.decomposeFields(areaScalarFields);
fieldDecomposer.decomposeFields(areaVectorFields);
fieldDecomposer.decomposeFields(areaSphericalTensorFields);
fieldDecomposer.decomposeFields(areaSymmTensorFields);
fieldDecomposer.decomposeFields
(
areaSphericalTensorFields
);
fieldDecomposer.decomposeFields
(
areaSymmTensorFields
);
fieldDecomposer.decomposeFields(areaTensorFields);
fieldDecomposer.decomposeFields(edgeScalarFields);