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.
This commit is contained in:
Mark Olesen 2018-03-21 09:31:09 +01:00
parent 2f86cdc712
commit 018124e3bf
68 changed files with 109 additions and 117 deletions

View File

@ -81,7 +81,7 @@ Foam::phaseModel::phaseModel
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
{
NotImplemented;
return autoPtr<phaseModel>();
return nullptr;
}

View File

@ -259,7 +259,7 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::THE
) const
{
NotImplemented;
return tmp<Foam::scalarField>();
return nullptr;
}
@ -272,7 +272,7 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::THE
) const
{
NotImplemented;
return tmp<Foam::scalarField>();
return nullptr;
}
@ -436,8 +436,8 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::Cpv
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::CpByCpv() const
{
NotImplemented;
return tmp<Foam::volScalarField>();
NotImplemented;
return nullptr;
}
@ -448,8 +448,8 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::CpByCpv
const label patchi
) const
{
NotImplemented;
return tmp<Foam::scalarField>();
NotImplemented;
return nullptr;
}

View File

@ -205,7 +205,7 @@ Foam::phaseModel::~phaseModel()
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
{
NotImplemented;
return autoPtr<phaseModel>();
return nullptr;
}

View File

@ -68,7 +68,7 @@ Foam::phase::phase
Foam::autoPtr<Foam::phase> Foam::phase::clone() const
{
NotImplemented;
return autoPtr<phase>();
return nullptr;
}

View File

@ -65,7 +65,7 @@ template<class BasePhaseModel>
Foam::tmp<Foam::fvScalarMatrix>
Foam::IsothermalPhaseModel<BasePhaseModel>::heEqn()
{
return tmp<fvScalarMatrix>();
return nullptr;
}

View File

@ -152,7 +152,7 @@ Foam::MultiComponentPhaseModel<BasePhaseModel>::YiEqn
)
)
{
return tmp<fvScalarMatrix>();
return nullptr;
}
const volScalarField& alpha = *this;

View File

@ -57,8 +57,7 @@ Foam::PurePhaseModel<BasePhaseModel>::YiEqn
)
{
NotImplemented;
return tmp<fvScalarMatrix>();
return nullptr;
}

View File

@ -77,7 +77,7 @@ Foam::phaseModel::phaseModel
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
{
NotImplemented;
return autoPtr<phaseModel>();
return nullptr;
}

View File

@ -115,7 +115,7 @@ public:
autoPtr<IATEsource> clone() const
{
NotImplemented;
return autoPtr<IATEsource>();
return nullptr;
}

View File

@ -114,7 +114,7 @@ public:
autoPtr<IATEsource> clone() const
{
NotImplemented;
return autoPtr<IATEsource>();
return nullptr;
}

View File

@ -794,14 +794,12 @@ Foam::DistributedDelaunayMesh<Triangulation>::distribute
{
if (!Pstream::parRun())
{
return autoPtr<mapDistribute>();
return nullptr;
}
distributeBoundBoxes(decomposition.procBounds());
autoPtr<mapDistribute> mapDist = decomposition.distributePoints(points);
return mapDist;
return decomposition.distributePoints(points);
}

View File

@ -101,7 +101,7 @@ public:
virtual autoPtr<searchableSurfaceFeatures> clone() const
{
NotImplemented;
return autoPtr<searchableSurfaceFeatures>();
return nullptr;
}
@ -139,7 +139,7 @@ public:
//- Return an extendedFeatureEdgeMesh containing the features
virtual autoPtr<extendedFeatureEdgeMesh> features() const
{
return autoPtr<extendedFeatureEdgeMesh>();
return nullptr;
}
};

View File

@ -109,7 +109,7 @@ public:
autoPtr<faceSelection> clone() const
{
NotImplemented;
return autoPtr<faceSelection>();
return nullptr;
}

View File

@ -86,7 +86,7 @@ public:
autoPtr<faceSelection> clone() const
{
NotImplemented;
return autoPtr<faceSelection>();
return nullptr;
}

View File

@ -79,7 +79,7 @@ public:
autoPtr<faceSelection> clone() const
{
NotImplemented;
return autoPtr<faceSelection>();
return nullptr;
}

View File

@ -251,7 +251,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints
if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0)
{
return autoPtr<mapPolyMesh>();
return nullptr;
}
polyTopoChange meshMod(mesh);

View File

@ -71,7 +71,7 @@ autoPtr<GeoFieldType> loadField
);
}
return autoPtr<GeoFieldType>();
return nullptr;
}

View File

@ -76,7 +76,7 @@ public:
autoPtr<searchableSurfaceModifier> clone() const
{
NotImplemented;
return autoPtr<searchableSurfaceModifier>();
return nullptr;
}

View File

@ -100,7 +100,7 @@ public:
autoPtr<searchableSurfaceModifier> clone() const
{
NotImplemented;
return autoPtr<searchableSurfaceModifier>();
return nullptr;
}

View File

@ -96,7 +96,7 @@ public:
autoPtr<searchableSurfaceModifier> clone() const
{
NotImplemented;
return autoPtr<searchableSurfaceModifier>();
return nullptr;
}

View File

@ -197,7 +197,7 @@ public:
autoPtr<functionObject> clone() const
{
NotImplemented;
return autoPtr<functionObject>();
return nullptr;
}

View File

@ -93,7 +93,7 @@ public:
autoPtr<procLduInterface> clone()
{
NotImplemented;
return autoPtr<procLduInterface>();
return nullptr;
}
static autoPtr<procLduInterface> New(Istream& is)

View File

@ -97,7 +97,7 @@ Foam::LduMatrix<Type, DType, LUType>::preconditioner::New
"no diagonal or off-diagonal coefficient"
<< exit(FatalIOError);
return autoPtr<typename LduMatrix<Type, DType, LUType>::preconditioner>();
return nullptr;
}

View File

@ -89,7 +89,7 @@ Foam::LduMatrix<Type, DType, LUType>::smoother::New
<< "cannot solve incomplete matrix, no off-diagonal coefficients"
<< exit(FatalIOError);
return autoPtr<typename LduMatrix<Type, DType, LUType>::smoother>();
return nullptr;
}

View File

@ -105,7 +105,7 @@ Foam::LduMatrix<Type, DType, LUType>::solver::New
"no diagonal or off-diagonal coefficient"
<< exit(FatalIOError);
return autoPtr<typename LduMatrix<Type, DType, LUType>::solver>();
return nullptr;
}

View File

@ -138,7 +138,7 @@ Foam::lduMatrix::preconditioner::New
"no diagonal or off-diagonal coefficient"
<< exit(FatalIOError);
return autoPtr<lduMatrix::preconditioner>();
return nullptr;
}

View File

@ -142,7 +142,7 @@ Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New
"no diagonal or off-diagonal coefficient"
<< exit(FatalIOError);
return autoPtr<lduMatrix::smoother>();
return nullptr;
}

View File

@ -122,7 +122,7 @@ Foam::autoPtr<Foam::lduMatrix::solver> Foam::lduMatrix::solver::New
"no diagonal or off-diagonal coefficient"
<< exit(FatalIOError);
return autoPtr<lduMatrix::solver>();
return nullptr;
}

View File

@ -104,7 +104,7 @@ Foam::lduMatrix::faceH(const Field<Type>& psi) const
" the matrix does not have any off-diagonal coefficients."
<< exit(FatalError);
return tmp<Field<Type>>();
return nullptr;
}

View File

@ -152,7 +152,7 @@ Foam::autoPtr<Foam::labelIOList> Foam::polyMesh::readTetBasePtIs() const
return autoPtr<labelIOList>::New(io);
}
return autoPtr<labelIOList>();
return nullptr;
}

View File

@ -79,7 +79,7 @@ Foam::tmp<Foam::Field<Type>> Foam::Function1<Type>::value
) const
{
NotImplemented;
return tmp<Field<Type>>();
return nullptr;
}
@ -100,7 +100,7 @@ Foam::tmp<Foam::Field<Type>> Foam::Function1<Type>::integrate
) const
{
NotImplemented;
return tmp<Field<Type>>();
return nullptr;
}

View File

@ -423,7 +423,7 @@ public:
<< "Unable to retrieve turbulence model from the mesh "
<< "database" << exit(FatalError);
return tmp<surfaceScalarField>();
return nullptr;
}
@ -500,7 +500,7 @@ public:
return (bf*tScheme2_().correction(vf));
}
return tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>();
return nullptr;
}
};

View File

@ -2591,7 +2591,7 @@ Foam::autoPtr<Foam::polyMesh> Foam::ccm::reader::mesh
{
if (!readGeometry())
{
return autoPtr<polyMesh>();
return nullptr;
}
// merge cellTable and rename boundaryRegion

View File

@ -704,7 +704,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::mergeSharedPoints
if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0)
{
return autoPtr<mapPolyMesh>();
return nullptr;
}
polyTopoChange meshMod(mesh_);

View File

@ -145,7 +145,7 @@ public:
autoPtr<cellLooper> clone() const
{
NotImplemented;
return autoPtr<cellLooper>();
return nullptr;
}

View File

@ -92,7 +92,7 @@ Foam::motionSolver::motionSolver
Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::clone() const
{
NotImplemented;
return autoPtr<motionSolver>();
return nullptr;
}

View File

@ -283,11 +283,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChanger::changeMesh
mesh_.updateMesh(topoChangeMap());
return topoChangeMap;
}
else
{
mesh_.topoChanging(false);
return autoPtr<mapPolyMesh>();
}
mesh_.topoChanging(false);
return nullptr;
}

View File

@ -148,7 +148,7 @@ public:
virtual tmp<GeometricField<Type, faePatchField, edgeMesh>>
correction(const GeometricField<Type, faPatchField, areaMesh>&) const
{
return tmp<GeometricField<Type, faePatchField, edgeMesh>>();
return nullptr;
}
//- Return the lnGrad of the given cell field

View File

@ -189,7 +189,7 @@ public:
virtual tmp<GeometricField<Type, faePatchField, edgeMesh>>
correction(const GeometricField<Type, faPatchField, areaMesh>&) const
{
return tmp<GeometricField<Type, faePatchField, edgeMesh>>();
return nullptr;
}
//- Return the face-interpolate of the given cell field

View File

@ -174,7 +174,7 @@ public:
autoPtr<MRFZone> clone() const
{
NotImplemented;
return autoPtr<MRFZone>();
return nullptr;
}

View File

@ -133,7 +133,7 @@ public:
autoPtr<option> clone() const
{
NotImplemented;
return autoPtr<option>();
return nullptr;
}
//- Return pointer to new fvOption object created

View File

@ -140,7 +140,7 @@ tmp<surfaceScalarField> CoEulerDdtScheme<Type>::CofrDeltaT() const
<< "Incorrect dimensions of phi: " << phi.dimensions()
<< abort(FatalError);
return tmp<surfaceScalarField>();
return nullptr;
}

View File

@ -67,7 +67,7 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::rho(const label patchi) const
<< "Unable to set rho for patch " << patchi
<< exit(FatalError);
return tmp<Field<scalar>>();
return nullptr;
}
@ -94,7 +94,7 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::Cp(const label patchi) const
<< "Unable to set Cp for patch " << patchi
<< exit(FatalError);
return tmp<Field<scalar>>();
return nullptr;
}

View File

@ -105,7 +105,8 @@ Foam::functionObjects::energyTransport::kappaEff() const
FatalErrorInFunction
<< "Turbulence model not found" << exit(FatalError);
return tmp<volScalarField>();
return nullptr;
}

View File

@ -116,7 +116,7 @@ Foam::fv::solidificationMeltingSource::Cp() const
}
}
return tmp<volScalarField>();
return nullptr;
}
@ -128,10 +128,8 @@ Foam::vector Foam::fv::solidificationMeltingSource::g() const
mesh_.lookupObject<uniformDimensionedVectorField>("g");
return value.value();
}
else
{
return coeffs_.lookup("g");
}
return coeffs_.lookup("g");
}

View File

@ -82,7 +82,7 @@ Foam::tmp<Foam::volScalarField> Foam::fv::viscousDissipation::rho() const
<< "Neither rhoName nor rho are specified."
<< exit(FatalError);
return tmp<volScalarField>();
return nullptr;
}
@ -133,8 +133,8 @@ Foam::fv::viscousDissipation::viscousDissipation
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volSymmTensorField> Foam::fv::viscousDissipation::
devRhoReff() const
Foam::tmp<Foam::volSymmTensorField>
Foam::fv::viscousDissipation::devRhoReff() const
{
// Incompressible
{
@ -166,7 +166,7 @@ devRhoReff() const
<< " The turbulence model is not found in the database."
<< exit(FatalError);
return tmp<volSymmTensorField>();
return nullptr;
}

View File

@ -109,7 +109,7 @@ Foam::ParticleStressModels::Lun::dTaudTheta
) const
{
NotImplemented;
return tmp<Field<scalar>>();
return nullptr;
}

View File

@ -53,7 +53,7 @@ Foam::DispersionRASModel<CloudType>::kModel() const
<< "Database objects include: " << obr.sortedToc()
<< abort(FatalError);
return tmp<volScalarField>();
return nullptr;
}
@ -81,7 +81,7 @@ Foam::DispersionRASModel<CloudType>::epsilonModel() const
<< "Database objects include: " << obr.sortedToc()
<< abort(FatalError);
return tmp<volScalarField>();
return nullptr;
}

View File

@ -76,7 +76,7 @@ Foam::BrownianMotionForce<CloudType>::kModel() const
<< "Database objects include: " << obr.sortedToc()
<< abort(FatalError);
return tmp<volScalarField>();
return nullptr;
}

View File

@ -62,7 +62,7 @@ namespace Foam
);
}
return autoPtr<GeoFieldType>();
return nullptr;
}
}

View File

@ -67,7 +67,7 @@ Foam::blockEdge::blockEdge
Foam::autoPtr<Foam::blockEdge> Foam::blockEdge::clone() const
{
NotImplemented;
return autoPtr<blockEdge>();
return nullptr;
}

View File

@ -65,7 +65,7 @@ Foam::blockFace::blockFace
Foam::autoPtr<Foam::blockFace> Foam::blockFace::clone() const
{
NotImplemented;
return autoPtr<blockFace>();
return nullptr;
}

View File

@ -45,7 +45,7 @@ Foam::blockVertex::blockVertex()
Foam::autoPtr<Foam::blockVertex> Foam::blockVertex::clone() const
{
NotImplemented;
return autoPtr<blockVertex>();
return nullptr;
}
@ -98,7 +98,7 @@ Foam::autoPtr<Foam::blockVertex> Foam::blockVertex::New
<< firstToken.info()
<< exit(FatalIOError);
return autoPtr<blockVertex>();
return nullptr;
}

View File

@ -134,7 +134,7 @@ public:
autoPtr<block> clone() const
{
NotImplemented;
return autoPtr<block>();
return nullptr;
}
//- New function which constructs and returns pointer to a block

View File

@ -70,7 +70,7 @@ Foam::tmp<Foam::vectorField> Foam::EulerCoordinateRotation::transform
) const
{
NotImplemented;
return tmp<vectorField>();
return nullptr;
}
@ -80,7 +80,7 @@ Foam::tmp<Foam::vectorField> Foam::EulerCoordinateRotation::invTransform
) const
{
NotImplemented;
return tmp<vectorField>();
return nullptr;
}
@ -96,8 +96,8 @@ Foam::tmp<Foam::tensorField> Foam::EulerCoordinateRotation::transformTensor
const tensorField& st
) const
{
NotImplemented;
return tmp<tensorField>();
NotImplemented;
return nullptr;
}
@ -117,7 +117,7 @@ Foam::tmp<Foam::tensorField> Foam::EulerCoordinateRotation::transformTensor
) const
{
NotImplemented;
return tmp<tensorField>();
return nullptr;
}

View File

@ -71,7 +71,7 @@ Foam::tmp<Foam::vectorField> Foam::STARCDCoordinateRotation::transform
) const
{
NotImplemented;
return tmp<vectorField>();
return nullptr;
}
@ -81,7 +81,7 @@ Foam::tmp<Foam::vectorField> Foam::STARCDCoordinateRotation::invTransform
) const
{
NotImplemented;
return tmp<vectorField>();
return nullptr;
}
@ -97,8 +97,8 @@ Foam::tmp<Foam::tensorField> Foam::STARCDCoordinateRotation::transformTensor
const tensorField& st
) const
{
NotImplemented;
return tmp<tensorField>();
NotImplemented;
return nullptr;
}
@ -118,7 +118,7 @@ Foam::tmp<Foam::tensorField> Foam::STARCDCoordinateRotation::transformTensor
) const
{
NotImplemented;
return tmp<tensorField>();
return nullptr;
}

View File

@ -245,7 +245,7 @@ Foam::tmp<Foam::tensorField> Foam::axesRotation::transformTensor
) const
{
NotImplemented;
return tmp<tensorField>();
return nullptr;
}
@ -265,7 +265,7 @@ Foam::tmp<Foam::tensorField> Foam::axesRotation::transformTensor
) const
{
NotImplemented;
return tmp<tensorField>();
return nullptr;
}

View File

@ -139,7 +139,7 @@ public:
virtual autoPtr<searchableSurface> clone() const
{
NotImplemented;
return autoPtr<searchableSurface>();
return nullptr;
}

View File

@ -243,7 +243,7 @@ public:
autoPtr<topoSetSource> clone() const
{
NotImplemented;
return autoPtr<topoSetSource>();
return nullptr;
}

View File

@ -254,7 +254,7 @@ public:
autoPtr<topoSet> clone() const
{
NotImplemented;
return autoPtr<topoSet>();
return nullptr;
}

View File

@ -156,7 +156,7 @@ public:
autoPtr<pyrolysisModel> clone() const
{
NotImplemented;
return autoPtr<pyrolysisModel>();
return nullptr;
}

View File

@ -217,7 +217,7 @@ public:
autoPtr<sampledSet> clone() const
{
NotImplemented;
return autoPtr<sampledSet>();
return nullptr;
}

View File

@ -137,7 +137,7 @@ Foam::tmp<Foam::scalarField> Foam::sampledSurface::sample
) const
{
NotImplemented;
return tmp<scalarField>();
return nullptr;
}
@ -147,7 +147,7 @@ Foam::tmp<Foam::vectorField> Foam::sampledSurface::sample
) const
{
NotImplemented;
return tmp<vectorField>();
return nullptr;
}
@ -157,7 +157,7 @@ Foam::tmp<Foam::sphericalTensorField> Foam::sampledSurface::sample
) const
{
NotImplemented;
return tmp<sphericalTensorField>();
return nullptr;
}
@ -167,7 +167,7 @@ Foam::tmp<Foam::symmTensorField> Foam::sampledSurface::sample
) const
{
NotImplemented;
return tmp<symmTensorField>();
return nullptr;
}
@ -177,7 +177,7 @@ Foam::tmp<Foam::tensorField> Foam::sampledSurface::sample
) const
{
NotImplemented;
return tmp<tensorField>();
return nullptr;
}

View File

@ -205,7 +205,7 @@ public:
autoPtr<sampledSurface> clone() const
{
NotImplemented;
return autoPtr<sampledSurface>();
return nullptr;
}

View File

@ -103,7 +103,7 @@ public:
) const
{
NotImplemented;
return tmp<scalarField>();
return nullptr;
}
//- Sample field on surface
@ -119,7 +119,7 @@ public:
) const
{
NotImplemented;
return tmp<sphericalTensorField>();
return nullptr;
}
//- Sample field on surface
@ -129,7 +129,7 @@ public:
) const
{
NotImplemented;
return tmp<symmTensorField>();
return nullptr;
}
//- Sample field on surface
@ -139,7 +139,7 @@ public:
) const
{
NotImplemented;
return tmp<tensorField>();
return nullptr;
}
//- Interpolate field on surface
@ -149,7 +149,7 @@ public:
) const
{
NotImplemented;
return tmp<scalarField>();
return nullptr;
}
//- Interpolate field on surface
@ -165,7 +165,7 @@ public:
) const
{
NotImplemented;
return tmp<sphericalTensorField>();
return nullptr;
}
//- Interpolate field on surface
@ -175,7 +175,7 @@ public:
) const
{
NotImplemented;
return tmp<symmTensorField>();
return nullptr;
}
//- Interpolate field on surface
@ -185,7 +185,7 @@ public:
) const
{
NotImplemented;
return tmp<tensorField>();
return nullptr;
}
};

View File

@ -181,7 +181,7 @@ public:
autoPtr<surfMeshSampler> clone() const
{
NotImplemented;
return autoPtr<surfMeshSampler>();
return nullptr;
}

View File

@ -120,10 +120,8 @@ Foam::discreteSurface::sampleType
const VolFieldType& fld = mesh().lookupObject<VolFieldType>(fieldName);
return sampleField(fld);
}
else
{
return tmp<Field<Type>>();
}
return nullptr;
}

View File

@ -115,7 +115,7 @@ public:
autoPtr<surfZone> clone() const
{
NotImplemented;
return autoPtr<surfZone>();
return nullptr;
}
static autoPtr<surfZone> New(Istream& is)