From 1e772411f655dfa7b9bda739906c7141654fcab8 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Thu, 7 Feb 2019 13:04:24 +0100 Subject: [PATCH] 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. --- .../distributedUnallocatedDirectFieldMapper.H | 20 +++++-------------- ...butedUnallocatedDirectFvPatchFieldMapper.H | 20 +++++-------------- .../dynamicIndexedOctree.C | 4 ++-- .../algorithms/indexedOctree/indexedOctree.C | 4 ++-- src/OpenFOAM/containers/Lists/List/List.H | 1 + .../fields/Fields/Field/directFieldMapper.H | 15 +++++--------- .../directPointPatchFieldMapper.H | 15 +++++--------- .../pointMeshMapper/pointPatchMapper.C | 1 + .../globalMeshData/globalMeshDataTemplates.C | 6 +++--- .../fvPatchField/directFvPatchFieldMapper.H | 15 +++++--------- .../singleCellFvMesh/singleCellFvMesh.H | 6 +++--- .../distributedWeightedFvPatchFieldMapper.H | 10 +++++----- .../distanceSurface/sampledDistanceSurface.H | 6 +++--- .../isoSurface/sampledIsoSurface.H | 6 +++--- .../isoSurface/sampledIsoSurfaceCell.H | 6 +++--- .../isoSurface/sampledIsoSurfaceTopo.H | 6 +++--- .../sampledCuttingPlane/sampledCuttingPlane.H | 6 +++--- .../sampledCuttingSurface.H | 6 +++--- .../sampledSurface/sampledNone/sampledNone.H | 6 +++--- .../sampledPatch/sampledPatch.C | 6 +++--- .../sampledPatch/sampledPatch.H | 6 +++--- .../sampledPlane/sampledPlane.H | 6 +++--- .../sampledSurface/sampledSurface.H | 2 +- .../sampledTriSurfaceMesh.H | 2 +- .../sampledThresholdCellFaces.H | 6 +++--- .../triSurfaceMesh/sampledDiscreteSurface.H | 2 +- .../surface/cutting/cuttingSurfaceBase.C | 4 ++-- .../surface/triSurfaceMesh/discreteSurface.H | 2 +- src/surfMesh/MeshedSurface/MeshedSurface.C | 2 +- .../UnsortedMeshedSurface.C | 4 ++-- 30 files changed, 84 insertions(+), 117 deletions(-) diff --git a/applications/utilities/parallelProcessing/redistributePar/distributedUnallocatedDirectFieldMapper.H b/applications/utilities/parallelProcessing/redistributePar/distributedUnallocatedDirectFieldMapper.H index aceffd88105..e534705a2ba 100644 --- a/applications/utilities/parallelProcessing/redistributePar/distributedUnallocatedDirectFieldMapper.H +++ b/applications/utilities/parallelProcessing/redistributePar/distributedUnallocatedDirectFieldMapper.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2015 OpenFOAM Foundation @@ -66,22 +66,12 @@ public: : directAddressing_(directAddressing), distMap_(distMap), - hasUnmapped_(false) - { - if - ( - notNull(directAddressing_) - && directAddressing_.size() - && min(directAddressing_) < 0 - ) - { - hasUnmapped_ = true; - } - } + hasUnmapped_(directAddressing_.size() && min(directAddressing_) < 0) + {} + //- Destructor - virtual ~distributedUnallocatedDirectFieldMapper() - {} + virtual ~distributedUnallocatedDirectFieldMapper() = default; // Member Functions diff --git a/applications/utilities/parallelProcessing/redistributePar/distributedUnallocatedDirectFvPatchFieldMapper.H b/applications/utilities/parallelProcessing/redistributePar/distributedUnallocatedDirectFvPatchFieldMapper.H index 90baab780da..7d38e871ae7 100644 --- a/applications/utilities/parallelProcessing/redistributePar/distributedUnallocatedDirectFvPatchFieldMapper.H +++ b/applications/utilities/parallelProcessing/redistributePar/distributedUnallocatedDirectFvPatchFieldMapper.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2015 OpenFOAM Foundation @@ -68,22 +68,12 @@ public: : directAddressing_(directAddressing), distMap_(distMap), - hasUnmapped_(false) - { - if - ( - notNull(directAddressing_) - && directAddressing_.size() - && min(directAddressing_) < 0 - ) - { - hasUnmapped_ = true; - } - } + hasUnmapped_(directAddressing_.size() && min(directAddressing_) < 0) + {} + //- Destructor - virtual ~distributedUnallocatedDirectFvPatchFieldMapper() - {} + virtual ~distributedUnallocatedDirectFvPatchFieldMapper() = default; // Member Functions diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C index f58689713f6..02c441a933c 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -2400,7 +2400,7 @@ const Foam::labelList& Foam::dynamicIndexedOctree<Type>::findIndices return *(contents_[getContent(contentIndex)]); } - return Foam::emptyLabelList; + return labelList::null(); } diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C index 047f1176a67..65afcd52a8e 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C +++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C @@ -2662,7 +2662,7 @@ const Foam::labelList& Foam::indexedOctree<Type>::findIndices { if (nodes_.empty()) { - return Foam::emptyLabelList; + return labelList::null(); } labelBits index = findNode(0, sample); @@ -2677,7 +2677,7 @@ const Foam::labelList& Foam::indexedOctree<Type>::findIndices return contents_[getContent(contentIndex)]; } - return Foam::emptyLabelList; + return labelList::null(); } diff --git a/src/OpenFOAM/containers/Lists/List/List.H b/src/OpenFOAM/containers/Lists/List/List.H index 1344814f3b7..c0828badf36 100644 --- a/src/OpenFOAM/containers/Lists/List/List.H +++ b/src/OpenFOAM/containers/Lists/List/List.H @@ -76,6 +76,7 @@ typedef List<char> charList; typedef List<label> labelList; //- A zero-sized list of labels +// \deprecated(2019-02) use labelList::null() instead extern const labelList emptyLabelList; diff --git a/src/OpenFOAM/fields/Fields/Field/directFieldMapper.H b/src/OpenFOAM/fields/Fields/Field/directFieldMapper.H index a0439f964ff..cced1da9c35 100644 --- a/src/OpenFOAM/fields/Fields/Field/directFieldMapper.H +++ b/src/OpenFOAM/fields/Fields/Field/directFieldMapper.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2013-2018 OpenFOAM Foundation @@ -59,17 +59,12 @@ public: directFieldMapper(const labelUList& directAddressing) : directAddressing_(directAddressing), - hasUnmapped_(false) - { - if (directAddressing_.size() && min(directAddressing_) < 0) - { - hasUnmapped_ = true; - } - } + hasUnmapped_(directAddressing_.size() && min(directAddressing_) < 0) + {} + //- Destructor - virtual ~directFieldMapper() - {} + virtual ~directFieldMapper() = default; // Member Functions diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/directPointPatchFieldMapper.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/directPointPatchFieldMapper.H index 3b3682cd215..95891f80eee 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/directPointPatchFieldMapper.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/directPointPatchFieldMapper.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2013 OpenFOAM Foundation @@ -65,17 +65,12 @@ public: directPointPatchFieldMapper(const labelUList& directAddressing) : directAddressing_(directAddressing), - hasUnmapped_(false) - { - if (directAddressing_.size() && min(directAddressing_) < 0) - { - hasUnmapped_ = true; - } - } + hasUnmapped_(directAddressing_.size() && min(directAddressing_) < 0) + {} + //- Destructor - virtual ~directPointPatchFieldMapper() - {} + virtual ~directPointPatchFieldMapper() = default; // Member Functions diff --git a/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointPatchMapper.C b/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointPatchMapper.C index d54b8204dc0..13d8e7b1999 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointPatchMapper.C +++ b/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointPatchMapper.C @@ -60,6 +60,7 @@ void Foam::pointPatchMapper::calcAddressing() const if (addr[i] < 0) { hasUnmapped_ = true; + break; } } } diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshDataTemplates.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshDataTemplates.C index a23d3f7ca16..c271ed12727 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshDataTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshDataTemplates.C @@ -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-2015 OpenFOAM Foundation @@ -56,7 +56,7 @@ void Foam::globalMeshData::syncData const labelList& transformSlavePoints = ( transformedSlaves.empty() - ? Foam::emptyLabelList + ? labelList::null() : transformedSlaves[i] ); @@ -119,7 +119,7 @@ void Foam::globalMeshData::syncData const labelList& transformSlavePoints = ( transformedSlaves.empty() - ? Foam::emptyLabelList + ? labelList::null() : transformedSlaves[i] ); diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/directFvPatchFieldMapper.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/directFvPatchFieldMapper.H index 4de5fb9b336..818c4017461 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/directFvPatchFieldMapper.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/directFvPatchFieldMapper.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2013 OpenFOAM Foundation @@ -65,17 +65,12 @@ public: directFvPatchFieldMapper(const labelUList& directAddressing) : directAddressing_(directAddressing), - hasUnmapped_(false) - { - if (directAddressing_.size() && min(directAddressing_) < 0) - { - hasUnmapped_ = true; - } - } + hasUnmapped_(directAddressing_.size() && min(directAddressing_) < 0) + {} + //- Destructor - virtual ~directFvPatchFieldMapper() - {} + virtual ~directFvPatchFieldMapper() = default; // Member Functions diff --git a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.H b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.H index 6c861a40033..8f50bf0438a 100644 --- a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.H +++ b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2010, 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -113,9 +113,9 @@ public: weights_(weights), hasUnmapped_(false) { - forAll(addressing_, i) + for (const labelList& addr : addressing) { - if (addressing_[i].empty()) + if (addr.empty()) { hasUnmapped_ = true; break; diff --git a/src/sampling/meshToMesh/distributedWeightedFvPatchFieldMapper.H b/src/sampling/meshToMesh/distributedWeightedFvPatchFieldMapper.H index f8b0fc02f43..917beae3ae2 100644 --- a/src/sampling/meshToMesh/distributedWeightedFvPatchFieldMapper.H +++ b/src/sampling/meshToMesh/distributedWeightedFvPatchFieldMapper.H @@ -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 diff --git a/src/sampling/sampledSurface/distanceSurface/sampledDistanceSurface.H b/src/sampling/sampledSurface/distanceSurface/sampledDistanceSurface.H index 5202bb8673e..2a10e19cba6 100644 --- a/src/sampling/sampledSurface/distanceSurface/sampledDistanceSurface.H +++ b/src/sampling/sampledSurface/distanceSurface/sampledDistanceSurface.H @@ -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 diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H index d7c02252098..be953a7ae19 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H @@ -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 diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H index 927873b4873..743fc574553 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H @@ -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 diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTopo.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTopo.H index a0a1b1dba21..e7849066efe 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTopo.H +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTopo.H @@ -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 diff --git a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H index 99abe6f4bcb..0e5e8c2463a 100644 --- a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H +++ b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H @@ -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 diff --git a/src/sampling/sampledSurface/sampledCuttingSurface/sampledCuttingSurface.H b/src/sampling/sampledSurface/sampledCuttingSurface/sampledCuttingSurface.H index 575ee6936c7..342af4069bf 100644 --- a/src/sampling/sampledSurface/sampledCuttingSurface/sampledCuttingSurface.H +++ b/src/sampling/sampledSurface/sampledCuttingSurface/sampledCuttingSurface.H @@ -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 diff --git a/src/sampling/sampledSurface/sampledNone/sampledNone.H b/src/sampling/sampledSurface/sampledNone/sampledNone.H index 0743927c16f..f0dc4aedb5d 100644 --- a/src/sampling/sampledSurface/sampledNone/sampledNone.H +++ b/src/sampling/sampledSurface/sampledNone/sampledNone.H @@ -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 diff --git a/src/sampling/sampledSurface/sampledPatch/sampledPatch.C b/src/sampling/sampledSurface/sampledPatch/sampledPatch.C index f49a9965934..561f368cdac 100644 --- a/src/sampling/sampledSurface/sampledPatch/sampledPatch.C +++ b/src/sampling/sampledSurface/sampledPatch/sampledPatch.C @@ -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 diff --git a/src/sampling/sampledSurface/sampledPatch/sampledPatch.H b/src/sampling/sampledSurface/sampledPatch/sampledPatch.H index 68e05946cb4..3362463ef33 100644 --- a/src/sampling/sampledSurface/sampledPatch/sampledPatch.H +++ b/src/sampling/sampledSurface/sampledPatch/sampledPatch.H @@ -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 diff --git a/src/sampling/sampledSurface/sampledPlane/sampledPlane.H b/src/sampling/sampledSurface/sampledPlane/sampledPlane.H index 2e57549d2d5..77ce06cb97a 100644 --- a/src/sampling/sampledSurface/sampledPlane/sampledPlane.H +++ b/src/sampling/sampledSurface/sampledPlane/sampledPlane.H @@ -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 diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurface.H b/src/sampling/sampledSurface/sampledSurface/sampledSurface.H index ce1d61864d6..640a8c3cfbf 100644 --- a/src/sampling/sampledSurface/sampledSurface/sampledSurface.H +++ b/src/sampling/sampledSurface/sampledSurface/sampledSurface.H @@ -297,7 +297,7 @@ public: //- when hasFaceIds is true. virtual const labelList& originalIds() const { - return Foam::emptyLabelList; + return labelList::null(); } diff --git a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H index 142532f9520..3b79d27b223 100644 --- a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H +++ b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H @@ -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_; diff --git a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H index 731ea67fd17..8c528db81c9 100644 --- a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H +++ b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H @@ -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) diff --git a/src/sampling/sampledSurface/triSurfaceMesh/sampledDiscreteSurface.H b/src/sampling/sampledSurface/triSurfaceMesh/sampledDiscreteSurface.H index d8fcd04bf93..bc27db4226c 100644 --- a/src/sampling/sampledSurface/triSurfaceMesh/sampledDiscreteSurface.H +++ b/src/sampling/sampledSurface/triSurfaceMesh/sampledDiscreteSurface.H @@ -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(); diff --git a/src/sampling/surface/cutting/cuttingSurfaceBase.C b/src/sampling/surface/cutting/cuttingSurfaceBase.C index 699f367da63..2589ece5ac7 100644 --- a/src/sampling/surface/cutting/cuttingSurfaceBase.C +++ b/src/sampling/surface/cutting/cuttingSurfaceBase.C @@ -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); diff --git a/src/sampling/surface/triSurfaceMesh/discreteSurface.H b/src/sampling/surface/triSurfaceMesh/discreteSurface.H index 6e440d033a1..b4a8e0ce313 100644 --- a/src/sampling/surface/triSurfaceMesh/discreteSurface.H +++ b/src/sampling/surface/triSurfaceMesh/discreteSurface.H @@ -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_; diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.C b/src/surfMesh/MeshedSurface/MeshedSurface.C index d3f43ec11a1..a750eb2e5b4 100644 --- a/src/surfMesh/MeshedSurface/MeshedSurface.C +++ b/src/surfMesh/MeshedSurface/MeshedSurface.C @@ -466,7 +466,7 @@ void Foam::MeshedSurface<Face>::remapFaces const labelUList& faceMap ) { - if (isNull(faceMap) || faceMap.empty()) + if (faceMap.empty()) { return; } diff --git a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C index 083d47fdc4a..2785f281321 100644 --- a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C +++ b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010, 2016-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2010, 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -386,7 +386,7 @@ void Foam::UnsortedMeshedSurface<Face>::remapFaces ) { // Re-assign the zone Ids - if (isNull(faceMap) || faceMap.empty()) + if (faceMap.empty()) { return; } -- GitLab