From 018124e3bf3812238d4d0deb4842a2a8fb257073 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 21 Mar 2018 09:31:09 +0100 Subject: [PATCH] STYLE: use 'return nullptr' for empty autoPtr/tmp returns - both autoPtr and tmp are defined with an implicit construct from nullptr (but with explicit construct from a pointer to null). Thus is it safe to use 'nullptr' when returning an empty autoPtr or tmp. --- .../phaseModel/phaseModel.C | 2 +- .../twoPhaseMixtureEThermo.C | 12 ++++++------ .../multiphaseSystem/phaseModel/phaseModel.C | 2 +- .../multiphaseMixture/phase/phase.C | 2 +- .../IsothermalPhaseModel/IsothermalPhaseModel.C | 2 +- .../MultiComponentPhaseModel.C | 2 +- .../phaseModel/PurePhaseModel/PurePhaseModel.C | 3 +-- .../phaseModel/phaseModel/phaseModel.C | 2 +- .../IATE/IATEsources/IATEsource/IATEsource.H | 2 +- .../IATE/IATEsources/IATEsource/IATEsource.H | 2 +- .../DelaunayMesh/DistributedDelaunayMesh.C | 6 ++---- .../searchableSurfaceFeatures.H | 4 ++-- .../createBaffles/faceSelection/faceSelection.H | 2 +- .../faceSelection/faceZoneSelection.H | 2 +- .../faceSelection/searchableSurfaceSelection.H | 2 +- .../reconstructParMesh/reconstructParMesh.C | 2 +- .../lumped/lumpedPointForces/lumpedPointForces.C | 2 +- .../searchableSurfaceModifier/autoPatch.H | 2 +- .../surfacePatch/searchableSurfaceModifier/cut.H | 2 +- .../searchableSurfaceModifier.H | 2 +- .../functionObject/functionObject.H | 2 +- .../matrices/LUscalarMatrix/procLduInterface.H | 2 +- .../LduMatrix/LduMatrixPreconditioner.C | 2 +- .../LduMatrix/LduMatrix/LduMatrixSmoother.C | 2 +- .../LduMatrix/LduMatrix/LduMatrixSolver.C | 2 +- .../lduMatrix/lduMatrixPreconditioner.C | 2 +- .../lduMatrix/lduMatrix/lduMatrixSmoother.C | 2 +- .../lduMatrix/lduMatrix/lduMatrixSolver.C | 2 +- .../lduMatrix/lduMatrix/lduMatrixTemplates.C | 2 +- src/OpenFOAM/meshes/polyMesh/polyMesh.C | 2 +- .../functions/Function1/Function1/Function1.C | 4 ++-- .../schemes/DEShybrid/DEShybrid.H | 4 ++-- src/conversion/ccm/reader/ccmReaderMesh.C | 2 +- .../fvMeshDistribute/fvMeshDistribute.C | 2 +- src/dynamicMesh/meshCut/cellLooper/cellLooper.H | 2 +- .../motionSolvers/motionSolver/motionSolver.C | 2 +- .../polyTopoChanger/polyTopoChanger.C | 8 +++----- .../lnGradSchemes/lnGradScheme/lnGradScheme.H | 2 +- .../edgeInterpolationScheme.H | 2 +- src/finiteVolume/cfdTools/general/MRF/MRFZone.H | 2 +- .../cfdTools/general/fvOptions/fvOption.H | 2 +- .../CoEulerDdtScheme/CoEulerDdtScheme.C | 2 +- .../ReynoldsAnalogy/ReynoldsAnalogy.C | 4 ++-- .../solvers/energyTransport/energyTransport.C | 3 ++- .../solidificationMeltingSource.C | 8 +++----- .../viscousDissipation/viscousDissipation.C | 8 ++++---- .../MPPIC/ParticleStressModels/Lun/Lun.C | 2 +- .../DispersionRASModel/DispersionRASModel.C | 4 ++-- .../BrownianMotion/BrownianMotionForce.C | 2 +- src/lumpedPointMotion/lumpedPointTools.C | 2 +- .../blockMesh/blockEdges/blockEdge/blockEdge.C | 2 +- .../blockMesh/blockFaces/blockFace/blockFace.C | 2 +- .../blockVertices/blockVertex/blockVertex.C | 4 ++-- src/mesh/blockMesh/blocks/block/block.H | 2 +- .../coordinateRotation/EulerCoordinateRotation.C | 10 +++++----- .../STARCDCoordinateRotation.C | 10 +++++----- .../coordinateRotation/axesRotation.C | 4 ++-- .../searchableSurface/searchableSurface.H | 2 +- src/meshTools/sets/topoSetSource/topoSetSource.H | 2 +- src/meshTools/sets/topoSets/topoSet.H | 2 +- .../pyrolysisModel/pyrolysisModel.H | 2 +- src/sampling/sampledSet/sampledSet/sampledSet.H | 2 +- .../sampledSurface/sampledSurface.C | 10 +++++----- .../sampledSurface/sampledSurface.H | 2 +- .../sampledTriSurfaceMeshNormal.H | 16 ++++++++-------- .../surfMeshSampler/surfMeshSampler.H | 2 +- .../triSurfaceMesh/discreteSurfaceTemplates.C | 6 ++---- src/surfMesh/surfZone/surfZone/surfZone.H | 2 +- 68 files changed, 109 insertions(+), 117 deletions(-) diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.C b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.C index ac37bac4ae..a59534e603 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.C @@ -81,7 +81,7 @@ Foam::phaseModel::phaseModel Foam::autoPtr Foam::phaseModel::clone() const { NotImplemented; - return autoPtr(); + return nullptr; } diff --git a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C index 751df5fcb7..3cfbfe89ed 100644 --- a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C +++ b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C @@ -259,7 +259,7 @@ Foam::tmp Foam::twoPhaseMixtureEThermo::THE ) const { NotImplemented; - return tmp(); + return nullptr; } @@ -272,7 +272,7 @@ Foam::tmp Foam::twoPhaseMixtureEThermo::THE ) const { NotImplemented; - return tmp(); + return nullptr; } @@ -436,8 +436,8 @@ Foam::tmp Foam::twoPhaseMixtureEThermo::Cpv Foam::tmp Foam::twoPhaseMixtureEThermo::CpByCpv() const { - NotImplemented; - return tmp(); + NotImplemented; + return nullptr; } @@ -448,8 +448,8 @@ Foam::tmp Foam::twoPhaseMixtureEThermo::CpByCpv const label patchi ) const { - NotImplemented; - return tmp(); + NotImplemented; + return nullptr; } diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C index cc6790499f..9b66605cf8 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C @@ -205,7 +205,7 @@ Foam::phaseModel::~phaseModel() Foam::autoPtr Foam::phaseModel::clone() const { NotImplemented; - return autoPtr(); + return nullptr; } diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C index e14906619b..e7a5603c9f 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C @@ -68,7 +68,7 @@ Foam::phase::phase Foam::autoPtr Foam::phase::clone() const { NotImplemented; - return autoPtr(); + return nullptr; } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.C index 95a9f0c38b..8677e02a47 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.C @@ -65,7 +65,7 @@ template Foam::tmp Foam::IsothermalPhaseModel::heEqn() { - return tmp(); + return nullptr; } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MultiComponentPhaseModel/MultiComponentPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MultiComponentPhaseModel/MultiComponentPhaseModel.C index 171f2f3878..7547954fd5 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MultiComponentPhaseModel/MultiComponentPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MultiComponentPhaseModel/MultiComponentPhaseModel.C @@ -152,7 +152,7 @@ Foam::MultiComponentPhaseModel::YiEqn ) ) { - return tmp(); + return nullptr; } const volScalarField& alpha = *this; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/PurePhaseModel/PurePhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/PurePhaseModel/PurePhaseModel.C index 9d94f7627e..db8556d47d 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/PurePhaseModel/PurePhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/PurePhaseModel/PurePhaseModel.C @@ -57,8 +57,7 @@ Foam::PurePhaseModel::YiEqn ) { NotImplemented; - - return tmp(); + return nullptr; } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C index 4d183cd0a2..68e85badef 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C @@ -77,7 +77,7 @@ Foam::phaseModel::phaseModel Foam::autoPtr Foam::phaseModel::clone() const { NotImplemented; - return autoPtr(); + return nullptr; } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H index db917c4865..1e3b3f1f4c 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H @@ -115,7 +115,7 @@ public: autoPtr clone() const { NotImplemented; - return autoPtr(); + return nullptr; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H index 29c150ce74..964df057ce 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H @@ -114,7 +114,7 @@ public: autoPtr clone() const { NotImplemented; - return autoPtr(); + return nullptr; } diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C index 620bd04dec..f6e6c75aba 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C @@ -794,14 +794,12 @@ Foam::DistributedDelaunayMesh::distribute { if (!Pstream::parRun()) { - return autoPtr(); + return nullptr; } distributeBoundBoxes(decomposition.procBounds()); - autoPtr mapDist = decomposition.distributePoints(points); - - return mapDist; + return decomposition.distributePoints(points); } diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchableSurfaceFeatures.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchableSurfaceFeatures.H index fe1c509207..f42e974f0a 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchableSurfaceFeatures.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchableSurfaceFeatures.H @@ -101,7 +101,7 @@ public: virtual autoPtr clone() const { NotImplemented; - return autoPtr(); + return nullptr; } @@ -139,7 +139,7 @@ public: //- Return an extendedFeatureEdgeMesh containing the features virtual autoPtr features() const { - return autoPtr(); + return nullptr; } }; diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.H b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.H index b17f016212..04a95cf0ce 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.H +++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.H @@ -109,7 +109,7 @@ public: autoPtr clone() const { NotImplemented; - return autoPtr(); + return nullptr; } diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.H b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.H index 20e7f66fe5..ac19cf0ed7 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.H +++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.H @@ -86,7 +86,7 @@ public: autoPtr clone() const { NotImplemented; - return autoPtr(); + return nullptr; } diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.H b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.H index 8f934ae3c3..fb76b1c486 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.H +++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.H @@ -79,7 +79,7 @@ public: autoPtr clone() const { NotImplemented; - return autoPtr(); + return nullptr; } diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C index a61b582980..6c0c7b96cf 100644 --- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C +++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C @@ -251,7 +251,7 @@ autoPtr mergeSharedPoints if (returnReduce(pointToMaster.size(), sumOp