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

- as per 018124e3bf
This commit is contained in:
Mark Olesen
2018-07-27 14:20:01 +02:00
parent 8aa7b1353f
commit 27bbb516a3
4 changed files with 114 additions and 149 deletions

View File

@ -77,9 +77,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getSpecieMassFraction
{ {
const fvMesh& mesh = fromThermo_.p().mesh(); const fvMesh& mesh = fromThermo_.p().mesh();
tmp<volScalarField> tY auto tY = tmp<volScalarField>::New
(
new volScalarField
( (
IOobject IOobject
( (
@ -92,10 +90,10 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getSpecieMassFraction
mesh, mesh,
dimensionedScalar(dimless, Zero), dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName zeroGradientFvPatchScalarField::typeName
)
); );
volScalarField& Ys = tY.ref(); auto& Ys = tY.ref();
Ys = mixture.Y(speciesName); Ys = mixture.Y(speciesName);
return tY; return tY;
@ -113,9 +111,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getSpecieMassFraction
{ {
const fvMesh& mesh = fromThermo_.p().mesh(); const fvMesh& mesh = fromThermo_.p().mesh();
tmp<volScalarField> tY return tmp<volScalarField>::New
(
new volScalarField
( (
IOobject IOobject
( (
@ -126,12 +122,9 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getSpecieMassFraction
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh, mesh,
dimensionedScalar("one", dimless, 1), dimensionedScalar("one", dimless, scalar(1)),
zeroGradientFvPatchScalarField::typeName zeroGradientFvPatchScalarField::typeName
)
); );
return tY;
} }
@ -145,9 +138,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::MwMixture
{ {
const fvMesh& mesh = fromThermo_.p().mesh(); const fvMesh& mesh = fromThermo_.p().mesh();
tmp<volScalarField> tM return tmp<volScalarField>::New
(
new volScalarField
( (
IOobject IOobject
( (
@ -165,10 +156,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::MwMixture
1e-3*mixture.cellMixture(0).W() 1e-3*mixture.cellMixture(0).W()
), ),
zeroGradientFvPatchScalarField::typeName zeroGradientFvPatchScalarField::typeName
)
); );
return tM;
} }
@ -240,9 +228,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::D
const volScalarField& T(fromThermo_.T()); const volScalarField& T(fromThermo_.T());
tmp<volScalarField> tmpD auto tmpD = tmp<volScalarField>::New
(
new volScalarField
( (
IOobject IOobject
( (
@ -252,10 +238,9 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::D
), ),
p.mesh(), p.mesh(),
dimensionedScalar(dimArea/dimTime, Zero) dimensionedScalar(dimArea/dimTime, Zero)
)
); );
volScalarField& D = tmpD.ref(); auto& D = tmpD.ref();
forAll(p, cellI) forAll(p, cellI)
{ {
@ -286,9 +271,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::L
const volScalarField& p(fromThermo_.p()); const volScalarField& p(fromThermo_.p());
tmp<volScalarField> tmpL auto tmpL = tmp<volScalarField>::New
(
new volScalarField
( (
IOobject IOobject
( (
@ -299,10 +282,9 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::L
p.mesh(), p.mesh(),
dimensionedScalar(dimEnergy/dimMass, Zero), dimensionedScalar(dimEnergy/dimMass, Zero),
zeroGradientFvPatchScalarField::typeName zeroGradientFvPatchScalarField::typeName
)
); );
volScalarField& L = tmpL.ref(); auto& L = tmpL.ref();
// from Thermo (from) to Thermo (to) // from Thermo (from) to Thermo (to)
forAll(p, cellI) forAll(p, cellI)
@ -325,7 +307,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::dY
) const ) const
{ {
NotImplemented; NotImplemented;
return tmp<volScalarField>(); return nullptr;
} }
@ -338,7 +320,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::Yf
) const ) const
{ {
NotImplemented; NotImplemented;
return tmp<volScalarField>(); return nullptr;
} }

View File

@ -82,13 +82,10 @@ Foam::tmp<Foam::surfaceScalarField> Foam::phaseSystem::generatePhi
{ {
phaseModelTable::const_iterator phaseModelIter = phaseModels.begin(); phaseModelTable::const_iterator phaseModelIter = phaseModels.begin();
tmp<surfaceScalarField> tmpPhi auto tmpPhi = tmp<surfaceScalarField>::New
(
new surfaceScalarField
( (
"phi", "phi",
fvc::interpolate(phaseModelIter()())*phaseModelIter()->phi() fvc::interpolate(phaseModelIter()())*phaseModelIter()->phi()
)
); );
++phaseModelIter; ++phaseModelIter;
@ -115,9 +112,9 @@ void Foam::phaseSystem::generatePairs(const dictTable& modelDicts)
{ {
// do nothing ... // do nothing ...
} }
// new ordered pair
else if (key.ordered()) else if (key.ordered())
{ {
// New ordered pair
phasePairs_.insert phasePairs_.insert
( (
key, key,
@ -131,10 +128,9 @@ void Foam::phaseSystem::generatePairs(const dictTable& modelDicts)
) )
); );
} }
// new unordered pair
else else
{ {
// New unordered pair
phasePairs_.insert phasePairs_.insert
( (
key, key,
@ -289,7 +285,7 @@ Foam::tmp<Foam::volScalarField> Foam::phaseSystem::he
) const ) const
{ {
NotImplemented; NotImplemented;
return tmp<volScalarField>(); return nullptr;
} }
@ -301,7 +297,7 @@ Foam::tmp<Foam::scalarField> Foam::phaseSystem::he
) const ) const
{ {
NotImplemented; NotImplemented;
return tmp<scalarField>(); return nullptr;
} }
@ -313,13 +309,12 @@ Foam::tmp<Foam::scalarField> Foam::phaseSystem::he
) const ) const
{ {
NotImplemented; NotImplemented;
return tmp<scalarField>(); return nullptr;
} }
Foam::tmp<Foam::volScalarField> Foam::phaseSystem::hc() const Foam::tmp<Foam::volScalarField> Foam::phaseSystem::hc() const
{ {
phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin(); phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
tmp<volScalarField> tAlphaHc tmp<volScalarField> tAlphaHc
@ -346,7 +341,7 @@ Foam::tmp<Foam::scalarField> Foam::phaseSystem::THE
) const ) const
{ {
NotImplemented; NotImplemented;
return tmp<scalarField>(); return nullptr;
} }
@ -359,7 +354,7 @@ Foam::tmp<Foam::scalarField> Foam::phaseSystem::THE
) const ) const
{ {
NotImplemented; 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 Foam::tmp<Foam::volScalarField> Foam::phaseSystem::W() const
{ {
NotImplemented; NotImplemented;
return tmp<volScalarField>(); return nullptr;
} }
@ -934,9 +929,7 @@ const Foam::fvMesh& Foam::phaseSystem::mesh() const
Foam::tmp<Foam::surfaceScalarField> Foam::tmp<Foam::surfaceScalarField>
Foam::phaseSystem::surfaceTensionForce() const Foam::phaseSystem::surfaceTensionForce() const
{ {
tmp<surfaceScalarField> tstf auto tstf = tmp<surfaceScalarField>::New
(
new surfaceScalarField
( (
IOobject IOobject
( (
@ -946,10 +939,9 @@ Foam::phaseSystem::surfaceTensionForce() const
), ),
mesh_, mesh_,
dimensionedScalar(dimensionSet(1, -2, -2, 0, 0), Zero) dimensionedScalar(dimensionSet(1, -2, -2, 0, 0), Zero)
)
); );
surfaceScalarField& stf = tstf.ref(); auto& stf = tstf.ref();
stf.setOriented(); stf.setOriented();
if (surfaceTensionModels_.size() > 0) if (surfaceTensionModels_.size() > 0)
@ -988,9 +980,7 @@ Foam::phaseSystem::surfaceTensionForce() const
Foam::tmp<Foam::volVectorField> Foam::phaseSystem::U() const Foam::tmp<Foam::volVectorField> Foam::phaseSystem::U() const
{ {
tmp<volVectorField> tstf auto tstf = tmp<volVectorField>::New
(
new volVectorField
( (
IOobject IOobject
( (
@ -999,11 +989,10 @@ Foam::tmp<Foam::volVectorField> Foam::phaseSystem::U() const
mesh_ mesh_
), ),
mesh_, mesh_,
dimensionedVector("U", dimVelocity, vector::zero) dimensionedVector("U", dimVelocity, Zero)
)
); );
volVectorField& stf = tstf.ref(); auto& stf = tstf.ref();
forAllConstIter(phaseModelTable, phaseModels_, iter1) forAllConstIter(phaseModelTable, phaseModels_, iter1)
{ {
@ -1040,7 +1029,7 @@ void Foam::phaseSystem::addInterfacePorosity(fvVectorMatrix& UEqn)
const phaseModel& phasei = iteri(); const phaseModel& phasei = iteri();
phaseModelTable::iterator iterk = iteri; phaseModelTable::iterator iterk = iteri;
iterk++; ++iterk;
for for
( (
; ;
@ -1102,9 +1091,7 @@ Foam::tmp<Foam::volScalarField> Foam::phaseSystem::nearInterface
Foam::tmp<Foam::volScalarField> Foam::phaseSystem::nearInterface() const Foam::tmp<Foam::volScalarField> Foam::phaseSystem::nearInterface() const
{ {
tmp<volScalarField> tnI auto tnI = tmp<volScalarField>::New
(
new volScalarField
( (
IOobject IOobject
( (
@ -1114,10 +1101,9 @@ Foam::tmp<Foam::volScalarField> Foam::phaseSystem::nearInterface() const
), ),
mesh_, mesh_,
dimensionedScalar(dimless, Zero) dimensionedScalar(dimless, Zero)
)
); );
volScalarField& nI = tnI.ref(); auto& nI = tnI.ref();
forAllConstIter(phaseModelTable, phaseModels_, iter1) forAllConstIter(phaseModelTable, phaseModels_, iter1)
{ {
@ -1185,10 +1171,8 @@ bool Foam::phaseSystem::read()
return readOK; return readOK;
} }
else
{
return false; return false;
}
} }

View File

@ -55,18 +55,17 @@ Foam::radiation::noSoot::noSoot
sootModel(dict, mesh, modelType) sootModel(dict, mesh, modelType)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::noSoot::~noSoot()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::radiation::noSoot::correct() void Foam::radiation::noSoot::correct()
{} {}
const Foam::volScalarField& Foam::radiation::noSoot::soot() const const Foam::volScalarField& Foam::radiation::noSoot::soot() const
{ {
NotImplemented; NotImplemented;
return tmp<volScalarField>(); return tmp<volScalarField>(); // Placeholder
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -38,7 +38,6 @@ SourceFiles
#ifndef noSoot_H #ifndef noSoot_H
#define noSoot_H #define noSoot_H
#include "sootModel.H" #include "sootModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -65,23 +64,24 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components
noSoot(const dictionary& dict, const fvMesh& mesh, const word&); noSoot
(
const dictionary& dict,
const fvMesh& mesh,
const word& modelType
);
//- Destructor //- Destructor
virtual ~noSoot(); virtual ~noSoot() = default;
// Member Functions // Member Functions
// Edit
//- Main update/correction routine //- Main update/correction routine
void correct(); void correct();
// Access //- Return Ysoot. Not implemented.
//- Return Ysoot
const volScalarField& soot() const; const volScalarField& soot() const;
}; };