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:
@ -194,7 +194,8 @@ int Foam::vtkPVFoam::setTime(const std::vector<double>& requestTimes)
|
||||
|
||||
Time& runTime = dbPtr_();
|
||||
|
||||
// Get times list
|
||||
// Get times list. Flush first to force refresh.
|
||||
fileHandler().flush();
|
||||
instantList Times = runTime.times();
|
||||
|
||||
int nearestIndex = timeIndex_;
|
||||
@ -301,11 +302,6 @@ Foam::vtkPVFoam::vtkPVFoam
|
||||
|
||||
fileName FileName(vtkFileName);
|
||||
|
||||
// Make sure not to use the threaded version - it does not like
|
||||
// being loaded as a shared library - static cleanup order is problematic.
|
||||
// For now just disable the threaded writer.
|
||||
fileOperations::collatedFileOperation::maxThreadFileBufferSize = 0;
|
||||
|
||||
// avoid argList and get rootPath/caseName directly from the file
|
||||
fileName fullCasePath(FileName.path());
|
||||
|
||||
@ -729,6 +725,8 @@ std::vector<double> Foam::vtkPVFoam::findTimes(const bool skipZero) const
|
||||
if (dbPtr_.valid())
|
||||
{
|
||||
const Time& runTime = dbPtr_();
|
||||
// Get times list. Flush first to force refresh.
|
||||
fileHandler().flush();
|
||||
instantList timeLst = runTime.times();
|
||||
|
||||
// find the first time for which this mesh appears to exist
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -225,6 +225,9 @@ void Foam::vtkPVFoam::updateInfoLagrangian
|
||||
// List of lagrangian objects across all times
|
||||
HashSet<fileName> names;
|
||||
|
||||
// Get times list. Flush first to force refresh.
|
||||
fileHandler().flush();
|
||||
|
||||
for (const instant& t : dbPtr_().times())
|
||||
{
|
||||
names.insert
|
||||
@ -697,6 +700,7 @@ void Foam::vtkPVFoam::updateInfoLagrangianFields
|
||||
// to some of the clouds.
|
||||
HashTable<wordHashSet> fields;
|
||||
|
||||
fileHandler().flush();
|
||||
for (const instant& t : dbPtr_().times())
|
||||
{
|
||||
for (const auto& cloudName : cloudNames)
|
||||
|
||||
Reference in New Issue
Block a user