diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H b/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H index c57d4a0ba..0f0d4ddbd 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H @@ -155,6 +155,9 @@ if (argList::postProcess(argc, argv)) Warning<< err << endl; } + // Clear the objects owned by the mesh + mesh.objectRegistry::clear(); + Info<< endl; } diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.C b/src/OpenFOAM/db/objectRegistry/objectRegistry.C index b68644060..8c5419218 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.C @@ -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 @@ -30,7 +30,7 @@ License namespace Foam { -defineTypeNameAndDebug(objectRegistry, 0); + defineTypeNameAndDebug(objectRegistry, 0); } @@ -92,21 +92,7 @@ Foam::objectRegistry::objectRegistry Foam::objectRegistry::~objectRegistry() { - List 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 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); diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.H b/src/OpenFOAM/db/objectRegistry/objectRegistry.H index 45aa50a89..59bd18151 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.H +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.H @@ -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