STYLE: check autoPtr as plain bool instead of valid()

- cleaner code, more similarity with unique_ptr

  Now
      if (ptr)
      if (!ptr)

  instead
      if (ptr.valid())
      if (!ptr.valid())
This commit is contained in:
Mark Olesen
2020-07-15 08:50:57 +02:00
parent 9af3f85cf9
commit 12c91b9472
144 changed files with 483 additions and 470 deletions

View File

@ -1601,7 +1601,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
"distributedTriSurfaceMesh::independentlyDistributedBbs"
);
if (!decomposer_.valid())
if (!decomposer_)
{
// Use singleton decomposeParDict. Cannot use decompositionModel
// here since we've only got Time and not a mesh.
@ -1619,7 +1619,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
}
else
{
if (!decomposeParDict_.valid())
if (!decomposeParDict_)
{
decomposeParDict_.reset
(
@ -1637,7 +1637,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
)
);
}
decomposer_ = decompositionMethod::New(decomposeParDict_());
decomposer_ = decompositionMethod::New(*decomposeParDict_);
}
}
@ -2756,7 +2756,7 @@ void Foam::distributedTriSurfaceMesh::clearOut()
const Foam::globalIndex& Foam::distributedTriSurfaceMesh::globalTris() const
{
if (!globalTris_.valid())
if (!globalTris_)
{
globalTris_.reset(new globalIndex(triSurface::size()));
}

View File

@ -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.
@ -46,7 +46,7 @@ namespace patchDistMethods
const Foam::distributedTriSurfaceMesh&
Foam::patchDistMethods::exact::patchSurface() const
{
if (!patchSurfPtr_.valid())
if (!patchSurfPtr_)
{
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();