STYLE: can add compile-time deprecated message for autoPtr::set()

- deprecated Feb-2018, but not marked as such.

  The set() method originally enforce an additional run-time check
  (Fatal if pointer was already set), but this was rarely used.
  In fact, the set() method was invariably used in constructors
  where the pointer by definition was unset.

  Can now mark as deprecated to catch the last of these.
  We prefer reset() for similarity with std::unique_ptr

  Eg,
  FOAM_EXTRA_CXXFLAGS="-DFoam_autoPtr_deprecate_setMethod"  wmake
This commit is contained in:
Mark Olesen
2020-11-19 12:40:47 +01:00
parent 07bbae0c55
commit 6e3bc1f7d0
13 changed files with 61 additions and 39 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,6 +28,7 @@ License
#include "PurePhaseModel.H"
#include "phaseSystem.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasePhaseModel, class phaseThermo>
@ -39,14 +40,14 @@ Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::PurePhaseModel
:
BasePhaseModel(fluid, phaseName)
{
thermoPtr_.set
thermoPtr_.reset
(
phaseThermo::New
(
fluid.mesh(),
phaseName,
basicThermo::phasePropertyName(basicThermo::dictName, phaseName)
).ptr()
)
);
}

View File

@ -212,7 +212,7 @@ void Foam::phaseSystem::generatePairsAndSubModels
<< exit(FatalError);
}
models[key][pair.index(phase)].set(tempModelIter().ptr());
models[key][pair.index(phase)].reset(tempModelIter().ptr());
}
}
}

View File

@ -953,7 +953,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
if (coalescence_.size() != 0)
{
coalescenceRate_.set
coalescenceRate_.reset
(
new volScalarField
(
@ -971,7 +971,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
if (breakup_.size() != 0)
{
breakupRate_.set
breakupRate_.reset
(
new volScalarField
(
@ -989,7 +989,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
if (binaryBreakup_.size() != 0)
{
binaryBreakupRate_.set
binaryBreakupRate_.reset
(
new volScalarField
(
@ -1012,7 +1012,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
if (drift_.size() != 0)
{
driftRate_.set
driftRate_.reset
(
new volScalarField
(
@ -1027,7 +1027,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
)
);
rx_.set
rx_.reset
(
new volScalarField
(
@ -1042,7 +1042,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
)
);
rdx_.set
rdx_.reset
(
new volScalarField
(
@ -1060,7 +1060,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
if (nucleation_.size() != 0)
{
nucleationRate_.set
nucleationRate_.reset
(
new volScalarField
(
@ -1083,7 +1083,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
if (velocityGroups_.size() > 1)
{
alphas_.set
alphas_.reset
(
new volScalarField
(
@ -1100,7 +1100,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
)
);
dsm_.set
dsm_.reset
(
new volScalarField
(
@ -1117,7 +1117,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
)
);
U_.set
U_.reset
(
new volVectorField
(
@ -1141,6 +1141,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
Foam::diameterModels::populationBalanceModel::~populationBalanceModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::autoPtr<Foam::diameterModels::populationBalanceModel>

View File

@ -136,7 +136,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
phasePair::scalarTable sigmaTable(lookup("sigma"));
phasePair::dictTable aspectRatioTable(lookup("aspectRatio"));
pair_.set
pair_.reset
(
new phasePair
(
@ -147,7 +147,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
pair1In2_.set
pair1In2_.reset
(
new orderedPhasePair
(
@ -159,7 +159,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
pair2In1_.set
pair2In1_.reset
(
new orderedPhasePair
(
@ -174,7 +174,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
// Models
drag_.set
drag_.reset
(
new BlendedInterfacialModel<dragModel>
(
@ -191,7 +191,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
virtualMass_.set
virtualMass_.reset
(
new BlendedInterfacialModel<virtualMassModel>
(
@ -207,7 +207,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
heatTransfer_.set
heatTransfer_.reset
(
new BlendedInterfacialModel<heatTransferModel>
(
@ -223,7 +223,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
lift_.set
lift_.reset
(
new BlendedInterfacialModel<liftModel>
(
@ -239,7 +239,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
wallLubrication_.set
wallLubrication_.reset
(
new BlendedInterfacialModel<wallLubricationModel>
(
@ -255,7 +255,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
turbulentDispersion_.set
turbulentDispersion_.reset
(
new BlendedInterfacialModel<turbulentDispersionModel>
(