mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: use refPtr fileHandler in decomposeFaFields, faMeshReconstructor
This commit is contained in:
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
@ -57,8 +57,10 @@ do
|
|||||||
std::unique_ptr<faMeshSubset> subsetter;
|
std::unique_ptr<faMeshSubset> subsetter;
|
||||||
IOobjectList objects(0);
|
IOobjectList objects(0);
|
||||||
|
|
||||||
|
refPtr<fileOperation> newHandler(fileOperation::NewUncollated());
|
||||||
|
|
||||||
const bool oldDistributed = fileHandler().distributed();
|
const bool oldDistributed = fileHandler().distributed();
|
||||||
auto oldHandler = fileHandler(fileOperation::NewUncollated());
|
auto oldHandler = fileOperation::fileHandler(newHandler);
|
||||||
fileHandler().distributed(true);
|
fileHandler().distributed(true);
|
||||||
|
|
||||||
if (UPstream::master())
|
if (UPstream::master())
|
||||||
@ -73,11 +75,8 @@ do
|
|||||||
UPstream::parRun(oldParRun);
|
UPstream::parRun(oldParRun);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore old settings
|
// Restore settings
|
||||||
if (oldHandler)
|
(void) fileOperation::fileHandler(oldHandler);
|
||||||
{
|
|
||||||
fileHandler(std::move(oldHandler));
|
|
||||||
}
|
|
||||||
fileHandler().distributed(oldDistributed);
|
fileHandler().distributed(oldDistributed);
|
||||||
|
|
||||||
areaFieldsCache.readAllFields
|
areaFieldsCache.readAllFields
|
||||||
|
|||||||
@ -721,13 +721,14 @@ void Foam::faMeshReconstructor::writeMesh(const word& timeName) const
|
|||||||
{
|
{
|
||||||
const faMesh& fullMesh = this->mesh();
|
const faMesh& fullMesh = this->mesh();
|
||||||
|
|
||||||
const bool oldDistributed = fileHandler().distributed();
|
refPtr<fileOperation> writeHandler(fileOperation::NewUncollated());
|
||||||
auto oldHandler = fileHandler(fileOperation::NewUncollated());
|
|
||||||
fileHandler().distributed(true);
|
|
||||||
|
|
||||||
if (Pstream::master())
|
auto oldHandler = fileOperation::fileHandler(writeHandler);
|
||||||
|
const bool oldDistributed = fileHandler().distributed(true);
|
||||||
|
|
||||||
|
if (UPstream::master())
|
||||||
{
|
{
|
||||||
const bool oldParRun = Pstream::parRun(false);
|
const bool oldParRun = UPstream::parRun(false);
|
||||||
|
|
||||||
IOobject io(fullMesh.boundary());
|
IOobject io(fullMesh.boundary());
|
||||||
|
|
||||||
@ -736,15 +737,12 @@ void Foam::faMeshReconstructor::writeMesh(const word& timeName) const
|
|||||||
|
|
||||||
fullMesh.boundary().write();
|
fullMesh.boundary().write();
|
||||||
|
|
||||||
Pstream::parRun(oldParRun);
|
UPstream::parRun(oldParRun);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore old settings
|
// Restore settings
|
||||||
if (oldHandler)
|
|
||||||
{
|
|
||||||
fileHandler(std::move(oldHandler));
|
|
||||||
}
|
|
||||||
fileHandler().distributed(oldDistributed);
|
fileHandler().distributed(oldDistributed);
|
||||||
|
(void) fileOperation::fileHandler(oldHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user