Commit 018124e3 authored by Mark Olesen's avatar Mark Olesen
Browse files

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.
parent 2f86cdc7
......@@ -81,7 +81,7 @@ Foam::phaseModel::phaseModel
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
{
NotImplemented;
return autoPtr<phaseModel>();
return nullptr;
}
......
......@@ -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;
}
......
......@@ -205,7 +205,7 @@ Foam::phaseModel::~phaseModel()
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
{
NotImplemented;
return autoPtr<phaseModel>();
return nullptr;
}
......
......@@ -68,7 +68,7 @@ Foam::phase::phase
Foam::autoPtr<Foam::phase> Foam::phase::clone() const
{
NotImplemented;
return autoPtr<phase>();
return nullptr;
}
......
......@@ -65,7 +65,7 @@ template<class BasePhaseModel>
Foam::tmp<Foam::fvScalarMatrix>
Foam::IsothermalPhaseModel<BasePhaseModel>::heEqn()
{
return tmp<fvScalarMatrix>();
return nullptr;
}
......
......@@ -152,7 +152,7 @@ Foam::MultiComponentPhaseModel<BasePhaseModel>::YiEqn
)
)
{
return tmp<fvScalarMatrix>();
return nullptr;
}
const volScalarField& alpha = *this;
......
......@@ -57,8 +57,7 @@ Foam::PurePhaseModel<BasePhaseModel>::YiEqn
)
{
NotImplemented;
return tmp<fvScalarMatrix>();
return nullptr;
}
......
......@@ -77,7 +77,7 @@ Foam::phaseModel::phaseModel
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
{
NotImplemented;
return autoPtr<phaseModel>();
return nullptr;
}
......
......@@ -115,7 +115,7 @@ public:
autoPtr<IATEsource> clone() const
{
NotImplemented;
return autoPtr<IATEsource>();
return nullptr;
}
......
......@@ -114,7 +114,7 @@ public:
autoPtr<IATEsource> clone() const
{
NotImplemented;
return autoPtr<IATEsource>();
return nullptr;
}
......
......@@ -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);
}
......
......@@ -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;
}
};
......
......@@ -109,7 +109,7 @@ public:
autoPtr<faceSelection> clone() const
{
NotImplemented;
return autoPtr<faceSelection>();
return nullptr;
}
......
......@@ -86,7 +86,7 @@ public:
autoPtr<faceSelection> clone() const
{
NotImplemented;
return autoPtr<faceSelection>();
return nullptr;
}
......
......@@ -79,7 +79,7 @@ public:
autoPtr<faceSelection> clone() const
{
NotImplemented;
return autoPtr<faceSelection>();
return nullptr;
}
......
......@@ -251,7 +251,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints
if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0)
{
return autoPtr<mapPolyMesh>();
return nullptr;
}
polyTopoChange meshMod(mesh);
......
......@@ -71,7 +71,7 @@ autoPtr<GeoFieldType> loadField
);
}
return autoPtr<GeoFieldType>();
return nullptr;
}
......
......@@ -76,7 +76,7 @@ public:
autoPtr<searchableSurfaceModifier> clone() const
{
NotImplemented;
return autoPtr<searchableSurfaceModifier>();
return nullptr;
}
......
......@@ -100,7 +100,7 @@ public:
autoPtr<searchableSurfaceModifier> clone() const
{
NotImplemented;
return autoPtr<searchableSurfaceModifier>();
return nullptr;
}
......
......@@ -96,7 +96,7 @@ public:
autoPtr<searchableSurfaceModifier> clone() const
{
NotImplemented;
return autoPtr<searchableSurfaceModifier>();
return nullptr;
}
......
......@@ -197,7 +197,7 @@ public:
autoPtr<functionObject> clone() const
{
NotImplemented;
return autoPtr<functionObject>();
return nullptr;
}
......
......@@ -93,7 +93,7 @@ public:
autoPtr<procLduInterface> clone()
{
NotImplemented;
return autoPtr<procLduInterface>();
return nullptr;
}
static autoPtr<procLduInterface> New(Istream& is)
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -138,7 +138,7 @@ Foam::lduMatrix::preconditioner::New
"no diagonal or off-diagonal coefficient"
<< exit(FatalIOError);
return autoPtr<lduMatrix::preconditioner>();
return nullptr;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -152,7 +152,7 @@ Foam::autoPtr<Foam::labelIOList> Foam::polyMesh::readTetBasePtIs() const
return autoPtr<labelIOList>::New(io);
}
return autoPtr<labelIOList>();
return nullptr;
}
......
......@@ -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;
}
......
......@@ -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;
}
};
......
......@@ -2591,7 +2591,7 @@ Foam::autoPtr<Foam::polyMesh> Foam::ccm::reader::mesh
{
if (!readGeometry())
{
return autoPtr<polyMesh>();
return nullptr;
}
// merge cellTable and rename boundaryRegion
......
......@@ -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_);
......
......@@ -145,7 +145,7 @@ public:
autoPtr<cellLooper> clone() const
{
NotImplemented;
return autoPtr<cellLooper>();
return nullptr;
}
......
......@@ -92,7 +92,7 @@ Foam::motionSolver::motionSolver
Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::clone() const
{
NotImplemented;
return autoPtr<motionSolver>();
return nullptr;
}
......
......@@ -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;
}
......
......@@ -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
......
......@@ -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
......
......@@ -174,7 +174,7 @@ public:
autoPtr<MRFZone> clone() const
{
NotImplemented;
return autoPtr<MRFZone>();
return nullptr;
}
......
......@@ -133,7 +133,7 @@ public:
autoPtr<option> clone() const
{
NotImplemented;
return autoPtr<option>();
return nullptr;
}
//- Return pointer to new fvOption object created
......
......@@ -140,7 +140,7 @@ tmp<surfaceScalarField> CoEulerDdtScheme<Type>::CofrDeltaT() const
<< "Incorrect dimensions of phi: " << phi.dimensions()
<< abort(FatalError);
return tmp<surfaceScalarField>();
return nullptr;
}
......
......@@ -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;
}
......
......@@ -105,7 +105,8 @@ Foam::functionObjects::energyTransport::kappaEff() const
FatalErrorInFunction
<< "Turbulence model not found" << exit(FatalError);
return tmp<volScalarField>();
return nullptr;
}
......
......@@ -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");
}
......
......@@ -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 * * * * * * * * * * * * * //