mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: code adjustments for updated NullObject
- can now safely use labelList::null() instead of emptyLabelList for
return values. No special treatment required for lists.
Possible replacements:
if (notNull(list) && list.size()) -> if (list.size())
if (isNull(list) || list.empty()) -> if (list.empty())
The receiver may still wish to handle differently to distinguish
between a null list and an empty list, but no additional special
protection is required when obtaining sizes, traversing, outputting
etc.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
@ -79,11 +79,12 @@ public:
|
||||
weights_(weights),
|
||||
hasUnmapped_(false)
|
||||
{
|
||||
forAll(addressing_, i)
|
||||
for (const labelList& addr : addressing)
|
||||
{
|
||||
if (addressing_[i].size() == 0)
|
||||
if (addr.empty())
|
||||
{
|
||||
hasUnmapped_ = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,8 +100,7 @@ public:
|
||||
}
|
||||
|
||||
//- Destructor
|
||||
virtual ~distributedWeightedFvPatchFieldMapper()
|
||||
{}
|
||||
virtual ~distributedWeightedFvPatchFieldMapper() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -155,10 +155,10 @@ public:
|
||||
return surface().surfFaces();
|
||||
}
|
||||
|
||||
//- Const access to per-face zone/region information
|
||||
//- Per-face zone/region information
|
||||
virtual const labelList& zoneIds() const
|
||||
{
|
||||
return Foam::emptyLabelList;
|
||||
return labelList::null();
|
||||
}
|
||||
|
||||
//- Face area vectors
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010, 2016-2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2010, 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -217,10 +217,10 @@ public:
|
||||
return surface().surfFaces();
|
||||
}
|
||||
|
||||
//- Const access to per-face zone/region information
|
||||
//- Per-face zone/region information
|
||||
virtual const labelList& zoneIds() const
|
||||
{
|
||||
return Foam::emptyLabelList;
|
||||
return labelList::null();
|
||||
}
|
||||
|
||||
//- Face area magnitudes
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010, 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2010, 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -186,10 +186,10 @@ public:
|
||||
return MeshStorage::surfFaces();
|
||||
}
|
||||
|
||||
//- Const access to per-face zone/region information
|
||||
//- Per-face zone/region information
|
||||
virtual const labelList& zoneIds() const
|
||||
{
|
||||
return Foam::emptyLabelList;
|
||||
return labelList::null();
|
||||
}
|
||||
|
||||
//- Face area magnitudes
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2018 OpenFOAM Foundation
|
||||
@ -181,10 +181,10 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
//- Const access to per-face zone/region information
|
||||
//- Per-face zone/region information
|
||||
virtual const labelList& zoneIds() const
|
||||
{
|
||||
return Foam::emptyLabelList;
|
||||
return labelList::null();
|
||||
}
|
||||
|
||||
//- Face area magnitudes
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010, 2016-2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2010, 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -216,10 +216,10 @@ public:
|
||||
return surface().surfFaces();
|
||||
}
|
||||
|
||||
//- Const access to per-face zone/region information
|
||||
//- Per-face zone/region information
|
||||
virtual const labelList& zoneIds() const
|
||||
{
|
||||
return Foam::emptyLabelList;
|
||||
return labelList::null();
|
||||
}
|
||||
|
||||
//- Face area magnitudes
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -166,11 +166,11 @@ public:
|
||||
return cuttingSurface::surfFaces();
|
||||
}
|
||||
|
||||
//- Const access to per-face zone/region information
|
||||
//- Per-face zone/region information
|
||||
// Could instead return meshCells or cellZoneId of the meshCells.
|
||||
virtual const labelList& zoneIds() const
|
||||
{
|
||||
return Foam::emptyLabelList;
|
||||
return labelList::null();
|
||||
}
|
||||
|
||||
//- Face area magnitudes
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -108,10 +108,10 @@ public:
|
||||
return Mesh::surfFaces();
|
||||
}
|
||||
|
||||
//- Const access to per-face zone/region information
|
||||
//- Per-face zone/region information
|
||||
virtual const labelList& zoneIds() const
|
||||
{
|
||||
return Foam::emptyLabelList;
|
||||
return labelList::null();
|
||||
}
|
||||
|
||||
//- Face area magnitudes
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2011, 2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011, 2018-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -193,8 +193,8 @@ bool Foam::sampledPatch::update()
|
||||
// remap action on triangulation
|
||||
void Foam::sampledPatch::remapFaces(const labelUList& faceMap)
|
||||
{
|
||||
// recalculate the cells cut
|
||||
if (notNull(faceMap) && faceMap.size())
|
||||
// Recalculate the cells cut
|
||||
if (!faceMap.empty())
|
||||
{
|
||||
MeshStorage::remapFaces(faceMap);
|
||||
patchFaceLabels_ = labelList
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2011, 2016-2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011, 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -216,10 +216,10 @@ public:
|
||||
return MeshStorage::surfFaces();
|
||||
}
|
||||
|
||||
//- Const access to per-face zone/region information
|
||||
//- Per-face zone/region information
|
||||
virtual const labelList& zoneIds() const
|
||||
{
|
||||
return Foam::emptyLabelList;
|
||||
return labelList::null();
|
||||
}
|
||||
|
||||
//- Face area vectors
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010, 2016-2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2010, 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -192,11 +192,11 @@ public:
|
||||
return cuttingPlane::surfFaces();
|
||||
}
|
||||
|
||||
//- Const access to per-face zone/region information
|
||||
//- Per-face zone/region information
|
||||
// Could instead return meshCells or cellZoneId of the meshCells.
|
||||
virtual const labelList& zoneIds() const
|
||||
{
|
||||
return Foam::emptyLabelList;
|
||||
return labelList::null();
|
||||
}
|
||||
|
||||
//- Face area magnitudes
|
||||
|
||||
@ -297,7 +297,7 @@ public:
|
||||
//- when hasFaceIds is true.
|
||||
virtual const labelList& originalIds() const
|
||||
{
|
||||
return Foam::emptyLabelList;
|
||||
return labelList::null();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -265,7 +265,7 @@ public:
|
||||
return MeshStorage::surfFaces();
|
||||
}
|
||||
|
||||
//- Const access to per-face zone/region information
|
||||
//- Per-face zone/region information
|
||||
virtual const labelList& zoneIds() const
|
||||
{
|
||||
return zoneIds_;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010, 2016-2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2010, 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -181,10 +181,10 @@ public:
|
||||
return MeshStorage::surfFaces();
|
||||
}
|
||||
|
||||
//- Const access to per-face zone/region information
|
||||
//- Per-face zone/region information
|
||||
virtual const labelList& zoneIds() const
|
||||
{
|
||||
return Foam::emptyLabelList;
|
||||
return labelList::null();
|
||||
}
|
||||
|
||||
//- Face area vectors (normals)
|
||||
|
||||
@ -157,7 +157,7 @@ public:
|
||||
return MeshStorage::surfFaces();
|
||||
}
|
||||
|
||||
//- Const access to per-face zone/region information
|
||||
//- Per-face zone/region information
|
||||
virtual const labelList& zoneIds() const
|
||||
{
|
||||
return MeshStorage::zoneIds();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -76,7 +76,7 @@ void Foam::cuttingSurfaceBase::performCut
|
||||
|
||||
void Foam::cuttingSurfaceBase::remapFaces(const labelUList& faceMap)
|
||||
{
|
||||
if (notNull(faceMap) && !faceMap.empty())
|
||||
if (!faceMap.empty())
|
||||
{
|
||||
MeshStorage::remapFaces(faceMap);
|
||||
|
||||
|
||||
@ -270,7 +270,7 @@ public:
|
||||
bool update(const treeBoundBox&);
|
||||
|
||||
|
||||
//- Const access to per-face zone/region information
|
||||
//- Per-face zone/region information
|
||||
virtual const labelList& zoneIds() const
|
||||
{
|
||||
return zoneIds_;
|
||||
|
||||
Reference in New Issue
Block a user