STYLE: avoid deprecation warnings for autoPtr set() method

- set() was silently deprecated in favour of reset() FEB-2018
  since the original additional check for overwriting an existing
  pointer was never used. The reset(...) name is more consistent
  with unique_ptr, tmp etc.

  Now emit deprecations for set().

- use direct test for autoPtr, tmp instead of valid() method.
  More consistent with unique_ptr etc.

STYLE: eliminate redundant ptr() use on cloned quantities
This commit is contained in:
Mark Olesen
2022-01-20 17:09:28 +01:00
parent 3b1f6e867c
commit d2961eec09
36 changed files with 128 additions and 150 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -716,7 +716,7 @@ void writeProcAddressing
}
autoPtr<fileOperation> defaultHandler;
if (writeHandler.valid())
if (writeHandler)
{
defaultHandler = fileHandler(std::move(writeHandler));
}
@ -726,7 +726,7 @@ void writeProcAddressing
const bool pointOk = pointMap.write();
const bool patchOk = patchMap.write();
if (defaultHandler.valid())
if (defaultHandler)
{
writeHandler = fileHandler(std::move(defaultHandler));
}
@ -1412,14 +1412,14 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
else
{
autoPtr<fileOperation> defaultHandler;
if (writeHandler.valid())
if (writeHandler)
{
defaultHandler = fileHandler(std::move(writeHandler));
}
mesh.write();
if (defaultHandler.valid())
if (defaultHandler)
{
writeHandler = fileHandler(std::move(defaultHandler));
}
@ -2543,7 +2543,7 @@ int main(int argc, char *argv[])
// File handler to be used for writing
const fileOperation& fh
(
writeHandler.valid()
writeHandler
? writeHandler()
: fileHandler()
);
@ -2989,7 +2989,7 @@ int main(int argc, char *argv[])
);
fvMesh& mesh = meshPtr();
if (writeHandler.valid() && Pstream::master())
if (writeHandler && Pstream::master())
{
// Remove any left-over empty processor directories created
// by loadOrCreateMesh to get around e.g. collated start-up
@ -3290,7 +3290,7 @@ int main(int argc, char *argv[])
);
fvMesh& mesh = meshPtr();
if (writeHandler.valid())
if (writeHandler)
{
// Remove any left-over empty processor directories created
// by loadOrCreateMesh to get around the collated start-up