postProcess.H: clear the object owned by the mesh objectRegistry

at the end of each time processed to ensure all fields are updated for each
time.

Resolves bug-report https://bugs.openfoam.org/view.php?id=2997
This commit is contained in:
Henry Weller
2018-06-27 22:21:02 +01:00
parent ac9208b802
commit 42dde9014c
3 changed files with 31 additions and 18 deletions

View File

@ -155,6 +155,9 @@ if (argList::postProcess(argc, argv))
Warning<< err << endl;
}
// Clear the objects owned by the mesh
mesh.objectRegistry::clear();
Info<< endl;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -92,21 +92,7 @@ Foam::objectRegistry::objectRegistry
Foam::objectRegistry::~objectRegistry()
{
List<regIOobject*> myObjects(size());
label nMyObjects = 0;
for (iterator iter = begin(); iter != end(); ++iter)
{
if (iter()->ownedByRegistry())
{
myObjects[nMyObjects++] = iter();
}
}
for (label i=0; i < nMyObjects; i++)
{
checkOut(*myObjects[i]);
}
clear();
}
@ -284,6 +270,26 @@ bool Foam::objectRegistry::checkOut(regIOobject& io) const
}
void Foam::objectRegistry::clear()
{
List<regIOobject*> myObjects(size());
label nMyObjects = 0;
for (iterator iter = begin(); iter != end(); ++iter)
{
if (iter()->ownedByRegistry())
{
myObjects[nMyObjects++] = iter();
}
}
for (label i=0; i < nMyObjects; i++)
{
checkOut(*myObjects[i]);
}
}
void Foam::objectRegistry::rename(const word& newName)
{
regIOobject::rename(newName);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -199,6 +199,10 @@ public:
//- Remove an regIOobject from registry
bool checkOut(regIOobject&) const;
//- Remove all regIOobject owned by the registry
void clear();
// Reading
//- Return true if any of the object's files have been modified