Commit 27bbb516 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: return nullptr instead of tmp<...>() for NotImplemented methods

- as per 018124e3
parent 8aa7b135
......@@ -77,25 +77,23 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getSpecieMassFraction
{
const fvMesh& mesh = fromThermo_.p().mesh();
tmp<volScalarField> tY
auto tY = tmp<volScalarField>::New
(
new volScalarField
IOobject
(
IOobject
(
"tY",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
"tY",
mesh.time().timeName(),
mesh,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
)
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
);
volScalarField& Ys = tY.ref();
auto& Ys = tY.ref();
Ys = mixture.Y(speciesName);
return tY;
......@@ -113,25 +111,20 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getSpecieMassFraction
{
const fvMesh& mesh = fromThermo_.p().mesh();
tmp<volScalarField> tY
return tmp<volScalarField>::New
(
new volScalarField
IOobject
(
IOobject
(
"tY",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
"tY",
mesh.time().timeName(),
mesh,
dimensionedScalar("one", dimless, 1),
zeroGradientFvPatchScalarField::typeName
)
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("one", dimless, scalar(1)),
zeroGradientFvPatchScalarField::typeName
);
return tY;
}
......@@ -145,30 +138,25 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::MwMixture
{
const fvMesh& mesh = fromThermo_.p().mesh();
tmp<volScalarField> tM
return tmp<volScalarField>::New
(
new volScalarField
IOobject
(
IOobject
(
"tM",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
"tM",
mesh.time().timeName(),
mesh,
dimensionedScalar
(
"Mw",
dimMass/dimMoles,
1e-3*mixture.cellMixture(0).W()
),
zeroGradientFvPatchScalarField::typeName
)
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar
(
"Mw",
dimMass/dimMoles,
1e-3*mixture.cellMixture(0).W()
),
zeroGradientFvPatchScalarField::typeName
);
return tM;
}
......@@ -240,22 +228,19 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::D
const volScalarField& T(fromThermo_.T());
tmp<volScalarField> tmpD
auto tmpD = tmp<volScalarField>::New
(
new volScalarField
IOobject
(
IOobject
(
IOobject::groupName("D", pair_.name()),
p.time().timeName(),
p.mesh()
),
p.mesh(),
dimensionedScalar(dimArea/dimTime, Zero)
)
IOobject::groupName("D", pair_.name()),
p.time().timeName(),
p.mesh()
),
p.mesh(),
dimensionedScalar(dimArea/dimTime, Zero)
);
volScalarField& D = tmpD.ref();
auto& D = tmpD.ref();
forAll(p, cellI)
{
......@@ -286,23 +271,20 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::L
const volScalarField& p(fromThermo_.p());
tmp<volScalarField> tmpL
auto tmpL = tmp<volScalarField>::New
(
new volScalarField
IOobject
(
IOobject
(
IOobject::groupName("L", pair_.name()),
p.time().timeName(),
p.mesh()
),
p.mesh(),
dimensionedScalar(dimEnergy/dimMass, Zero),
zeroGradientFvPatchScalarField::typeName
)
IOobject::groupName("L", pair_.name()),
p.time().timeName(),
p.mesh()
),
p.mesh(),
dimensionedScalar(dimEnergy/dimMass, Zero),
zeroGradientFvPatchScalarField::typeName
);
volScalarField& L = tmpL.ref();
auto& L = tmpL.ref();
// from Thermo (from) to Thermo (to)
forAll(p, cellI)
......@@ -325,7 +307,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::dY
) const
{
NotImplemented;
return tmp<volScalarField>();
return nullptr;
}
......@@ -338,7 +320,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::Yf
) const
{
NotImplemented;
return tmp<volScalarField>();
return nullptr;
}
......
......@@ -82,13 +82,10 @@ Foam::tmp<Foam::surfaceScalarField> Foam::phaseSystem::generatePhi
{
phaseModelTable::const_iterator phaseModelIter = phaseModels.begin();
tmp<surfaceScalarField> tmpPhi
auto tmpPhi = tmp<surfaceScalarField>::New
(
new surfaceScalarField
(
"phi",
fvc::interpolate(phaseModelIter()())*phaseModelIter()->phi()
)
"phi",
fvc::interpolate(phaseModelIter()())*phaseModelIter()->phi()
);
++phaseModelIter;
......@@ -115,9 +112,9 @@ void Foam::phaseSystem::generatePairs(const dictTable& modelDicts)
{
// do nothing ...
}
// new ordered pair
else if (key.ordered())
{
// New ordered pair
phasePairs_.insert
(
key,
......@@ -131,10 +128,9 @@ void Foam::phaseSystem::generatePairs(const dictTable& modelDicts)
)
);
}
// new unordered pair
else
{
// New unordered pair
phasePairs_.insert
(
key,
......@@ -289,7 +285,7 @@ Foam::tmp<Foam::volScalarField> Foam::phaseSystem::he
) const
{
NotImplemented;
return tmp<volScalarField>();
return nullptr;
}
......@@ -301,7 +297,7 @@ Foam::tmp<Foam::scalarField> Foam::phaseSystem::he
) const
{
NotImplemented;
return tmp<scalarField>();
return nullptr;
}
......@@ -313,13 +309,12 @@ Foam::tmp<Foam::scalarField> Foam::phaseSystem::he
) const
{
NotImplemented;
return tmp<scalarField>();
return nullptr;
}
Foam::tmp<Foam::volScalarField> Foam::phaseSystem::hc() const
{
phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
tmp<volScalarField> tAlphaHc
......@@ -346,7 +341,7 @@ Foam::tmp<Foam::scalarField> Foam::phaseSystem::THE
) const
{
NotImplemented;
return tmp<scalarField>();
return nullptr;
}
......@@ -359,7 +354,7 @@ Foam::tmp<Foam::scalarField> Foam::phaseSystem::THE
) const
{
NotImplemented;
return tmp<scalarField>();
return nullptr;
}
......@@ -621,7 +616,7 @@ Foam::tmp<Foam::scalarField> Foam::phaseSystem::CpByCpv
Foam::tmp<Foam::volScalarField> Foam::phaseSystem::W() const
{
NotImplemented;
return tmp<volScalarField>();
return nullptr;
}
......@@ -934,22 +929,19 @@ const Foam::fvMesh& Foam::phaseSystem::mesh() const
Foam::tmp<Foam::surfaceScalarField>
Foam::phaseSystem::surfaceTensionForce() const
{
tmp<surfaceScalarField> tstf
auto tstf = tmp<surfaceScalarField>::New
(
new surfaceScalarField
IOobject
(
IOobject
(
"surfaceTensionForce",
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedScalar(dimensionSet(1, -2, -2, 0, 0), Zero)
)
"surfaceTensionForce",
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedScalar(dimensionSet(1, -2, -2, 0, 0), Zero)
);
surfaceScalarField& stf = tstf.ref();
auto& stf = tstf.ref();
stf.setOriented();
if (surfaceTensionModels_.size() > 0)
......@@ -988,22 +980,19 @@ Foam::phaseSystem::surfaceTensionForce() const
Foam::tmp<Foam::volVectorField> Foam::phaseSystem::U() const
{
tmp<volVectorField> tstf
auto tstf = tmp<volVectorField>::New
(
new volVectorField
IOobject
(
IOobject
(
"U",
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedVector("U", dimVelocity, vector::zero)
)
"U",
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedVector("U", dimVelocity, Zero)
);
volVectorField& stf = tstf.ref();
auto& stf = tstf.ref();
forAllConstIter(phaseModelTable, phaseModels_, iter1)
{
......@@ -1040,7 +1029,7 @@ void Foam::phaseSystem::addInterfacePorosity(fvVectorMatrix& UEqn)
const phaseModel& phasei = iteri();
phaseModelTable::iterator iterk = iteri;
iterk++;
++iterk;
for
(
;
......@@ -1102,22 +1091,19 @@ Foam::tmp<Foam::volScalarField> Foam::phaseSystem::nearInterface
Foam::tmp<Foam::volScalarField> Foam::phaseSystem::nearInterface() const
{
tmp<volScalarField> tnI
auto tnI = tmp<volScalarField>::New
(
new volScalarField
IOobject
(
IOobject
(
"nearInterface",
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedScalar(dimless, Zero)
)
"nearInterface",
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedScalar(dimless, Zero)
);
volScalarField& nI = tnI.ref();
auto& nI = tnI.ref();
forAllConstIter(phaseModelTable, phaseModels_, iter1)
{
......@@ -1185,10 +1171,8 @@ bool Foam::phaseSystem::read()
return readOK;
}
else
{
return false;
}
return false;
}
......
......@@ -55,18 +55,17 @@ Foam::radiation::noSoot::noSoot
sootModel(dict, mesh, modelType)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::noSoot::~noSoot()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::radiation::noSoot::correct()
{}
const Foam::volScalarField& Foam::radiation::noSoot::soot() const
{
NotImplemented;
return tmp<volScalarField>();
return tmp<volScalarField>(); // Placeholder
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -38,7 +38,6 @@ SourceFiles
#ifndef noSoot_H
#define noSoot_H
#include "sootModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -49,7 +48,7 @@ namespace radiation
{
/*---------------------------------------------------------------------------*\
Class noSoot Declaration
Class noSoot Declaration
\*---------------------------------------------------------------------------*/
class noSoot
:
......@@ -65,24 +64,25 @@ public:
// Constructors
//- Construct from components
noSoot(const dictionary& dict, const fvMesh& mesh, const word&);
noSoot
(
const dictionary& dict,
const fvMesh& mesh,
const word& modelType
);
//- Destructor
virtual ~noSoot();
virtual ~noSoot() = default;
// Member Functions
// Edit
//- Main update/correction routine
void correct();
// Access
//- Main update/correction routine
void correct();
//- Return Ysoot
const volScalarField& soot() const;
//- Return Ysoot. Not implemented.
const volScalarField& soot() const;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment