mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -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
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -90,7 +90,7 @@ makeZeroGradientField
|
||||
>& tdf
|
||||
)
|
||||
{
|
||||
if (tdf.valid())
|
||||
if (tdf)
|
||||
{
|
||||
auto& df = tdf.ref();
|
||||
|
||||
@ -125,7 +125,7 @@ makeZeroGradientField
|
||||
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tdf
|
||||
)
|
||||
{
|
||||
if (tdf.valid())
|
||||
if (tdf)
|
||||
{
|
||||
auto& df = tdf.ref();
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -37,7 +37,7 @@ bool writeAreaField
|
||||
const tmp<GeometricField<Type, faPatchField, areaMesh>>& tfield
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -36,7 +36,7 @@ bool writeDimField
|
||||
const tmp<DimensionedField<Type, volMesh>>& tdf
|
||||
)
|
||||
{
|
||||
if (!tdf.valid())
|
||||
if (!tdf)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -38,7 +38,7 @@ bool writePointField
|
||||
const tmp<GeometricField<Type, pointPatchField, pointMesh>>& tfield
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -38,7 +38,7 @@ bool writeVolField
|
||||
const bool nearCellValue = false
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -118,7 +118,7 @@ Foam::PtrList<const GeoField> Foam::readFields
|
||||
auto tfield =
|
||||
getField<GeoField>(mesh, objects, fieldName, syncPar);
|
||||
|
||||
if (tfield.valid())
|
||||
if (tfield)
|
||||
{
|
||||
fields.set(nFields++, tfield.ptr());
|
||||
}
|
||||
@ -157,7 +157,7 @@ Foam::PtrList<const GeoField> Foam::readFields
|
||||
auto tfield =
|
||||
getField<GeoField>(proxy, objects, fieldName, syncPar);
|
||||
|
||||
if (tfield.valid())
|
||||
if (tfield)
|
||||
{
|
||||
fields.set(nFields++, tfield.ptr());
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -56,7 +56,7 @@ bool writeAreaField
|
||||
const tmp<GeoField>& tfield
|
||||
)
|
||||
{
|
||||
if (tfield.valid())
|
||||
if (tfield)
|
||||
{
|
||||
writer.write(tfield());
|
||||
tfield.clear();
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -53,7 +53,7 @@ bool writeDimField
|
||||
const tmp<GeoField>& tfield
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -78,7 +78,7 @@ bool writeDimField
|
||||
const tmp<GeoField>& tfield
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -57,7 +57,7 @@ bool writePointField
|
||||
const fvMeshSubsetProxy& proxy
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -73,7 +73,7 @@ bool writePointField
|
||||
tproxied = tfield;
|
||||
}
|
||||
|
||||
if (!tproxied.valid())
|
||||
if (!tproxied)
|
||||
{
|
||||
// Or Error?
|
||||
return false;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -55,7 +55,7 @@ bool writeVolField
|
||||
const tmp<GeoField>& tfield
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -91,7 +91,7 @@ bool writeVolField
|
||||
const tmp<GeoField>& tfield
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user