mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: simplify short-circuit involving autoPtr (#1775)
- with '&&' conditions, often better to check for non-null autoPtr
first (it is cheap)
- check as bool instead of valid() method for cleaner code, especially
when the wrapped item itself has a valid/empty or good.
Also when handling multiple checks.
Now
if (ptr && ptr->valid())
if (ptr1 || ptr2)
instead
if (ptr.valid() && ptr->valid())
if (ptr1.valid() || ptr2.valid())
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -56,7 +56,7 @@ if (doFiniteArea)
|
||||
FatalError.throwExceptions(throwing);
|
||||
}
|
||||
|
||||
if (faMeshPtr.valid() && nAreaFields)
|
||||
if (faMeshPtr && nAreaFields)
|
||||
{
|
||||
reportFields::area(Info, objects);
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -85,7 +85,7 @@ bool writeDimField
|
||||
|
||||
const auto& field = tfield();
|
||||
|
||||
if (internalWriter.valid() && pInterp.valid())
|
||||
if (internalWriter && pInterp)
|
||||
{
|
||||
internalWriter->write(field, *pInterp);
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -99,7 +99,7 @@ bool writeVolField
|
||||
const auto& field = tfield();
|
||||
|
||||
// Internal
|
||||
if (internalWriter.valid() && pInterp.valid())
|
||||
if (internalWriter && pInterp)
|
||||
{
|
||||
internalWriter->write(field, *pInterp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user