dimensionSets: Clean up memory at the end of the run

This commit is contained in:
Will Bainbridge
2023-03-01 13:12:46 +00:00
parent 3b1e46e4d5
commit d66f5af22e

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,6 +25,7 @@ License
#include "dimensionSet.H" #include "dimensionSet.H"
#include "dimensionedScalar.H" #include "dimensionedScalar.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -38,6 +39,19 @@ dictionary* dimensionSystemsPtr_(nullptr);
HashTable<dimensionedScalar>* unitSetPtr_(nullptr); HashTable<dimensionedScalar>* unitSetPtr_(nullptr);
dimensionSets* writeUnitSetPtr_(nullptr); dimensionSets* writeUnitSetPtr_(nullptr);
// Delete the above data at the end of the run
struct deleteDimensionSystemsPtr
{
~deleteDimensionSystemsPtr()
{
deleteDemandDrivenData(dimensionSystemsPtr_);
deleteDemandDrivenData(unitSetPtr_);
deleteDemandDrivenData(writeUnitSetPtr_);
}
};
deleteDimensionSystemsPtr deleteDimensionSystemsPtr_;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //