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,25 +77,23 @@ 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 "tY",
( mesh.time().timeName(),
"tY",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh, mesh,
dimensionedScalar(dimless, Zero), IOobject::NO_READ,
zeroGradientFvPatchScalarField::typeName IOobject::NO_WRITE
) ),
mesh,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
); );
volScalarField& Ys = tY.ref(); auto& Ys = tY.ref();
Ys = mixture.Y(speciesName); Ys = mixture.Y(speciesName);
return tY; return tY;
@ -113,25 +111,20 @@ 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 "tY",
( mesh.time().timeName(),
"tY",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh, mesh,
dimensionedScalar("one", dimless, 1), IOobject::NO_READ,
zeroGradientFvPatchScalarField::typeName 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(); const fvMesh& mesh = fromThermo_.p().mesh();
tmp<volScalarField> tM return tmp<volScalarField>::New
( (
new volScalarField IOobject
( (
IOobject "tM",
( mesh.time().timeName(),
"tM",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh, mesh,
dimensionedScalar IOobject::NO_READ,
( IOobject::NO_WRITE
"Mw", ),
dimMass/dimMoles, mesh,
1e-3*mixture.cellMixture(0).W() dimensionedScalar
), (
zeroGradientFvPatchScalarField::typeName "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()); 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(),
IOobject::groupName("D", pair_.name()), p.mesh()
p.time().timeName(), ),
p.mesh() p.mesh(),
), dimensionedScalar(dimArea/dimTime, Zero)
p.mesh(),
dimensionedScalar(dimArea/dimTime, Zero)
)
); );
volScalarField& D = tmpD.ref(); auto& D = tmpD.ref();
forAll(p, cellI) forAll(p, cellI)
{ {
@ -286,23 +271,20 @@ 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 IOobject::groupName("L", pair_.name()),
( p.time().timeName(),
IOobject::groupName("L", pair_.name()), p.mesh()
p.time().timeName(), ),
p.mesh() p.mesh(),
), dimensionedScalar(dimEnergy/dimMass, Zero),
p.mesh(), zeroGradientFvPatchScalarField::typeName
dimensionedScalar(dimEnergy/dimMass, Zero),
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",
( fvc::interpolate(phaseModelIter()())*phaseModelIter()->phi()
"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,22 +929,19 @@ 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 "surfaceTensionForce",
( mesh_.time().timeName(),
"surfaceTensionForce", mesh_
mesh_.time().timeName(), ),
mesh_ mesh_,
), dimensionedScalar(dimensionSet(1, -2, -2, 0, 0), Zero)
mesh_,
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,22 +980,19 @@ 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 "U",
( mesh_.time().timeName(),
"U", mesh_
mesh_.time().timeName(), ),
mesh_ mesh_,
), dimensionedVector("U", dimVelocity, Zero)
mesh_,
dimensionedVector("U", dimVelocity, vector::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,22 +1091,19 @@ 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 "nearInterface",
( mesh_.time().timeName(),
"nearInterface", mesh_
mesh_.time().timeName(), ),
mesh_ mesh_,
), dimensionedScalar(dimless, Zero)
mesh_,
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"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,7 +48,7 @@ namespace radiation
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class noSoot Declaration Class noSoot Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class noSoot class noSoot
: :
@ -65,24 +64,25 @@ 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
void correct();
//- Main update/correction routine //- Return Ysoot. Not implemented.
void correct(); const volScalarField& soot() const;
// Access
//- Return Ysoot
const volScalarField& soot() const;
}; };