ENH: use refPtr fileHandler in decomposeFaFields, faMeshReconstructor

This commit is contained in:
Mark Olesen
2023-05-12 18:14:49 +02:00
parent 06147dabe7
commit 821d395259
2 changed files with 15 additions and 18 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021-2022 OpenCFD Ltd.
Copyright (C) 2021-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -57,8 +57,10 @@ do
std::unique_ptr<faMeshSubset> subsetter;
IOobjectList objects(0);
refPtr<fileOperation> newHandler(fileOperation::NewUncollated());
const bool oldDistributed = fileHandler().distributed();
auto oldHandler = fileHandler(fileOperation::NewUncollated());
auto oldHandler = fileOperation::fileHandler(newHandler);
fileHandler().distributed(true);
if (UPstream::master())
@ -73,11 +75,8 @@ do
UPstream::parRun(oldParRun);
}
// Restore old settings
if (oldHandler)
{
fileHandler(std::move(oldHandler));
}
// Restore settings
(void) fileOperation::fileHandler(oldHandler);
fileHandler().distributed(oldDistributed);
areaFieldsCache.readAllFields