mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: cleanup autoPtr class (issue #639)
Improve alignment of its behaviour with std::unique_ptr
- element_type typedef
- release() method - identical to ptr() method
- get() method to get the pointer without checking and without releasing it.
- operator*() for dereferencing
Method name changes
- renamed rawPtr() to get()
- renamed rawRef() to ref(), removed unused const version.
Removed methods/operators
- assignment from a raw pointer was deleted (was rarely used).
Can be convenient, but uncontrolled and potentially unsafe.
Do allow assignment from a literal nullptr though, since this
can never leak (and also corresponds to the unique_ptr API).
Additional methods
- clone() method: forwards to the clone() method of the underlying
data object with argument forwarding.
- reset(autoPtr&&) as an alternative to operator=(autoPtr&&)
STYLE: avoid implicit conversion from autoPtr to object type in many places
- existing implementation has the following:
operator const T&() const { return operator*(); }
which means that the following code works:
autoPtr<mapPolyMesh> map = ...;
updateMesh(*map); // OK: explicit dereferencing
updateMesh(map()); // OK: explicit dereferencing
updateMesh(map); // OK: implicit dereferencing
for clarity it may preferable to avoid the implicit dereferencing
- prefer operator* to operator() when deferenced a return value
so it is clearer that a pointer is involve and not a function call
etc Eg, return *meshPtr_; vs. return meshPtr_();
This commit is contained in:
@ -165,7 +165,7 @@ IOdictionary PDRProperties
|
||||
autoPtr<PDRDragModel> drag = PDRDragModel::New
|
||||
(
|
||||
PDRProperties,
|
||||
turbulence,
|
||||
*turbulence,
|
||||
rho,
|
||||
U,
|
||||
phi
|
||||
@ -176,7 +176,7 @@ autoPtr<XiModel> flameWrinkling = XiModel::New
|
||||
(
|
||||
PDRProperties,
|
||||
thermo,
|
||||
turbulence,
|
||||
*turbulence,
|
||||
Su,
|
||||
rho,
|
||||
b,
|
||||
|
||||
@ -89,22 +89,22 @@ public:
|
||||
|
||||
const rhoThermo& thermo1() const
|
||||
{
|
||||
return thermo1_();
|
||||
return *thermo1_;
|
||||
}
|
||||
|
||||
const rhoThermo& thermo2() const
|
||||
{
|
||||
return thermo2_();
|
||||
return *thermo2_;
|
||||
}
|
||||
|
||||
rhoThermo& thermo1()
|
||||
{
|
||||
return thermo1_();
|
||||
return *thermo1_;
|
||||
}
|
||||
|
||||
rhoThermo& thermo2()
|
||||
{
|
||||
return thermo2_();
|
||||
return *thermo2_;
|
||||
}
|
||||
|
||||
//- Correct the thermodynamics of each phase
|
||||
|
||||
@ -81,7 +81,7 @@ Foam::phaseModel::phaseModel
|
||||
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<phaseModel>(nullptr);
|
||||
return autoPtr<phaseModel>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -120,13 +120,13 @@ public:
|
||||
//- Return const-access to phase rhoThermo
|
||||
const rhoThermo& thermo() const
|
||||
{
|
||||
return thermo_();
|
||||
return *thermo_;
|
||||
}
|
||||
|
||||
//- Return access to phase rhoThermo
|
||||
rhoThermo& thermo()
|
||||
{
|
||||
return thermo_();
|
||||
return *thermo_;
|
||||
}
|
||||
|
||||
//- Return const-access to phase divergence
|
||||
|
||||
@ -106,13 +106,13 @@ public:
|
||||
//- Return const-access to the mixture viscosityModel
|
||||
const mixtureViscosityModel& muModel() const
|
||||
{
|
||||
return muModel_();
|
||||
return *muModel_;
|
||||
}
|
||||
|
||||
//- Return const-access to the continuous-phase viscosityModel
|
||||
const viscosityModel& nucModel() const
|
||||
{
|
||||
return nucModel_();
|
||||
return *nucModel_;
|
||||
}
|
||||
|
||||
//- Return const-access to the dispersed-phase density
|
||||
|
||||
@ -181,19 +181,19 @@ public:
|
||||
//- Return const-access to phase1 viscosityModel
|
||||
const viscosityModel& nuModel1() const
|
||||
{
|
||||
return nuModel1_();
|
||||
return *nuModel1_;
|
||||
}
|
||||
|
||||
//- Return const-access to phase2 viscosityModel
|
||||
const viscosityModel& nuModel2() const
|
||||
{
|
||||
return nuModel2_();
|
||||
return *nuModel2_;
|
||||
}
|
||||
|
||||
//- Return const-access to phase3 viscosityModel
|
||||
const viscosityModel& nuModel3() const
|
||||
{
|
||||
return nuModel3_();
|
||||
return *nuModel3_;
|
||||
}
|
||||
|
||||
//- Return the dynamic laminar viscosity
|
||||
|
||||
@ -205,7 +205,7 @@ Foam::phaseModel::~phaseModel()
|
||||
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<phaseModel>(nullptr);
|
||||
return autoPtr<phaseModel>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -190,12 +190,12 @@ public:
|
||||
|
||||
const surfaceScalarField& phi() const
|
||||
{
|
||||
return phiPtr_();
|
||||
return *phiPtr_;
|
||||
}
|
||||
|
||||
surfaceScalarField& phi()
|
||||
{
|
||||
return phiPtr_();
|
||||
return *phiPtr_;
|
||||
}
|
||||
|
||||
const surfaceScalarField& alphaPhi() const
|
||||
|
||||
@ -68,7 +68,7 @@ Foam::phase::phase
|
||||
Foam::autoPtr<Foam::phase> Foam::phase::clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<phase>(nullptr);
|
||||
return autoPtr<phase>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ public:
|
||||
//- Return const-access to phase1 viscosityModel
|
||||
const viscosityModel& nuModel() const
|
||||
{
|
||||
return nuModel_();
|
||||
return *nuModel_;
|
||||
}
|
||||
|
||||
//- Return the kinematic laminar viscosity
|
||||
|
||||
@ -59,14 +59,9 @@ HeatAndMassTransferPhaseSystem
|
||||
massTransferModels_
|
||||
);
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
@ -197,14 +192,9 @@ Foam::HeatAndMassTransferPhaseSystem<BasePhaseSystem>::dmdt
|
||||
)
|
||||
);
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
@ -239,14 +229,9 @@ Foam::HeatAndMassTransferPhaseSystem<BasePhaseSystem>::momentumTransfer() const
|
||||
phaseSystem::momentumTransferTable& eqns = eqnsPtr();
|
||||
|
||||
// Source term due to mass trasfer
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
@ -291,17 +276,10 @@ Foam::HeatAndMassTransferPhaseSystem<BasePhaseSystem>::heatTransfer() const
|
||||
}
|
||||
|
||||
// Heat transfer with the interface
|
||||
forAllConstIter
|
||||
(
|
||||
heatTransferModelTable,
|
||||
heatTransferModels_,
|
||||
heatTransferModelIter
|
||||
)
|
||||
forAllConstIters(heatTransferModels_, heatTransferModelIter)
|
||||
{
|
||||
const phasePair& pair
|
||||
(
|
||||
this->phasePairs_[heatTransferModelIter.key()]
|
||||
);
|
||||
const phasePair& pair =
|
||||
*(this->phasePairs_[heatTransferModelIter.key()]);
|
||||
|
||||
const phaseModel* phase = &pair.phase1();
|
||||
const phaseModel* otherPhase = &pair.phase2();
|
||||
@ -344,14 +322,9 @@ Foam::HeatAndMassTransferPhaseSystem<BasePhaseSystem>::heatTransfer() const
|
||||
}
|
||||
|
||||
// Source term due to mass transfer
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
|
||||
@ -128,16 +128,12 @@ Foam::HeatTransferPhaseSystem<BasePhaseSystem>::heatTransfer() const
|
||||
);
|
||||
}
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
heatTransferModelTable,
|
||||
heatTransferModels_,
|
||||
heatTransferModelIter
|
||||
)
|
||||
forAllConstIters(heatTransferModels_, heatTransferModelIter)
|
||||
{
|
||||
const volScalarField K(heatTransferModelIter()->K());
|
||||
const phasePair& pair =
|
||||
*(this->phasePairs_[heatTransferModelIter.key()]);
|
||||
|
||||
const phasePair& pair(this->phasePairs_[heatTransferModelIter.key()]);
|
||||
const volScalarField K(heatTransferModelIter()->K());
|
||||
|
||||
const phaseModel* phase = &pair.phase1();
|
||||
const phaseModel* otherPhase = &pair.phase2();
|
||||
|
||||
@ -86,14 +86,9 @@ massTransfer() const
|
||||
}
|
||||
|
||||
// Reset the interfacial mass flow rates
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
@ -108,22 +103,18 @@ massTransfer() const
|
||||
}
|
||||
|
||||
// Sum up the contribution from each interface composition model
|
||||
forAllConstIter
|
||||
forAllConstIters
|
||||
(
|
||||
interfaceCompositionModelTable,
|
||||
interfaceCompositionModels_,
|
||||
interfaceCompositionModelIter
|
||||
)
|
||||
{
|
||||
const interfaceCompositionModel& compositionModel
|
||||
(
|
||||
interfaceCompositionModelIter()
|
||||
);
|
||||
const phasePair& pair =
|
||||
*(this->phasePairs_[interfaceCompositionModelIter.key()]);
|
||||
|
||||
const interfaceCompositionModel& compositionModel =
|
||||
*(interfaceCompositionModelIter.object());
|
||||
|
||||
const phasePair& pair
|
||||
(
|
||||
this->phasePairs_[interfaceCompositionModelIter.key()]
|
||||
);
|
||||
const phaseModel& phase = pair.phase1();
|
||||
const phaseModel& otherPhase = pair.phase2();
|
||||
const phasePairKey key(phase.name(), otherPhase.name());
|
||||
@ -209,14 +200,9 @@ correctThermo()
|
||||
// Yfi is likely to be a strong non-linear (typically exponential) function
|
||||
// of Tf, so the solution for the temperature is newton-accelerated
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
|
||||
@ -82,14 +82,10 @@ MomentumTransferPhaseSystem
|
||||
turbulentDispersionModels_
|
||||
);
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
dragModelTable,
|
||||
dragModels_,
|
||||
dragModelIter
|
||||
)
|
||||
forAllConstIters(dragModels_, dragModelIter)
|
||||
{
|
||||
const phasePair& pair(this->phasePairs_[dragModelIter.key()]);
|
||||
const phasePair& pair =
|
||||
*(this->phasePairs_[dragModelIter.key()]);
|
||||
|
||||
Kds_.insert
|
||||
(
|
||||
@ -102,14 +98,10 @@ MomentumTransferPhaseSystem
|
||||
);
|
||||
}
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
virtualMassModelTable,
|
||||
virtualMassModels_,
|
||||
virtualMassModelIter
|
||||
)
|
||||
forAllConstIters(virtualMassModels_, virtualMassModelIter)
|
||||
{
|
||||
const phasePair& pair(this->phasePairs_[virtualMassModelIter.key()]);
|
||||
const phasePair& pair =
|
||||
*(this->phasePairs_[virtualMassModelIter.key()]);
|
||||
|
||||
Vms_.insert
|
||||
(
|
||||
@ -183,16 +175,11 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::Kd
|
||||
)
|
||||
);
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::KdTable,
|
||||
Kds_,
|
||||
KdIter
|
||||
)
|
||||
forAllConstIters(Kds_, KdIter)
|
||||
{
|
||||
const volScalarField& K(*KdIter());
|
||||
const phasePair& pair = *(this->phasePairs_[KdIter.key()]);
|
||||
|
||||
const phasePair& pair(this->phasePairs_[KdIter.key()]);
|
||||
const volScalarField& K(*KdIter());
|
||||
|
||||
const phaseModel* phase1 = &pair.phase1();
|
||||
const phaseModel* phase2 = &pair.phase2();
|
||||
@ -430,27 +417,17 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::momentumTransfer() const
|
||||
}
|
||||
|
||||
// Update the drag coefficients
|
||||
forAllConstIter
|
||||
(
|
||||
dragModelTable,
|
||||
dragModels_,
|
||||
dragModelIter
|
||||
)
|
||||
forAllConstIters(dragModels_, dragModelIter)
|
||||
{
|
||||
*Kds_[dragModelIter.key()] = dragModelIter()->K();
|
||||
}
|
||||
|
||||
// Add the implicit part of the drag force
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::KdTable,
|
||||
Kds_,
|
||||
KdIter
|
||||
)
|
||||
forAllConstIters(Kds_, KdIter)
|
||||
{
|
||||
const volScalarField& K(*KdIter());
|
||||
const phasePair& pair = *(this->phasePairs_[KdIter.key()]);
|
||||
|
||||
const phasePair& pair(this->phasePairs_[KdIter.key()]);
|
||||
const volScalarField& K(*KdIter());
|
||||
|
||||
const phaseModel* phase = &pair.phase1();
|
||||
const phaseModel* otherPhase = &pair.phase2();
|
||||
@ -466,27 +443,17 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::momentumTransfer() const
|
||||
}
|
||||
|
||||
// Update the virtual mass coefficients
|
||||
forAllConstIter
|
||||
(
|
||||
virtualMassModelTable,
|
||||
virtualMassModels_,
|
||||
virtualMassModelIter
|
||||
)
|
||||
forAllConstIters(virtualMassModels_, virtualMassModelIter)
|
||||
{
|
||||
*Vms_[virtualMassModelIter.key()] = virtualMassModelIter()->K();
|
||||
}
|
||||
|
||||
// Add the virtual mass force
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::VmTable,
|
||||
Vms_,
|
||||
VmIter
|
||||
)
|
||||
forAllConstIters(Vms_, VmIter)
|
||||
{
|
||||
const volScalarField& Vm(*VmIter());
|
||||
const phasePair& pair = *(this->phasePairs_[VmIter.key()]);
|
||||
|
||||
const phasePair& pair(this->phasePairs_[VmIter.key()]);
|
||||
const volScalarField& Vm(*VmIter());
|
||||
|
||||
const phaseModel* phase = &pair.phase1();
|
||||
const phaseModel* otherPhase = &pair.phase2();
|
||||
@ -557,33 +524,22 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::Fs() const
|
||||
PtrList<volVectorField>& Fs = tFs();
|
||||
|
||||
// Add the lift force
|
||||
forAllConstIter
|
||||
(
|
||||
liftModelTable,
|
||||
liftModels_,
|
||||
liftModelIter
|
||||
)
|
||||
forAllConstIters(liftModels_, modelIter)
|
||||
{
|
||||
const volVectorField F(liftModelIter()->F<vector>());
|
||||
const phasePair& pair = *(this->phasePairs_[modelIter.key()]);
|
||||
|
||||
const phasePair& pair(this->phasePairs_[liftModelIter.key()]);
|
||||
const volVectorField F(modelIter()->template F<vector>());
|
||||
|
||||
setF(Fs, pair.phase1().index()) += F;
|
||||
setF(Fs, pair.phase2().index()) -= F;
|
||||
}
|
||||
|
||||
// Add the wall lubrication force
|
||||
forAllConstIter
|
||||
(
|
||||
wallLubricationModelTable,
|
||||
wallLubricationModels_,
|
||||
wallLubricationModelIter
|
||||
)
|
||||
forAllConstIters(wallLubricationModels_, modelIter)
|
||||
{
|
||||
const volVectorField F(wallLubricationModelIter()->F<vector>());
|
||||
const phasePair& pair = *(this->phasePairs_[modelIter.key()]);
|
||||
|
||||
const phasePair&
|
||||
pair(this->phasePairs_[wallLubricationModelIter.key()]);
|
||||
const volVectorField F(modelIter()->template F<vector>());
|
||||
|
||||
setF(Fs, pair.phase1().index()) += F;
|
||||
setF(Fs, pair.phase2().index()) -= F;
|
||||
@ -647,15 +603,10 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiDs
|
||||
PtrList<surfaceScalarField>& phiDs = tphiDs();
|
||||
|
||||
// Add the turbulent dispersion force
|
||||
forAllConstIter
|
||||
(
|
||||
turbulentDispersionModelTable,
|
||||
turbulentDispersionModels_,
|
||||
turbulentDispersionModelIter
|
||||
)
|
||||
forAllConstIters(turbulentDispersionModels_, turbulentDispersionModelIter)
|
||||
{
|
||||
const phasePair&
|
||||
pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
|
||||
const phasePair& pair =
|
||||
*(this->phasePairs_[turbulentDispersionModelIter.key()]);
|
||||
|
||||
const volScalarField D(turbulentDispersionModelIter()->D());
|
||||
const surfaceScalarField snGradAlpha1
|
||||
|
||||
@ -42,14 +42,9 @@ ThermalPhaseChangePhaseSystem
|
||||
massTransfer_(this->lookup("massTransfer"))
|
||||
{
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
@ -92,7 +87,7 @@ template<class BasePhaseSystem>
|
||||
const Foam::saturationModel&
|
||||
Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::saturation() const
|
||||
{
|
||||
return saturationModel_();
|
||||
return *saturationModel_;
|
||||
}
|
||||
|
||||
|
||||
@ -109,14 +104,9 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::heatTransfer() const
|
||||
phaseSystem::heatTransferTable& eqns = eqnsPtr();
|
||||
|
||||
// Accumulate mDotL contributions from boundaries
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
@ -219,19 +209,15 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::massTransfer() const
|
||||
}
|
||||
}
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const phaseModel& phase = pair.phase1();
|
||||
const phaseModel& otherPhase = pair.phase2();
|
||||
|
||||
@ -292,14 +278,9 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::iDmdt
|
||||
)
|
||||
);
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
@ -332,14 +313,9 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
|
||||
|
||||
BasePhaseSystem::correctThermo();
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
|
||||
@ -401,7 +401,7 @@ template<class BasePhaseModel>
|
||||
const Foam::phaseCompressibleTurbulenceModel&
|
||||
Foam::MovingPhaseModel<BasePhaseModel>::turbulence() const
|
||||
{
|
||||
return turbulence_;
|
||||
return *turbulence_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ Foam::phaseModel::phaseModel
|
||||
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<phaseModel>(nullptr);
|
||||
return autoPtr<phaseModel>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -48,8 +48,8 @@ void Foam::phaseSystem::createSubModels
|
||||
key,
|
||||
modelType::New
|
||||
(
|
||||
*iter,
|
||||
phasePairs_[key]
|
||||
iter.object(),
|
||||
phasePairs_[key]()
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -98,11 +98,11 @@ void Foam::phaseSystem::generatePairsAndSubModels
|
||||
const blendingMethod& blending
|
||||
(
|
||||
blendingMethods_.found(modelName)
|
||||
? blendingMethods_[modelName]
|
||||
: blendingMethods_["default"]
|
||||
? *(blendingMethods_[modelName])
|
||||
: *(blendingMethods_["default"])
|
||||
);
|
||||
|
||||
autoPtr<modelType> noModel(nullptr);
|
||||
autoPtr<modelType> noModel;
|
||||
|
||||
forAllConstIter(typename modelTypeTable, tempModels, iter)
|
||||
{
|
||||
|
||||
@ -217,16 +217,11 @@ while (pimple.correct())
|
||||
)
|
||||
);
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::KdTable,
|
||||
fluid.Kds(),
|
||||
KdIter
|
||||
)
|
||||
forAllConstIters(fluid.Kds(), KdIter)
|
||||
{
|
||||
const volScalarField& K(*KdIter());
|
||||
|
||||
const phasePair& pair(fluid.phasePairs()[KdIter.key()]);
|
||||
const phasePair& pair = *(fluid.phasePairs()[KdIter.key()]);
|
||||
|
||||
const phaseModel* phase1 = &pair.phase1();
|
||||
const phaseModel* phase2 = &pair.phase2();
|
||||
|
||||
@ -115,7 +115,7 @@ public:
|
||||
autoPtr<IATEsource> clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<IATEsource>(nullptr);
|
||||
return autoPtr<IATEsource>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -451,9 +451,11 @@ bool Foam::BlendedInterfacialModel<modelType>::hasModel
|
||||
) const
|
||||
{
|
||||
return
|
||||
&phase == &(pair_.phase1())
|
||||
(
|
||||
&phase == &(pair_.phase1())
|
||||
? model1In2_.valid()
|
||||
: model2In1_.valid();
|
||||
: model2In1_.valid()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -463,7 +465,7 @@ const modelType& Foam::BlendedInterfacialModel<modelType>::phaseModel
|
||||
const class phaseModel& phase
|
||||
) const
|
||||
{
|
||||
return &phase == &(pair_.phase1()) ? model1In2_ : model2In1_;
|
||||
return &phase == &(pair_.phase1()) ? *model1In2_ : *model2In1_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ public:
|
||||
autoPtr<IATEsource> clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<IATEsource>(nullptr);
|
||||
return autoPtr<IATEsource>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -227,14 +227,14 @@ Foam::tmp<Foam::volScalarField> Foam::phaseModel::d() const
|
||||
Foam::PhaseCompressibleTurbulenceModel<Foam::phaseModel>&
|
||||
Foam::phaseModel::turbulence()
|
||||
{
|
||||
return turbulence_();
|
||||
return *turbulence_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::PhaseCompressibleTurbulenceModel<Foam::phaseModel>&
|
||||
Foam::phaseModel::turbulence() const
|
||||
{
|
||||
return turbulence_();
|
||||
return *turbulence_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -162,14 +162,14 @@ public:
|
||||
//- Return the thermophysical model
|
||||
const rhoThermo& thermo() const
|
||||
{
|
||||
return thermo_();
|
||||
return *thermo_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the thermophysical model
|
||||
// for correction
|
||||
rhoThermo& thermo()
|
||||
{
|
||||
return thermo_();
|
||||
return *thermo_;
|
||||
}
|
||||
|
||||
//- Return the laminar viscosity
|
||||
@ -286,13 +286,13 @@ public:
|
||||
//- Return the volumetric flux
|
||||
const surfaceScalarField& phi() const
|
||||
{
|
||||
return phiPtr_();
|
||||
return *phiPtr_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the volumetric flux
|
||||
surfaceScalarField& phi()
|
||||
{
|
||||
return phiPtr_();
|
||||
return *phiPtr_;
|
||||
}
|
||||
|
||||
//- Return the volumetric flux of the phase
|
||||
|
||||
@ -177,12 +177,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
||||
lookup("drag"),
|
||||
(
|
||||
blendingMethods_.found("drag")
|
||||
? blendingMethods_["drag"]
|
||||
: blendingMethods_["default"]
|
||||
? *(blendingMethods_["drag"])
|
||||
: *(blendingMethods_["default"])
|
||||
),
|
||||
pair_,
|
||||
pair1In2_,
|
||||
pair2In1_,
|
||||
*pair_,
|
||||
*pair1In2_,
|
||||
*pair2In1_,
|
||||
false // Do not zero drag coefficent at fixed-flux BCs
|
||||
)
|
||||
);
|
||||
@ -194,12 +194,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
||||
lookup("virtualMass"),
|
||||
(
|
||||
blendingMethods_.found("virtualMass")
|
||||
? blendingMethods_["virtualMass"]
|
||||
: blendingMethods_["default"]
|
||||
? *(blendingMethods_["virtualMass"])
|
||||
: *(blendingMethods_["default"])
|
||||
),
|
||||
pair_,
|
||||
pair1In2_,
|
||||
pair2In1_
|
||||
*pair_,
|
||||
*pair1In2_,
|
||||
*pair2In1_
|
||||
)
|
||||
);
|
||||
|
||||
@ -210,12 +210,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
||||
lookup("heatTransfer"),
|
||||
(
|
||||
blendingMethods_.found("heatTransfer")
|
||||
? blendingMethods_["heatTransfer"]
|
||||
: blendingMethods_["default"]
|
||||
? *(blendingMethods_["heatTransfer"])
|
||||
: *(blendingMethods_["default"])
|
||||
),
|
||||
pair_,
|
||||
pair1In2_,
|
||||
pair2In1_
|
||||
*pair_,
|
||||
*pair1In2_,
|
||||
*pair2In1_
|
||||
)
|
||||
);
|
||||
|
||||
@ -226,12 +226,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
||||
lookup("lift"),
|
||||
(
|
||||
blendingMethods_.found("lift")
|
||||
? blendingMethods_["lift"]
|
||||
: blendingMethods_["default"]
|
||||
? *(blendingMethods_["lift"])
|
||||
: *(blendingMethods_["default"])
|
||||
),
|
||||
pair_,
|
||||
pair1In2_,
|
||||
pair2In1_
|
||||
*pair_,
|
||||
*pair1In2_,
|
||||
*pair2In1_
|
||||
)
|
||||
);
|
||||
|
||||
@ -242,12 +242,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
||||
lookup("wallLubrication"),
|
||||
(
|
||||
blendingMethods_.found("wallLubrication")
|
||||
? blendingMethods_["wallLubrication"]
|
||||
: blendingMethods_["default"]
|
||||
? *(blendingMethods_["wallLubrication"])
|
||||
: *(blendingMethods_["default"])
|
||||
),
|
||||
pair_,
|
||||
pair1In2_,
|
||||
pair2In1_
|
||||
*pair_,
|
||||
*pair1In2_,
|
||||
*pair2In1_
|
||||
)
|
||||
);
|
||||
|
||||
@ -258,12 +258,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
||||
lookup("turbulentDispersion"),
|
||||
(
|
||||
blendingMethods_.found("turbulentDispersion")
|
||||
? blendingMethods_["turbulentDispersion"]
|
||||
: blendingMethods_["default"]
|
||||
? *(blendingMethods_["turbulentDispersion"])
|
||||
: *(blendingMethods_["default"])
|
||||
),
|
||||
pair_,
|
||||
pair1In2_,
|
||||
pair2In1_
|
||||
*pair_,
|
||||
*pair1In2_,
|
||||
*pair2In1_
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -272,7 +272,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::twoPhaseSystem::~twoPhaseSystem()
|
||||
{}
|
||||
{} // Define here (incomplete type in header)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
@ -16,7 +16,7 @@ volVectorField D
|
||||
);
|
||||
|
||||
|
||||
autoPtr<volScalarField> Tptr(nullptr);
|
||||
autoPtr<volScalarField> Tptr;
|
||||
|
||||
if (thermalStress)
|
||||
{
|
||||
|
||||
3
applications/test/autoPtr/Make/files
Normal file
3
applications/test/autoPtr/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-autoPtr.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-autoPtr
|
||||
5
applications/test/autoPtr/Make/options
Normal file
5
applications/test/autoPtr/Make/options
Normal file
@ -0,0 +1,5 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lthermophysicalProperties
|
||||
219
applications/test/autoPtr/Test-autoPtr.C
Normal file
219
applications/test/autoPtr/Test-autoPtr.C
Normal file
@ -0,0 +1,219 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "autoPtr.H"
|
||||
#include "labelList.H"
|
||||
#include "ListOps.H"
|
||||
#include "IOstreams.H"
|
||||
#include "Switch.H"
|
||||
|
||||
#include "C7H16.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
// An example of bad use, since our autoPtr is too generous when being passed
|
||||
// around
|
||||
void testTransfer1(autoPtr<labelList> ap)
|
||||
{
|
||||
// Passed in copy, so automatically removes content
|
||||
// Transfer would be nice, but not actually needed
|
||||
|
||||
Info<< "recv " << Switch(ap.valid()).c_str() << nl;
|
||||
}
|
||||
|
||||
|
||||
// An example of good use. We are allowed to manage the memory (or not)
|
||||
// and not automatically start losing things.
|
||||
void testTransfer2(autoPtr<labelList>&& ap)
|
||||
{
|
||||
// As rvalue, so this time we actually get to manage content
|
||||
Info<< "recv " << Switch(ap.valid()).c_str() << nl;
|
||||
}
|
||||
|
||||
|
||||
// Constructor from literal nullptr is implicit
|
||||
template<class T>
|
||||
autoPtr<T> testNullReturn1()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
// Constructor from raw pointer is explicit
|
||||
template<class T>
|
||||
autoPtr<T> testNullReturn2()
|
||||
{
|
||||
T* p = new T;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
{
|
||||
auto list = autoPtr<labelList>::New(10, label(-1));
|
||||
|
||||
Info<<"create: " << list() << nl;
|
||||
|
||||
Info<<"create: " << autoPtr<labelList>::New(10, label(-1))()
|
||||
<< nl << nl;
|
||||
}
|
||||
|
||||
// Confirm that forwarding with move construct actually works as expected
|
||||
{
|
||||
auto source = identity(8);
|
||||
Info<<"move construct from "
|
||||
<< flatOutput(source) << " @ " << long(source.cdata())
|
||||
<< nl << nl;
|
||||
|
||||
auto list = autoPtr<labelList>::New(std::move(source));
|
||||
|
||||
Info<<"created: " << flatOutput(*list) << " @ " << long(list->cdata())
|
||||
<< nl << nl;
|
||||
|
||||
Info<<"orig: "
|
||||
<< flatOutput(source) << " @ " << long(source.cdata())
|
||||
<< nl << nl;
|
||||
}
|
||||
|
||||
// Explicit construct Base from Derived
|
||||
{
|
||||
autoPtr<liquidProperties> liqProp
|
||||
(
|
||||
autoPtr<C7H16>::New()
|
||||
);
|
||||
|
||||
Info<<"liq 1: " << liqProp() << nl << nl;
|
||||
}
|
||||
|
||||
// Construct Base from Derived
|
||||
{
|
||||
autoPtr<liquidProperties> liqProp =
|
||||
autoPtr<liquidProperties>::NewFrom<C7H16>();
|
||||
|
||||
Info<<"liq 2: " << liqProp() << nl << nl;
|
||||
}
|
||||
|
||||
// Construct Base from Derived
|
||||
{
|
||||
const autoPtr<liquidProperties> liqProp(autoPtr<C7H16>::New());
|
||||
|
||||
Info<<"liq: " << liqProp() << nl << nl;
|
||||
Info<<"liq-type: " << liqProp->type() << nl << nl;
|
||||
Info<<"type: " << typeid(liqProp.get()).name() << nl;
|
||||
}
|
||||
|
||||
// Memory transfer
|
||||
{
|
||||
Info<< nl << nl;
|
||||
|
||||
auto list = autoPtr<labelList>::New(identity(8));
|
||||
Info<<"forward to function from "
|
||||
<< flatOutput(*list) << " @ " << long(list->cdata())
|
||||
<< nl << nl;
|
||||
|
||||
testTransfer2(std::move(list));
|
||||
|
||||
Info<<"now have valid=" << Switch(list.valid()).c_str();
|
||||
|
||||
if (list.valid())
|
||||
{
|
||||
Info<< nl
|
||||
<< flatOutput(*list) << " @ " << long(list->cdata())
|
||||
<< nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< nl;
|
||||
}
|
||||
}
|
||||
|
||||
// Memory transfer
|
||||
{
|
||||
Info<< nl << nl;
|
||||
|
||||
testTransfer2(autoPtr<labelList>::New(identity(8)));
|
||||
}
|
||||
|
||||
// Memory transfer
|
||||
{
|
||||
Info<< nl << nl;
|
||||
|
||||
auto list = autoPtr<labelList>::New(identity(8));
|
||||
Info<<"forward to function from "
|
||||
<< flatOutput(*list) << " @ " << long(list->cdata())
|
||||
<< nl << nl;
|
||||
|
||||
testTransfer2(std::move(list));
|
||||
|
||||
Info<<"now have valid=" << Switch(list.valid()).c_str();
|
||||
|
||||
if (list.valid())
|
||||
{
|
||||
Info<< nl
|
||||
<< flatOutput(*list) << " @ " << long(list->cdata())
|
||||
<< nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Memory transfer
|
||||
{
|
||||
auto ptr1 = autoPtr<labelList>::New();
|
||||
auto ptr2 = autoPtr<labelList>::New();
|
||||
|
||||
Info<<"ptr valid: " << ptr1.valid() << nl;
|
||||
|
||||
// Refuses to compile (good!): ptr1 = new labelList(10);
|
||||
|
||||
// Does compile (good!): ptr1 = nullptr;
|
||||
|
||||
ptr1.reset(std::move(ptr2));
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
// Good this work:
|
||||
autoPtr<labelList> ptr1 = testNullReturn1<labelList>();
|
||||
|
||||
// Good this does not compile:
|
||||
// autoPtr<labelList> ptr2 = testNullReturn2<labelList>();
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -202,7 +202,7 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh(mesh, inflate);
|
||||
|
||||
Info<< "Mapping fields" << nl << endl;
|
||||
mesh.updateMesh(morphMap);
|
||||
mesh.updateMesh(morphMap());
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (morphMap().hasMotionPoints())
|
||||
@ -212,7 +212,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
faceRemover.updateMesh(morphMap);
|
||||
faceRemover.updateMesh(morphMap());
|
||||
|
||||
|
||||
Info<< "Writing fields" << nl << endl;
|
||||
|
||||
@ -276,7 +276,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Update fields
|
||||
Info<< nl << "-- mapping mesh data" << endl;
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Inflate mesh
|
||||
if (map().hasMotionPoints())
|
||||
@ -287,7 +287,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
Info<< nl << "-- mapping hexRef8 data" << endl;
|
||||
meshCutter.updateMesh(map);
|
||||
meshCutter.updateMesh(map());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1155,7 +1155,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Change the mesh. Change points directly (no inflation).
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(subsetter.subMesh(), false);
|
||||
autoPtr<mapPolyMesh> mapPtr =
|
||||
meshMod.changeMesh(subsetter.subMesh(), false);
|
||||
mapPolyMesh& map = *mapPtr;
|
||||
|
||||
// Update fields
|
||||
subsetter.subMesh().updateMesh(map);
|
||||
@ -1231,9 +1233,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Move mesh (since morphing might not do this)
|
||||
if (map().hasMotionPoints())
|
||||
if (map.hasMotionPoints())
|
||||
{
|
||||
subsetter.subMesh().movePoints(map().preMotionPoints());
|
||||
subsetter.subMesh().movePoints(map.preMotionPoints());
|
||||
}
|
||||
|
||||
Info<< "Writing mesh with split blockedFaces to time " << runTime.value()
|
||||
|
||||
@ -186,7 +186,7 @@ int main(int argc, char *argv[])
|
||||
polyMeshFilter::copySets(newMesh(), mesh);
|
||||
}
|
||||
|
||||
pointPriority = meshFilter.pointPriority();
|
||||
pointPriority = *(meshFilter.pointPriority());
|
||||
}
|
||||
|
||||
if (collapseFaceSet)
|
||||
@ -203,14 +203,14 @@ int main(int argc, char *argv[])
|
||||
// from the previous edge filtering to use as a stopping criterion.
|
||||
meshFilter.filter(indirectPatchFaces);
|
||||
{
|
||||
polyTopoChange meshMod(newMesh);
|
||||
polyTopoChange meshMod(newMesh());
|
||||
|
||||
meshMod.changeMesh(mesh, false);
|
||||
|
||||
polyMeshFilter::copySets(newMesh(), mesh);
|
||||
}
|
||||
|
||||
pointPriority = meshFilter.pointPriority();
|
||||
pointPriority = *(meshFilter.pointPriority());
|
||||
}
|
||||
|
||||
if (collapseFaces)
|
||||
@ -227,14 +227,14 @@ int main(int argc, char *argv[])
|
||||
// from the previous edge filtering to use as a stopping criterion.
|
||||
meshFilter.filter(nBadFaces);
|
||||
{
|
||||
polyTopoChange meshMod(newMesh);
|
||||
polyTopoChange meshMod(newMesh());
|
||||
|
||||
meshMod.changeMesh(mesh, false);
|
||||
|
||||
polyMeshFilter::copySets(newMesh(), mesh);
|
||||
}
|
||||
|
||||
pointPriority = meshFilter.pointPriority();
|
||||
pointPriority = *(meshFilter.pointPriority());
|
||||
}
|
||||
|
||||
// Write resulting mesh
|
||||
|
||||
@ -113,7 +113,7 @@ label mergePatchFaces
|
||||
map = meshMod.changeMesh(mesh, false, true);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (map().hasMotionPoints())
|
||||
@ -269,7 +269,7 @@ label mergePatchFaces
|
||||
map = meshMod.changeMesh(mesh, false, true);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (map().hasMotionPoints())
|
||||
@ -322,7 +322,7 @@ label mergeEdges(const scalar minCos, polyMesh& mesh)
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false, true);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (map().hasMotionPoints())
|
||||
|
||||
@ -174,10 +174,10 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
meshCutter.updateMesh(map);
|
||||
meshCutter.updateMesh(map());
|
||||
|
||||
// Optionally inflate mesh
|
||||
if (map().hasMotionPoints())
|
||||
|
||||
@ -155,18 +155,18 @@ int main(int argc, char *argv[])
|
||||
meshMod
|
||||
);
|
||||
|
||||
autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh(mesh, false);
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
mesh.updateMesh(morphMap);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (morphMap().hasMotionPoints())
|
||||
if (map().hasMotionPoints())
|
||||
{
|
||||
mesh.movePoints(morphMap().preMotionPoints());
|
||||
mesh.movePoints(map().preMotionPoints());
|
||||
}
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
faceRemover.updateMesh(morphMap);
|
||||
faceRemover.updateMesh(map());
|
||||
|
||||
if (!overwrite)
|
||||
{
|
||||
|
||||
@ -416,20 +416,14 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
|
||||
// Surface
|
||||
autoPtr<triSurface> surf(nullptr);
|
||||
// Search engine on surface.
|
||||
autoPtr<triSurfaceSearch> querySurf(nullptr);
|
||||
|
||||
if (useSurface)
|
||||
{
|
||||
surf.reset(new triSurface(surfName));
|
||||
triSurface surf(surfName);
|
||||
|
||||
// Dump some stats
|
||||
surf().writeStats(Info);
|
||||
surf.writeStats(Info);
|
||||
|
||||
// Search engine on surface.
|
||||
querySurf.reset(new triSurfaceSearch(surf));
|
||||
triSurfaceSearch querySurf(surf);
|
||||
|
||||
// Set cellType[celli] according to relation to surface
|
||||
cutBySurface
|
||||
|
||||
@ -266,7 +266,7 @@ int main(int argc, char *argv[])
|
||||
Info<< nl << "Bounding box size: " << mesh().bounds().span() << nl;
|
||||
|
||||
// check number of regions
|
||||
regionSplit rs(mesh);
|
||||
regionSplit rs(mesh());
|
||||
|
||||
Info<< "Number of regions: " << rs.nRegions();
|
||||
if (rs.nRegions() == 1)
|
||||
@ -281,7 +281,7 @@ int main(int argc, char *argv[])
|
||||
<< "**************************************************" << nl;
|
||||
}
|
||||
Info<< endl;
|
||||
reader.writeMesh(mesh, format);
|
||||
reader.writeMesh(mesh(), format);
|
||||
|
||||
// exportName only has a size when export is in effect
|
||||
if (exportName.size())
|
||||
|
||||
@ -119,7 +119,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
autoPtr<polyMesh> mesh = reader.mesh(runTime);
|
||||
reader.writeMesh(mesh, format);
|
||||
reader.writeMesh(mesh(), format);
|
||||
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
@ -338,7 +338,7 @@ int main(int argc, char *argv[])
|
||||
wordList(0)
|
||||
)
|
||||
);
|
||||
const polyMesh& mesh = meshPtr;
|
||||
const polyMesh& mesh = *meshPtr;
|
||||
|
||||
|
||||
if (readFaceFile)
|
||||
|
||||
@ -433,7 +433,7 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (map().hasMotionPoints())
|
||||
@ -788,7 +788,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
layerExtrude.addedCells
|
||||
(
|
||||
meshFromMesh,
|
||||
*meshFromMesh,
|
||||
layerExtrude.layerFaces()
|
||||
)
|
||||
);
|
||||
@ -937,7 +937,7 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Update stored data
|
||||
updateFaceLabels(map(), frontPatchFaces);
|
||||
@ -1074,7 +1074,7 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Update local data
|
||||
updateCellSet(map(), addedCellsSet);
|
||||
|
||||
@ -2470,7 +2470,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Update numbering on extruder.
|
||||
extruder.updateMesh(shellMap);
|
||||
extruder.updateMesh(shellMap());
|
||||
|
||||
|
||||
// Calculate offsets from shell mesh back to original mesh
|
||||
@ -2818,7 +2818,7 @@ int main(int argc, char *argv[])
|
||||
addBafflesMap = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(addBafflesMap);
|
||||
mesh.updateMesh(addBafflesMap());
|
||||
|
||||
|
||||
//XXXXXX
|
||||
|
||||
@ -251,7 +251,7 @@ int main(int argc, char *argv[])
|
||||
// Create a mesh from topo changes.
|
||||
autoPtr<mapPolyMesh> morphMap = meshMod().changeMesh(mesh(), false);
|
||||
|
||||
mesh().updateMesh(morphMap);
|
||||
mesh().updateMesh(morphMap());
|
||||
|
||||
{
|
||||
edgeCollapser collapser(mesh());
|
||||
@ -302,7 +302,7 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> morphMap
|
||||
= meshModCollapse.changeMesh(mesh(), false);
|
||||
|
||||
mesh().updateMesh(morphMap);
|
||||
mesh().updateMesh(morphMap());
|
||||
}
|
||||
|
||||
if (!overwrite)
|
||||
|
||||
@ -142,13 +142,6 @@ Foam::DistributedDelaunayMesh<Triangulation>::DistributedDelaunayMesh
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Triangulation>
|
||||
Foam::DistributedDelaunayMesh<Triangulation>::~DistributedDelaunayMesh()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Triangulation>
|
||||
@ -491,7 +484,8 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices
|
||||
|
||||
const label preDistributionSize = parallelVertices.size();
|
||||
|
||||
mapDistribute pointMap = buildMap(targetProcessor);
|
||||
autoPtr<mapDistribute> pointMapPtr = buildMap(targetProcessor);
|
||||
mapDistribute& pointMap = *pointMapPtr;
|
||||
|
||||
// Make a copy of the original list.
|
||||
DynamicList<Vb> originalParallelVertices(parallelVertices);
|
||||
|
||||
@ -141,7 +141,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
~DistributedDelaunayMesh();
|
||||
~DistributedDelaunayMesh() = default;
|
||||
|
||||
|
||||
// Queries
|
||||
|
||||
@ -248,10 +248,10 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
);
|
||||
|
||||
// Update fields
|
||||
mesh_.updateMesh(map);
|
||||
mesh_.updateMesh(map());
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
meshCutter_.updateMesh(map);
|
||||
meshCutter_.updateMesh(map());
|
||||
|
||||
{
|
||||
// Map volumeStatus
|
||||
@ -357,11 +357,11 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
);
|
||||
|
||||
// Update fields
|
||||
mesh_.updateMesh(map);
|
||||
mesh_.updateMesh(map());
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
meshCutter_.updateMesh(map);
|
||||
cellRemover.updateMesh(map);
|
||||
meshCutter_.updateMesh(map());
|
||||
cellRemover.updateMesh(map());
|
||||
|
||||
{
|
||||
// Map volumeStatus
|
||||
@ -416,7 +416,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
newDecomp
|
||||
);
|
||||
|
||||
meshCutter_.distribute(mapDist);
|
||||
meshCutter_.distribute(mapDist());
|
||||
|
||||
mapDist().distributeCellData(volumeStatus);
|
||||
|
||||
@ -840,12 +840,6 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::backgroundMeshDecomposition::~backgroundMeshDecomposition()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::mapDistributePolyMesh>
|
||||
@ -954,10 +948,10 @@ Foam::backgroundMeshDecomposition::distribute
|
||||
);
|
||||
|
||||
// Update fields
|
||||
mesh_.updateMesh(map);
|
||||
mesh_.updateMesh(map());
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
meshCutter_.updateMesh(map);
|
||||
meshCutter_.updateMesh(map());
|
||||
|
||||
Info<< " Background mesh refined from "
|
||||
<< returnReduce(map().nOldCells(), sumOp<label>())
|
||||
@ -1000,7 +994,7 @@ Foam::backgroundMeshDecomposition::distribute
|
||||
|
||||
autoPtr<mapDistributePolyMesh> mapDist = distributor.distribute(newDecomp);
|
||||
|
||||
meshCutter_.distribute(mapDist);
|
||||
meshCutter_.distribute(mapDist());
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
||||
@ -204,7 +204,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
~backgroundMeshDecomposition();
|
||||
~backgroundMeshDecomposition() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -34,7 +34,7 @@ const Foam::fvMesh& Foam::backgroundMeshDecomposition::mesh() const
|
||||
const Foam::indexedOctree<Foam::treeDataBPatch>&
|
||||
Foam::backgroundMeshDecomposition::tree() const
|
||||
{
|
||||
return bFTreePtr_();
|
||||
return *bFTreePtr_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -509,7 +509,7 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh()
|
||||
if (!distributeBackground(cellSizeMesh))
|
||||
{
|
||||
// Synchronise the cell size mesh if it has not been distributed
|
||||
cellSizeMesh.distribute(decomposition_);
|
||||
cellSizeMesh.distribute(decomposition_());
|
||||
}
|
||||
}
|
||||
|
||||
@ -531,7 +531,7 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh()
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
cellSizeMesh.distribute(decomposition_);
|
||||
cellSizeMesh.distribute(decomposition_());
|
||||
}
|
||||
|
||||
Info<< " Iteration " << i
|
||||
@ -549,7 +549,7 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh()
|
||||
// Need to distribute the cell size mesh to cover the background mesh
|
||||
if (!distributeBackground(cellSizeMesh))
|
||||
{
|
||||
cellSizeMesh.distribute(decomposition_);
|
||||
cellSizeMesh.distribute(decomposition_());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -563,7 +563,7 @@ Foam::conformalVoronoiMesh::decomposition() const
|
||||
<< exit(FatalError) << endl;
|
||||
}
|
||||
|
||||
return decomposition_();
|
||||
return *decomposition_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -132,7 +132,7 @@ bool Foam::conformalVoronoiMesh::distributeBackground(const Triangulation& mesh)
|
||||
cellWeights
|
||||
);
|
||||
|
||||
cellShapeControl_.shapeControlMesh().distribute(decomposition_);
|
||||
cellShapeControl_.shapeControlMesh().distribute(decomposition_());
|
||||
|
||||
distribute();
|
||||
|
||||
|
||||
@ -113,10 +113,4 @@ Foam::autoPtr<Foam::initialPointsMethod> Foam::initialPointsMethod::New
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::initialPointsMethod::~initialPointsMethod()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -156,7 +156,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~initialPointsMethod();
|
||||
virtual ~initialPointsMethod() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -185,7 +185,7 @@ public:
|
||||
|
||||
const backgroundMeshDecomposition& decomposition() const
|
||||
{
|
||||
return decomposition_;
|
||||
return *decomposition_;
|
||||
}
|
||||
|
||||
//- Const access to the details dictionary
|
||||
|
||||
@ -101,7 +101,7 @@ public:
|
||||
virtual autoPtr<searchableSurfaceFeatures> clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<searchableSurfaceFeatures>(nullptr);
|
||||
return autoPtr<searchableSurfaceFeatures>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -200,7 +200,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh(pMesh, false);
|
||||
|
||||
pMesh.updateMesh(morphMap);
|
||||
pMesh.updateMesh(morphMap());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -544,7 +544,7 @@ Foam::label Foam::checkGeometry
|
||||
nonAlignedPoints.write();
|
||||
if (setWriter.valid())
|
||||
{
|
||||
mergeAndWrite(setWriter, nonAlignedPoints);
|
||||
mergeAndWrite(setWriter(), nonAlignedPoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -786,7 +786,7 @@ Foam::label Foam::checkGeometry
|
||||
points.write();
|
||||
if (setWriter.valid())
|
||||
{
|
||||
mergeAndWrite(setWriter, points);
|
||||
mergeAndWrite(setWriter(), points);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -809,7 +809,7 @@ Foam::label Foam::checkGeometry
|
||||
nearPoints.write();
|
||||
if (setWriter.valid())
|
||||
{
|
||||
mergeAndWrite(setWriter, nearPoints);
|
||||
mergeAndWrite(setWriter(), nearPoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ Foam::label Foam::checkTopology
|
||||
points.write();
|
||||
if (setWriter.valid())
|
||||
{
|
||||
mergeAndWrite(setWriter, points);
|
||||
mergeAndWrite(setWriter(), points);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -528,7 +528,7 @@ Foam::label Foam::checkTopology
|
||||
points.write();
|
||||
if (setWriter.valid())
|
||||
{
|
||||
mergeAndWrite(setWriter, points);
|
||||
mergeAndWrite(setWriter(), points);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -639,7 +639,7 @@ Foam::label Foam::checkTopology
|
||||
points.write();
|
||||
if (setWriter.valid())
|
||||
{
|
||||
mergeAndWrite(setWriter, points);
|
||||
mergeAndWrite(setWriter(), points);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -824,14 +824,13 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
|
||||
mesh.updateMesh(map());
|
||||
|
||||
|
||||
// Correct boundary faces mapped-out-of-nothing.
|
||||
// This is just a hack to correct the value field.
|
||||
{
|
||||
fvMeshMapper mapper(mesh, map);
|
||||
fvMeshMapper mapper(mesh, map());
|
||||
bool hasWarned = false;
|
||||
|
||||
forAllConstIter(wordHashSet, bafflePatches, iter)
|
||||
|
||||
@ -109,7 +109,7 @@ public:
|
||||
autoPtr<faceSelection> clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<faceSelection>(nullptr);
|
||||
return autoPtr<faceSelection>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ public:
|
||||
autoPtr<faceSelection> clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<faceSelection>(nullptr);
|
||||
return autoPtr<faceSelection>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ public:
|
||||
autoPtr<faceSelection> clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<faceSelection>(nullptr);
|
||||
return autoPtr<faceSelection>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -450,7 +450,7 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (map().hasMotionPoints())
|
||||
@ -520,7 +520,7 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (map().hasMotionPoints())
|
||||
|
||||
@ -531,7 +531,7 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Optionally inflate mesh
|
||||
if (map().hasMotionPoints())
|
||||
|
||||
@ -1089,7 +1089,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Update proc maps
|
||||
if (cellProcAddressing.headerOk())
|
||||
|
||||
@ -472,7 +472,7 @@ bool doCommand
|
||||
setSource().applyToSet(topoSetSource::NEW, currentSet);
|
||||
|
||||
// Combine new value of currentSet with old one.
|
||||
currentSet.subset(oldSet);
|
||||
currentSet.subset(oldSet());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -814,7 +814,7 @@ int main(int argc, char *argv[])
|
||||
// Main command read & execute loop
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
autoPtr<IFstream> fileStreamPtr(nullptr);
|
||||
autoPtr<IFstream> fileStreamPtr;
|
||||
|
||||
if (batch)
|
||||
{
|
||||
|
||||
@ -257,7 +257,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints
|
||||
|
||||
if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0)
|
||||
{
|
||||
return autoPtr<mapPolyMesh>(nullptr);
|
||||
return autoPtr<mapPolyMesh>();
|
||||
}
|
||||
|
||||
polyTopoChange meshMod(mesh);
|
||||
@ -268,7 +268,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false, true);
|
||||
|
||||
// Update fields. No inflation, parallel sync.
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// pointProcAddressing give indices into the master mesh so adapt them
|
||||
// for changed point numbering.
|
||||
@ -699,7 +699,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
masterMesh[proci],
|
||||
meshToAdd,
|
||||
couples
|
||||
couples()
|
||||
);
|
||||
|
||||
// Added processor
|
||||
@ -738,7 +738,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
masterMesh[proci],
|
||||
masterMesh[next],
|
||||
couples
|
||||
couples()
|
||||
);
|
||||
|
||||
// Processors that were already in masterMesh
|
||||
|
||||
@ -1810,18 +1810,20 @@ void reconstructLagrangian
|
||||
);
|
||||
}
|
||||
const parLagrangianRedistributor& lagrangianReconstructor =
|
||||
lagrangianReconstructorPtr();
|
||||
*lagrangianReconstructorPtr;
|
||||
|
||||
for (const word& cloudName : cloudNames)
|
||||
{
|
||||
Info<< "Reconstructing lagrangian fields for cloud "
|
||||
<< cloudName << nl << endl;
|
||||
|
||||
autoPtr<mapDistributeBase> lagrangianMap =
|
||||
autoPtr<mapDistributeBase> lagrangianMapPtr =
|
||||
lagrangianReconstructor.redistributeLagrangianPositions
|
||||
(
|
||||
cloudName
|
||||
);
|
||||
const mapDistributeBase& lagrangianMap = *lagrangianMapPtr;
|
||||
|
||||
IOobjectList sprayObjs
|
||||
(
|
||||
mesh,
|
||||
@ -2129,8 +2131,9 @@ void redistributeLagrangian
|
||||
|
||||
forAll(clouds, i)
|
||||
{
|
||||
autoPtr<mapDistributeBase> lagrangianMap =
|
||||
distributor.redistributeLagrangianPositions(clouds[i]);
|
||||
autoPtr<mapDistributeBase> lagrangianMapPtr =
|
||||
distributor.redistributeLagrangianPositions(clouds[i]);
|
||||
const mapDistributeBase& lagrangianMap = *lagrangianMapPtr;
|
||||
|
||||
distributor.redistributeStoredLagrangianFields
|
||||
<IOField<label>>
|
||||
@ -2694,7 +2697,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
baseMeshPtr(),
|
||||
mesh,
|
||||
distMap,
|
||||
distMap(),
|
||||
Pstream::master() // do I need to write?
|
||||
)
|
||||
);
|
||||
@ -2778,7 +2781,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
baseMeshPtr(),
|
||||
mesh,
|
||||
distMap,
|
||||
distMap(),
|
||||
Pstream::master()
|
||||
)
|
||||
);
|
||||
@ -2804,7 +2807,7 @@ int main(int argc, char *argv[])
|
||||
lagrangianReconstructorPtr,
|
||||
baseMeshPtr(),
|
||||
mesh,
|
||||
distMap,
|
||||
distMap(),
|
||||
selectedLagrangianFields
|
||||
);
|
||||
|
||||
@ -3012,7 +3015,7 @@ int main(int argc, char *argv[])
|
||||
lagrangianReconstructorPtr,
|
||||
mesh,
|
||||
nOldCells,
|
||||
distMap,
|
||||
distMap(),
|
||||
clouds
|
||||
);
|
||||
|
||||
|
||||
@ -142,7 +142,7 @@ bool Foam::ensightCloud::writeCloudField
|
||||
IOField<Type> field(fieldObject);
|
||||
fieldObject.readOpt() = rOpt;
|
||||
|
||||
writeCloudField(field, output.rawRef());
|
||||
writeCloudField(field, output.ref());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -83,7 +83,7 @@ bool Foam::ensightSerialCloud::writeCloudField
|
||||
)
|
||||
{
|
||||
IOField<Type> field(fieldObject);
|
||||
return writeCloudField(field, output.rawRef());
|
||||
return writeCloudField(field, output.ref());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -269,7 +269,7 @@ int main(int argc, char *argv[])
|
||||
if (!optNoMesh)
|
||||
{
|
||||
autoPtr<ensightGeoFile> os = ensCase.newGeometry(meshMoving);
|
||||
partsList.write(os.rawRef());
|
||||
partsList.write(os.ref());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ public:
|
||||
|
||||
inline vtk::formatter& format()
|
||||
{
|
||||
return format_();
|
||||
return *format_;
|
||||
}
|
||||
|
||||
inline label nParcels() const
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
const scalar xMin = p->minValue();
|
||||
const scalar xMax = p->maxValue();
|
||||
|
||||
autoPtr<OFstream> filePtr(nullptr);
|
||||
autoPtr<OFstream> filePtr;
|
||||
if (writeData)
|
||||
{
|
||||
fileName fName = pdfPath/(p->type() + ".data");
|
||||
|
||||
@ -76,7 +76,7 @@ public:
|
||||
autoPtr<searchableSurfaceModifier> clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<searchableSurfaceModifier>(nullptr);
|
||||
return autoPtr<searchableSurfaceModifier>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ public:
|
||||
autoPtr<searchableSurfaceModifier> clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<searchableSurfaceModifier>(nullptr);
|
||||
return autoPtr<searchableSurfaceModifier>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ public:
|
||||
autoPtr<searchableSurfaceModifier> clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<searchableSurfaceModifier>(nullptr);
|
||||
return autoPtr<searchableSurfaceModifier>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -220,7 +220,7 @@ Foam::dynamicIndexedOctree<Type>::divide
|
||||
{
|
||||
if (!replaced)
|
||||
{
|
||||
contents_[contentI]().transfer(subIndices());
|
||||
contents_[contentI]->transfer(subIndices());
|
||||
nod.subNodes_[octant] = contentPlusOctant(contentI, octant);
|
||||
|
||||
replaced = true;
|
||||
@ -239,7 +239,7 @@ Foam::dynamicIndexedOctree<Type>::divide
|
||||
)
|
||||
);
|
||||
|
||||
contents_[sz]().transfer(subIndices());
|
||||
contents_[sz]->transfer(subIndices());
|
||||
|
||||
nod.subNodes_[octant] = contentPlusOctant(sz, octant);
|
||||
}
|
||||
@ -280,7 +280,7 @@ void Foam::dynamicIndexedOctree<Type>::recursiveSubDivision
|
||||
{
|
||||
if
|
||||
(
|
||||
contents_[contentI]().size() > minSize_
|
||||
contents_[contentI]->size() > minSize_
|
||||
&& nLevels < maxLevels_
|
||||
)
|
||||
{
|
||||
@ -524,7 +524,7 @@ void Foam::dynamicIndexedOctree<Type>::findNearest
|
||||
{
|
||||
shapes_.findNearest
|
||||
(
|
||||
contents_[getContent(index)],
|
||||
*(contents_[getContent(index)]),
|
||||
sample,
|
||||
|
||||
nearestDistSqr,
|
||||
@ -589,7 +589,7 @@ void Foam::dynamicIndexedOctree<Type>::findNearest
|
||||
{
|
||||
shapes_.findNearest
|
||||
(
|
||||
contents_[getContent(index)],
|
||||
*(contents_[getContent(index)]),
|
||||
ln,
|
||||
|
||||
tightest,
|
||||
@ -1341,7 +1341,7 @@ void Foam::dynamicIndexedOctree<Type>::traverseNode
|
||||
|
||||
if (isContent(index))
|
||||
{
|
||||
const labelList& indices = contents_[getContent(index)];
|
||||
const labelList& indices = *(contents_[getContent(index)]);
|
||||
|
||||
if (indices.size())
|
||||
{
|
||||
@ -1755,7 +1755,7 @@ void Foam::dynamicIndexedOctree<Type>::findBox
|
||||
|
||||
if (subBb.overlaps(searchBox))
|
||||
{
|
||||
const labelList& indices = contents_[getContent(index)];
|
||||
const labelList& indices = *(contents_[getContent(index)]);
|
||||
|
||||
forAll(indices, i)
|
||||
{
|
||||
@ -1803,7 +1803,7 @@ void Foam::dynamicIndexedOctree<Type>::findSphere
|
||||
|
||||
if (subBb.overlaps(centre, radiusSqr))
|
||||
{
|
||||
const labelList& indices = contents_[getContent(index)];
|
||||
const labelList& indices = *(contents_[getContent(index)]);
|
||||
|
||||
forAll(indices, i)
|
||||
{
|
||||
@ -2016,7 +2016,7 @@ Foam::label Foam::dynamicIndexedOctree<Type>::countElements
|
||||
}
|
||||
else if (isContent(index))
|
||||
{
|
||||
nElems += contents_[getContent(index)]().size();
|
||||
nElems += contents_[getContent(index)]->size();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2302,7 +2302,7 @@ Foam::label Foam::dynamicIndexedOctree<Type>::findInside
|
||||
// Need to check for the presence of content, in-case the node is empty
|
||||
if (isContent(contentIndex))
|
||||
{
|
||||
labelList indices = contents_[getContent(contentIndex)];
|
||||
const labelList& indices = *(contents_[getContent(contentIndex)]);
|
||||
|
||||
forAll(indices, elemI)
|
||||
{
|
||||
@ -2334,12 +2334,10 @@ const Foam::labelList& Foam::dynamicIndexedOctree<Type>::findIndices
|
||||
// Need to check for the presence of content, in-case the node is empty
|
||||
if (isContent(contentIndex))
|
||||
{
|
||||
return contents_[getContent(contentIndex)];
|
||||
}
|
||||
else
|
||||
{
|
||||
return emptyList<label>();
|
||||
return *(contents_[getContent(contentIndex)]);
|
||||
}
|
||||
|
||||
return emptyList<label>();
|
||||
}
|
||||
|
||||
|
||||
@ -2454,7 +2452,7 @@ bool Foam::dynamicIndexedOctree<Type>::insert(label startIndex, label endIndex)
|
||||
)
|
||||
);
|
||||
|
||||
contents_[0]().append(0);
|
||||
contents_[0]->append(0);
|
||||
|
||||
// Create topnode.
|
||||
node topNode = divide(bb_, 0, -1, 0);
|
||||
@ -2518,7 +2516,7 @@ bool Foam::dynamicIndexedOctree<Type>::insertIndex
|
||||
{
|
||||
const label contentI = getContent(subNodeLabel);
|
||||
|
||||
contents_[contentI]().append(index);
|
||||
contents_[contentI]->append(index);
|
||||
|
||||
recursiveSubDivision
|
||||
(
|
||||
@ -2545,7 +2543,7 @@ bool Foam::dynamicIndexedOctree<Type>::insertIndex
|
||||
autoPtr<DynamicList<label>>(new DynamicList<label>(1))
|
||||
);
|
||||
|
||||
contents_[sz]().append(index);
|
||||
contents_[sz]->append(index);
|
||||
|
||||
nodes_[nodIndex].subNodes_[octant]
|
||||
= contentPlusOctant(sz, octant);
|
||||
@ -2618,7 +2616,7 @@ Foam::label Foam::dynamicIndexedOctree<Type>::removeIndex
|
||||
|
||||
if (shapes().overlaps(index, subBb))
|
||||
{
|
||||
DynamicList<label>& contentList = contents_[contentI]();
|
||||
DynamicList<label>& contentList = *(contents_[contentI]);
|
||||
|
||||
DynamicList<label> newContent(contentList.size());
|
||||
|
||||
@ -2644,7 +2642,7 @@ Foam::label Foam::dynamicIndexedOctree<Type>::removeIndex
|
||||
contentList.transfer(newContent);
|
||||
}
|
||||
|
||||
totalContents += contents_[contentI]().size();
|
||||
totalContents += contents_[contentI]->size();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2695,7 +2693,7 @@ void Foam::dynamicIndexedOctree<Type>::print
|
||||
}
|
||||
else if (isContent(index))
|
||||
{
|
||||
const labelList& indices = contents_[getContent(index)];
|
||||
const labelList& indices = *(contents_[getContent(index)]);
|
||||
|
||||
if (false) //debug)
|
||||
{
|
||||
@ -2735,7 +2733,7 @@ void Foam::dynamicIndexedOctree<Type>::writeTreeInfo() const
|
||||
label nEntries = 0;
|
||||
forAll(contents_, i)
|
||||
{
|
||||
nEntries += contents_[i]().size();
|
||||
nEntries += contents_[i]->size();
|
||||
}
|
||||
|
||||
Pout<< "indexedOctree<Type>::indexedOctree"
|
||||
|
||||
@ -50,7 +50,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
typedef DynamicList<autoPtr<DynamicList<label >>> contentListList;
|
||||
typedef DynamicList<autoPtr<DynamicList<label>>> contentListList;
|
||||
|
||||
// Forward declaration of classes
|
||||
template<class Type> class dynamicIndexedOctree;
|
||||
|
||||
@ -262,12 +262,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlock
|
||||
is.fatalCheck("read(Istream&) : reading entry");
|
||||
|
||||
string buf(data.begin(), data.size());
|
||||
realIsPtr = new IStringStream
|
||||
realIsPtr.reset
|
||||
(
|
||||
buf,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
is.name()
|
||||
new IStringStream
|
||||
(
|
||||
buf,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
is.name()
|
||||
)
|
||||
);
|
||||
|
||||
// Read header
|
||||
@ -314,12 +317,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlock
|
||||
is.fatalCheck("read(Istream&) : reading entry");
|
||||
}
|
||||
string buf(data.begin(), data.size());
|
||||
realIsPtr = new IStringStream
|
||||
realIsPtr.reset
|
||||
(
|
||||
buf,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
is.name()
|
||||
new IStringStream
|
||||
(
|
||||
buf,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
is.name()
|
||||
)
|
||||
);
|
||||
|
||||
// Apply master stream settings to realIsPtr
|
||||
@ -484,12 +490,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
||||
is.fatalCheck("read(Istream&) : reading entry");
|
||||
|
||||
string buf(data.begin(), data.size());
|
||||
realIsPtr = new IStringStream
|
||||
realIsPtr.reset
|
||||
(
|
||||
buf,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
fName
|
||||
new IStringStream
|
||||
(
|
||||
buf,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
fName
|
||||
)
|
||||
);
|
||||
|
||||
// Read header
|
||||
@ -538,12 +547,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
||||
is >> data;
|
||||
|
||||
string buf(data.begin(), data.size());
|
||||
realIsPtr = new IStringStream
|
||||
realIsPtr.reset
|
||||
(
|
||||
buf,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
fName
|
||||
new IStringStream
|
||||
(
|
||||
buf,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
fName
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -567,12 +579,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
||||
is.fatalCheck("read(Istream&) : reading entry");
|
||||
|
||||
string buf(data.begin(), data.size());
|
||||
realIsPtr = new IStringStream
|
||||
realIsPtr.reset
|
||||
(
|
||||
buf,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
fName
|
||||
new IStringStream
|
||||
(
|
||||
buf,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
fName
|
||||
)
|
||||
);
|
||||
|
||||
// Read header
|
||||
@ -611,12 +626,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
||||
is >> data;
|
||||
|
||||
string buf(data.begin(), data.size());
|
||||
realIsPtr = new IStringStream
|
||||
realIsPtr.reset
|
||||
(
|
||||
buf,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
fName
|
||||
new IStringStream
|
||||
(
|
||||
buf,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
fName
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,12 +48,6 @@ void Foam::token::parseError(const char* expected) const
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::token::compound::~compound()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::token::compound> Foam::token::compound::New
|
||||
|
||||
@ -143,9 +143,13 @@ public:
|
||||
:
|
||||
public refCount
|
||||
{
|
||||
// Private data
|
||||
bool empty_;
|
||||
|
||||
bool empty_;
|
||||
//- No default copy construct
|
||||
compound(const compound&) = delete;
|
||||
|
||||
//- No default assign operator
|
||||
compound& operator=(const compound&) = delete;
|
||||
|
||||
public:
|
||||
|
||||
@ -171,25 +175,22 @@ public:
|
||||
empty_(false)
|
||||
{}
|
||||
|
||||
//- No default copy construct
|
||||
compound(const compound&) = delete;
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Select null constructed
|
||||
static autoPtr<compound> New(const word& type, Istream& is);
|
||||
|
||||
//- Return true if name is a known (registered) compound type
|
||||
static bool isCompound(const word& name);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~compound();
|
||||
virtual ~compound() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return true if name is a known compound type
|
||||
static bool isCompound(const word& name);
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return empty_;
|
||||
@ -207,9 +208,6 @@ public:
|
||||
|
||||
// Operators
|
||||
|
||||
//- No default assign operator
|
||||
compound& operator=(const compound&) = delete;
|
||||
|
||||
//- Output operator
|
||||
friend Ostream& operator<<(Ostream& os, const compound& ct);
|
||||
};
|
||||
|
||||
@ -466,7 +466,7 @@ public:
|
||||
//- Return previous TimeState if time is being sub-cycled
|
||||
const TimeState& prevTimeState() const
|
||||
{
|
||||
return prevTimeState_();
|
||||
return *prevTimeState_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -437,7 +437,7 @@ Foam::autoPtr<Foam::entry> Foam::entry::New(Istream& is)
|
||||
{
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
|
||||
autoPtr<entry> ptr(nullptr);
|
||||
autoPtr<entry> ptr;
|
||||
|
||||
// Get the next keyword and if invalid return false
|
||||
keyType keyword;
|
||||
|
||||
@ -197,7 +197,7 @@ public:
|
||||
autoPtr<functionObject> clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<functionObject>(nullptr);
|
||||
return autoPtr<functionObject>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -483,7 +483,7 @@ Foam::IOdictionary& Foam::functionObjectList::stateDict()
|
||||
createStateDict();
|
||||
}
|
||||
|
||||
return stateDictPtr_();
|
||||
return *stateDictPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -494,7 +494,7 @@ const Foam::IOdictionary& Foam::functionObjectList::stateDict() const
|
||||
createStateDict();
|
||||
}
|
||||
|
||||
return stateDictPtr_();
|
||||
return *stateDictPtr_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ Foam::functionObjects::timeControl::writeControl() const
|
||||
inline const Foam::functionObject&
|
||||
Foam::functionObjects::timeControl::filter() const
|
||||
{
|
||||
return foPtr_();
|
||||
return *foPtr_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -214,7 +214,7 @@ Foam::OFstream& Foam::functionObjects::writeFile::file()
|
||||
<< "File pointer not allocated";
|
||||
}
|
||||
|
||||
return filePtr_();
|
||||
return *filePtr_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ Foam::Istream& Foam::regIOobject::readStream(const bool valid)
|
||||
isPtr_ = fileHandler().readStream(*this, objPath, type(), valid);
|
||||
}
|
||||
|
||||
return isPtr_();
|
||||
return *isPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ Foam::Istream& Foam::regIOobject::readStream
|
||||
}
|
||||
}
|
||||
|
||||
return isPtr_();
|
||||
return *isPtr_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -285,7 +285,7 @@ Foam::codedFixedValuePointPatchField<Type>::redirectPatchField() const
|
||||
).ptr()
|
||||
);
|
||||
}
|
||||
return redirectPatchFieldPtr_();
|
||||
return *redirectPatchFieldPtr_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ uniformFixedValuePointPatchField
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<Type>(ptf, p, iF, mapper),
|
||||
uniformValue_(ptf.uniformValue_, false)
|
||||
uniformValue_(ptf.uniformValue_.clone())
|
||||
{
|
||||
// For safety re-evaluate
|
||||
const scalar t = this->db().time().timeOutputValue();
|
||||
@ -94,7 +94,7 @@ uniformFixedValuePointPatchField
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<Type>(ptf),
|
||||
uniformValue_(ptf.uniformValue_, false)
|
||||
uniformValue_(ptf.uniformValue_.clone())
|
||||
{}
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ uniformFixedValuePointPatchField
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<Type>(ptf, iF),
|
||||
uniformValue_(ptf.uniformValue_, false)
|
||||
uniformValue_(ptf.uniformValue_.clone())
|
||||
{
|
||||
// For safety re-evaluate
|
||||
const scalar t = this->db().time().timeOutputValue();
|
||||
|
||||
@ -74,7 +74,7 @@ Foam::fileMonitor& Foam::fileOperation::monitor() const
|
||||
)
|
||||
);
|
||||
}
|
||||
return monitorPtr_();
|
||||
return *monitorPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -597,7 +597,8 @@ const Foam::fileOperation& Foam::fileHandler()
|
||||
|
||||
fileOperation::fileHandlerPtr_ = fileOperation::New(handler, true);
|
||||
}
|
||||
return fileOperation::fileHandlerPtr_();
|
||||
|
||||
return *fileOperation::fileHandlerPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -618,7 +619,7 @@ void Foam::fileHandler(autoPtr<fileOperation>& newHandlerPtr)
|
||||
|
||||
if (newHandlerPtr.valid())
|
||||
{
|
||||
fileOperation::fileHandlerPtr_ = newHandlerPtr;
|
||||
fileOperation::fileHandlerPtr_ = std::move(newHandlerPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ public:
|
||||
autoPtr<procLduInterface> clone()
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<procLduInterface>(nullptr);
|
||||
return autoPtr<procLduInterface>();
|
||||
}
|
||||
|
||||
static autoPtr<procLduInterface> New(Istream& is)
|
||||
|
||||
@ -139,7 +139,7 @@ Foam::lduMatrix::preconditioner::New
|
||||
"no diagonal or off-diagonal coefficient"
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return autoPtr<lduMatrix::preconditioner>(nullptr);
|
||||
return autoPtr<lduMatrix::preconditioner>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -143,7 +143,7 @@ Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New
|
||||
"no diagonal or off-diagonal coefficient"
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return autoPtr<lduMatrix::smoother>(nullptr);
|
||||
return autoPtr<lduMatrix::smoother>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -123,7 +123,7 @@ Foam::autoPtr<Foam::lduMatrix::solver> Foam::lduMatrix::solver::New
|
||||
"no diagonal or off-diagonal coefficient"
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return autoPtr<lduMatrix::solver>(nullptr);
|
||||
return autoPtr<lduMatrix::solver>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -252,7 +252,7 @@ Foam::GAMGAgglomeration::GAMGAgglomeration
|
||||
*this,
|
||||
controlDict
|
||||
)
|
||||
: autoPtr<GAMGProcAgglomeration>(nullptr)
|
||||
: autoPtr<GAMGProcAgglomeration>()
|
||||
),
|
||||
|
||||
nCells_(maxLevels_),
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,8 +25,15 @@ Class
|
||||
Foam::autoPtr
|
||||
|
||||
Description
|
||||
An auto-pointer similar to the STL auto_ptr but with automatic casting
|
||||
to a reference to the type and with pointer allocation checking on access.
|
||||
Pointer management similar to std::unique_ptr, with some additional
|
||||
methods and type checking.
|
||||
|
||||
Note
|
||||
Parts of the interface now mirror std::unique_ptr, but since it pre-dates
|
||||
both C++11 and std::unique_ptr, it has some additional idiosyncrasies.
|
||||
The const-reference constructors and assignment operators
|
||||
actually use move semantics to allow their participation in
|
||||
default constructible, default assignable classes.
|
||||
|
||||
SourceFiles
|
||||
autoPtrI.H
|
||||
@ -36,6 +43,13 @@ SourceFiles
|
||||
#ifndef autoPtr_H
|
||||
#define autoPtr_H
|
||||
|
||||
// Transitional features/misfeatures:
|
||||
#define Foam_autoPtr_copyConstruct
|
||||
#define Foam_autoPtr_copyAssign
|
||||
#define Foam_autoPtr_castOperator
|
||||
|
||||
#include <utility>
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -48,114 +62,217 @@ namespace Foam
|
||||
template<class T>
|
||||
class autoPtr
|
||||
{
|
||||
// Public data
|
||||
|
||||
//- Pointer to object
|
||||
mutable T* ptr_;
|
||||
//- Pointer to managed object
|
||||
T* ptr_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
typedef T Type;
|
||||
// STL type definitions
|
||||
|
||||
//- Type of object being managed
|
||||
typedef T element_type;
|
||||
|
||||
//- Pointer to type of object being managed
|
||||
typedef T* pointer;
|
||||
|
||||
|
||||
// Factory Methods
|
||||
|
||||
//- Construct autoPtr of T with forwarding arguments
|
||||
// \param args list of arguments with which an instance of T
|
||||
// will be constructed.
|
||||
//
|
||||
// \note Similar to std::make_unique, but the overload for
|
||||
// array types is not disabled.
|
||||
template<class... Args>
|
||||
inline static autoPtr<T> New(Args&&... args);
|
||||
|
||||
//- Construct autoPtr from derived type with forwarding arguments
|
||||
// \param args list of arguments with which an instance of U
|
||||
// will be constructed.
|
||||
//
|
||||
// \note Similar to New but for derived types.
|
||||
// In the future check for is_convertible on the pointer types
|
||||
template<class U, class... Args>
|
||||
inline static autoPtr<T> NewFrom(Args&&... args);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null with nullptr
|
||||
inline explicit autoPtr();
|
||||
//- Construct with no managed object.
|
||||
inline constexpr autoPtr() noexcept;
|
||||
|
||||
//- Store object pointer
|
||||
inline explicit autoPtr(T* p);
|
||||
//- Construct with no managed object (literal nullptr).
|
||||
inline constexpr autoPtr(std::nullptr_t) noexcept;
|
||||
|
||||
//- Construct as copy by transferring pointer to this autoPtr and
|
||||
//- setting the arguments pointer to nullptr
|
||||
inline autoPtr(const autoPtr<T>& ap);
|
||||
//- Construct, taking ownership of the pointer.
|
||||
inline explicit autoPtr(T* p) noexcept;
|
||||
|
||||
//- Construct either by transferring pointer or cloning.
|
||||
// Should only be called with type that supports cloning
|
||||
inline autoPtr(const autoPtr<T>& ap, const bool reuse);
|
||||
//- Move construct, transferring ownership.
|
||||
inline autoPtr(autoPtr<T>&& ap) noexcept;
|
||||
|
||||
//- Move construct, transferring ownership from derived type.
|
||||
// U must be derivable from T
|
||||
// \note In the future check for is_convertible on the pointer types
|
||||
template<class U>
|
||||
inline explicit autoPtr(autoPtr<U>&& ap);
|
||||
|
||||
//- A move construct disguised as a copy construct (transfers ownership)
|
||||
// \remark This is a non-standard definition, and should ideally be
|
||||
// marked as deleted - pending cleanup of code currently relying
|
||||
// on this behaviour.
|
||||
#ifdef Foam_autoPtr_copyConstruct
|
||||
inline autoPtr(const autoPtr<T>& ap) noexcept;
|
||||
#else
|
||||
autoPtr(const autoPtr<T>& ap) = delete;
|
||||
#endif
|
||||
|
||||
|
||||
//- Destructor, delete object if pointer is not nullptr
|
||||
inline ~autoPtr();
|
||||
//- Destructs the managed object if such is present
|
||||
inline ~autoPtr() noexcept;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Check
|
||||
// Check
|
||||
|
||||
//- Return true if the autoPtr is empty (ie, no pointer set)
|
||||
inline bool empty() const;
|
||||
//- True if the managed pointer is null
|
||||
inline bool empty() const noexcept;
|
||||
|
||||
//- Return true if the autoPtr valid (ie, the pointer is set)
|
||||
inline bool valid() const;
|
||||
//- True if the managed pointer is non-null
|
||||
inline bool valid() const noexcept;
|
||||
|
||||
|
||||
// Edit
|
||||
// Access
|
||||
|
||||
//- Release ownership of the object pointer and return the pointer
|
||||
inline T* ptr();
|
||||
//- Return pointer to managed object without nullptr checking.
|
||||
// Pointer remains under autoPtr management.
|
||||
inline T* get() noexcept;
|
||||
|
||||
//- Set pointer to that given.
|
||||
// If object pointer already set issue a FatalError
|
||||
inline void set(T* p);
|
||||
//- Return const pointer to managed object without nullptr checking.
|
||||
// Pointer remains under autoPtr management.
|
||||
inline const T* get() const noexcept;
|
||||
|
||||
//- If object pointer already set, delete object and set to given
|
||||
//- pointer
|
||||
inline void reset(T* p = nullptr);
|
||||
|
||||
//- Delete object (if the pointer is valid)
|
||||
//- and set pointer to nullptr
|
||||
inline void clear();
|
||||
//- Return reference to the managed object without nullptr checking.
|
||||
// When get() == nullptr, additional guards may be required to avoid
|
||||
// inadvertent access to a nullptr.
|
||||
inline T& ref();
|
||||
|
||||
|
||||
// Access
|
||||
// Edit
|
||||
|
||||
//- Return the pointer, without nullptr checking.
|
||||
// Pointer remains under autoPtr management.
|
||||
inline T* rawPtr();
|
||||
//- Return pointer to the managed object and release ownership.
|
||||
inline T* release() noexcept;
|
||||
|
||||
//- Const access to the pointer, without nullptr checking.
|
||||
// Pointer remains under autoPtr management.
|
||||
inline const T* rawPtr() const;
|
||||
//- Return pointer to the managed object and release ownership.
|
||||
//- Identical behaviour to release().
|
||||
// \note Provided for method naming consistent with Foam::tmp
|
||||
inline T* ptr() noexcept;
|
||||
|
||||
//- Return the reference, without nullptr checking.
|
||||
inline T& rawRef();
|
||||
//- Delete managed object and set pointer to nullptr
|
||||
inline void clear() noexcept;
|
||||
|
||||
//- Return the const reference, without nullptr checking.
|
||||
inline const T& rawRef() const;
|
||||
//- Delete managed object and set to new given pointer
|
||||
inline void reset(T* p = nullptr) noexcept;
|
||||
|
||||
//- Delete managed object and set to new given pointer
|
||||
// \remark This is a non-standard definition, but may provide better
|
||||
// code documentation than a simple move assign would.
|
||||
inline void reset(autoPtr<T>&& other) noexcept;
|
||||
|
||||
//- Delete managed object and set to new given pointer
|
||||
//- Identical behaviour to reset().
|
||||
// \note Provided for backward compatibility - the older version
|
||||
// enforced a run-time check (Fatal if pointer was already set)
|
||||
// but this was rarely used.
|
||||
inline void set(T* p) noexcept;
|
||||
|
||||
//- Swaps the managed object with other autoPtr.
|
||||
inline void swap(autoPtr<T>& other) noexcept;
|
||||
|
||||
|
||||
// Member operators
|
||||
// Other
|
||||
|
||||
//- Return reference to the object data.
|
||||
// Fatal if no pointer is allocated.
|
||||
inline T& operator()();
|
||||
//- Construct copy by invoking clone on underlying managed object
|
||||
// \param args list of arguments for clone
|
||||
template<class... Args>
|
||||
inline autoPtr<T> clone(Args&&... args) const;
|
||||
|
||||
//- Return const reference to the object data
|
||||
// Fatal if no pointer is allocated.
|
||||
inline const T& operator()() const;
|
||||
|
||||
//- Const cast to the underlying type reference
|
||||
// Fatal if no pointer is allocated.
|
||||
inline operator const T&() const;
|
||||
// Member Operators
|
||||
|
||||
//- Dereferences (non-const) pointer to the managed object
|
||||
// Fatal if no pointer is allocated.
|
||||
inline T* operator->();
|
||||
//- Return reference to the managed object.
|
||||
// Fatal error if no pointer is managed
|
||||
inline T& operator*();
|
||||
|
||||
//- Dereferences (const) pointer to the managed object
|
||||
// Fatal if no pointer is allocated.
|
||||
inline const T* operator->() const;
|
||||
//- Return const reference to the object.
|
||||
// Fatal error if no pointer is managed
|
||||
inline const T& operator*() const;
|
||||
|
||||
//- Take over the object pointer from parameter
|
||||
inline void operator=(T* p);
|
||||
//- Dereferences (non-const) pointer to the managed object
|
||||
// Fatal error if no pointer is managed
|
||||
inline T* operator->();
|
||||
|
||||
//- Take over the object pointer from parameter
|
||||
inline void operator=(const autoPtr<T>& ap);
|
||||
//- Dereferences (const) pointer to the managed object
|
||||
// Fatal error if no pointer is managed
|
||||
inline const T* operator->() const;
|
||||
|
||||
//- Return reference to the object data.
|
||||
// Fatal error if no pointer is managed
|
||||
inline T& operator()();
|
||||
|
||||
//- Return const reference to the object data
|
||||
// Fatal error if no pointer is managed
|
||||
inline const T& operator()() const;
|
||||
|
||||
//- Automatic cast conversion to the underlying type reference
|
||||
// Fatal error if no pointer is managed
|
||||
#ifdef Foam_autoPtr_castOperator
|
||||
inline operator const T&() const { return operator*(); }
|
||||
#else
|
||||
operator const T&() const = delete;
|
||||
#endif
|
||||
|
||||
|
||||
//- Transfer object ownership from parameter
|
||||
inline void operator=(autoPtr<T>&& ap) noexcept;
|
||||
|
||||
//- Transfer object ownership from parameter
|
||||
template<class U>
|
||||
inline void operator=(autoPtr<U>&& ap) noexcept;
|
||||
|
||||
#ifdef Foam_autoPtr_copyAssign
|
||||
//- A move assignment disguised as a copy assignment
|
||||
// \remark Non-standard definition - should just be movable
|
||||
inline void operator=(const autoPtr<T>& ap) noexcept;
|
||||
#else
|
||||
void operator=(const autoPtr<T>& ap) = delete;
|
||||
#endif
|
||||
|
||||
//- Allow reset via assignment from literal nullptr
|
||||
inline void operator=(std::nullptr_t) noexcept;
|
||||
|
||||
|
||||
// Housekeeping
|
||||
|
||||
//- Disallow assignment from plain pointer
|
||||
// \deprecated Convenient, but uncontrolled access (FEB-2018)
|
||||
void operator=(T* p) = delete;
|
||||
};
|
||||
|
||||
|
||||
// Global Functions
|
||||
|
||||
//- Specializes the Swap algorithm for autoPtr.
|
||||
// Swaps the pointers of lhs and rhs. Calls \c lhs.swap(rhs)
|
||||
template<class T>
|
||||
void Swap(autoPtr<T>& lhs, autoPtr<T>& rhs)
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -26,75 +26,119 @@ License
|
||||
#include "error.H"
|
||||
#include <typeinfo>
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
template<class... Args>
|
||||
inline Foam::autoPtr<T> Foam::autoPtr<T>::New(Args&&... args)
|
||||
{
|
||||
return autoPtr<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
template<class U, class... Args>
|
||||
inline Foam::autoPtr<T> Foam::autoPtr<T>::NewFrom(Args&&... args)
|
||||
{
|
||||
return autoPtr<T>(new U(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline Foam::autoPtr<T>::autoPtr()
|
||||
inline constexpr Foam::autoPtr<T>::autoPtr() noexcept
|
||||
:
|
||||
ptr_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline Foam::autoPtr<T>::autoPtr(T* p)
|
||||
inline constexpr Foam::autoPtr<T>::autoPtr(std::nullptr_t) noexcept
|
||||
:
|
||||
ptr_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline Foam::autoPtr<T>::autoPtr(T* p) noexcept
|
||||
:
|
||||
ptr_(p)
|
||||
{}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline Foam::autoPtr<T>::autoPtr(const autoPtr<T>& ap)
|
||||
inline Foam::autoPtr<T>::autoPtr(autoPtr<T>&& ap) noexcept
|
||||
:
|
||||
ptr_(ap.ptr_)
|
||||
{
|
||||
ap.ptr_ = nullptr;
|
||||
}
|
||||
ptr_(ap.release())
|
||||
{}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline Foam::autoPtr<T>::autoPtr(const autoPtr<T>& ap, const bool reuse)
|
||||
{
|
||||
if (reuse)
|
||||
{
|
||||
ptr_ = ap.ptr_;
|
||||
ap.ptr_ = nullptr;
|
||||
}
|
||||
else if (ap.valid())
|
||||
{
|
||||
ptr_ = ap().clone().ptr();
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_ = nullptr;
|
||||
}
|
||||
}
|
||||
template<class U>
|
||||
inline Foam::autoPtr<T>::autoPtr(autoPtr<U>&& ap)
|
||||
:
|
||||
ptr_(ap.release())
|
||||
{}
|
||||
|
||||
|
||||
#ifdef Foam_autoPtr_copyConstruct
|
||||
template<class T>
|
||||
inline Foam::autoPtr<T>::autoPtr(const autoPtr<T>& ap) noexcept
|
||||
:
|
||||
ptr_(const_cast<autoPtr<T>&>(ap).release())
|
||||
{}
|
||||
#endif
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline Foam::autoPtr<T>::~autoPtr()
|
||||
inline Foam::autoPtr<T>::~autoPtr() noexcept
|
||||
{
|
||||
clear();
|
||||
reset(nullptr);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::autoPtr<T>::empty() const
|
||||
inline bool Foam::autoPtr<T>::empty() const noexcept
|
||||
{
|
||||
return !ptr_;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::autoPtr<T>::valid() const
|
||||
inline bool Foam::autoPtr<T>::valid() const noexcept
|
||||
{
|
||||
return ptr_;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline T* Foam::autoPtr<T>::ptr()
|
||||
inline T* Foam::autoPtr<T>::get() noexcept
|
||||
{
|
||||
return ptr_;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const T* Foam::autoPtr<T>::get() const noexcept
|
||||
{
|
||||
return ptr_;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline T& Foam::autoPtr<T>::ref()
|
||||
{
|
||||
return *ptr_;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline T* Foam::autoPtr<T>::release() noexcept
|
||||
{
|
||||
T* p = ptr_;
|
||||
ptr_ = nullptr;
|
||||
@ -103,103 +147,82 @@ inline T* Foam::autoPtr<T>::ptr()
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::autoPtr<T>::set(T* p)
|
||||
inline T* Foam::autoPtr<T>::ptr() noexcept
|
||||
{
|
||||
if (ptr_)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "object of type " << typeid(T).name()
|
||||
<< " already allocated"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
ptr_ = p;
|
||||
return release();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::autoPtr<T>::reset(T* p)
|
||||
{
|
||||
if (ptr_)
|
||||
{
|
||||
delete ptr_;
|
||||
}
|
||||
|
||||
ptr_ = p;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::autoPtr<T>::clear()
|
||||
inline void Foam::autoPtr<T>::clear() noexcept
|
||||
{
|
||||
reset(nullptr);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline T* Foam::autoPtr<T>::rawPtr()
|
||||
inline void Foam::autoPtr<T>::reset(T* p) noexcept
|
||||
{
|
||||
return ptr_;
|
||||
if (ptr_) delete ptr_;
|
||||
ptr_ = p;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const T* Foam::autoPtr<T>::rawPtr() const
|
||||
inline void Foam::autoPtr<T>::reset(autoPtr<T>&& ap) noexcept
|
||||
{
|
||||
return ptr_;
|
||||
reset(ap.release());
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline T& Foam::autoPtr<T>::rawRef()
|
||||
inline void Foam::autoPtr<T>::set(T* p) noexcept
|
||||
{
|
||||
return *ptr_;
|
||||
reset(p);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const T& Foam::autoPtr<T>::rawRef() const
|
||||
inline void Foam::autoPtr<T>::swap(autoPtr<T>& other) noexcept
|
||||
{
|
||||
return *ptr_;
|
||||
T* p = ptr_;
|
||||
ptr_ = other.ptr_;
|
||||
other.ptr_ = p;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
template<class... Args>
|
||||
inline Foam::autoPtr<T> Foam::autoPtr<T>::clone(Args&&... args) const
|
||||
{
|
||||
if (ptr_)
|
||||
{
|
||||
return autoPtr<T>(ptr_->clone(std::forward<Args>(args)...).ptr());
|
||||
}
|
||||
|
||||
return autoPtr<T>();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline T& Foam::autoPtr<T>::operator()()
|
||||
inline T& Foam::autoPtr<T>::operator*()
|
||||
{
|
||||
if (!ptr_)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "object of type " << typeid(T).name()
|
||||
<< " is not allocated"
|
||||
<< "object of type " << typeid(T).name() << " is unallocated"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return *ptr_;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const T& Foam::autoPtr<T>::operator()() const
|
||||
inline const T& Foam::autoPtr<T>::operator*() const
|
||||
{
|
||||
if (!ptr_)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "object of type " << typeid(T).name()
|
||||
<< " is not allocated"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return *ptr_;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline Foam::autoPtr<T>::operator const T&() const
|
||||
{
|
||||
return operator()();
|
||||
return const_cast<autoPtr<T>*>(this)->operator*();
|
||||
}
|
||||
|
||||
|
||||
@ -209,11 +232,9 @@ inline T* Foam::autoPtr<T>::operator->()
|
||||
if (!ptr_)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "object of type " << typeid(T).name()
|
||||
<< " is not allocated"
|
||||
<< "object of type " << typeid(T).name() << " is unallocated"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return ptr_;
|
||||
}
|
||||
|
||||
@ -221,25 +242,59 @@ inline T* Foam::autoPtr<T>::operator->()
|
||||
template<class T>
|
||||
inline const T* Foam::autoPtr<T>::operator->() const
|
||||
{
|
||||
return const_cast<autoPtr<T>&>(*this).operator->();
|
||||
return const_cast<autoPtr<T>*>(this)->operator->();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::autoPtr<T>::operator=(T* p)
|
||||
inline T& Foam::autoPtr<T>::operator()()
|
||||
{
|
||||
reset(p);
|
||||
return operator*();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::autoPtr<T>::operator=(const autoPtr<T>& ap)
|
||||
inline const T& Foam::autoPtr<T>::operator()() const
|
||||
{
|
||||
return operator*();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::autoPtr<T>::operator=(autoPtr<T>&& ap) noexcept
|
||||
{
|
||||
if (this != &ap)
|
||||
{
|
||||
reset(const_cast<autoPtr<T>&>(ap).ptr());
|
||||
reset(ap.release());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
template<class U>
|
||||
inline void Foam::autoPtr<T>::operator=(autoPtr<U>&& ap) noexcept
|
||||
{
|
||||
if (this != &ap)
|
||||
{
|
||||
reset(ap.release());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef Foam_autoPtr_copyAssign
|
||||
template<class T>
|
||||
inline void Foam::autoPtr<T>::operator=(const autoPtr<T>& ap) noexcept
|
||||
{
|
||||
operator=(std::move(const_cast<autoPtr<T>&>(ap)));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::autoPtr<T>::operator=(std::nullptr_t) noexcept
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -1888,7 +1888,8 @@ const Foam::labelList& Foam::globalMeshData::sharedPointGlobalLabels() const
|
||||
sharedPointGlobalLabels = -1;
|
||||
}
|
||||
}
|
||||
return sharedPointGlobalLabelsPtr_();
|
||||
|
||||
return *sharedPointGlobalLabelsPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2025,7 +2026,7 @@ const Foam::labelList& Foam::globalMeshData::sharedPointLabels() const
|
||||
{
|
||||
calcSharedPoints();
|
||||
}
|
||||
return sharedPointLabelsPtr_();
|
||||
return *sharedPointLabelsPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2035,7 +2036,7 @@ const Foam::labelList& Foam::globalMeshData::sharedPointAddr() const
|
||||
{
|
||||
calcSharedPoints();
|
||||
}
|
||||
return sharedPointAddrPtr_();
|
||||
return *sharedPointAddrPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2055,7 +2056,7 @@ const Foam::labelList& Foam::globalMeshData::sharedEdgeLabels() const
|
||||
{
|
||||
calcSharedEdges();
|
||||
}
|
||||
return sharedEdgeLabelsPtr_();
|
||||
return *sharedEdgeLabelsPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2065,7 +2066,7 @@ const Foam::labelList& Foam::globalMeshData::sharedEdgeAddr() const
|
||||
{
|
||||
calcSharedEdges();
|
||||
}
|
||||
return sharedEdgeAddrPtr_();
|
||||
return *sharedEdgeAddrPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2126,7 +2127,7 @@ const Foam::indirectPrimitivePatch& Foam::globalMeshData::coupledPatch() const
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
return coupledPatchPtr_();
|
||||
return *coupledPatchPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2146,7 +2147,7 @@ const Foam::labelList& Foam::globalMeshData::coupledPatchMeshEdges() const
|
||||
)
|
||||
);
|
||||
}
|
||||
return coupledPatchMeshEdgesPtr_();
|
||||
return *coupledPatchMeshEdgesPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2165,7 +2166,7 @@ const
|
||||
em.insert(me[i], i);
|
||||
}
|
||||
}
|
||||
return coupledPatchMeshEdgeMapPtr_();
|
||||
return *coupledPatchMeshEdgeMapPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2178,7 +2179,7 @@ const Foam::globalIndex& Foam::globalMeshData::globalPointNumbering() const
|
||||
new globalIndex(coupledPatch().nPoints())
|
||||
);
|
||||
}
|
||||
return globalPointNumberingPtr_();
|
||||
return *globalPointNumberingPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2189,7 +2190,7 @@ Foam::globalMeshData::globalTransforms() const
|
||||
{
|
||||
globalTransformsPtr_.reset(new globalIndexAndTransform(mesh_));
|
||||
}
|
||||
return globalTransformsPtr_();
|
||||
return *globalTransformsPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2199,7 +2200,7 @@ const Foam::labelListList& Foam::globalMeshData::globalPointSlaves() const
|
||||
{
|
||||
calcGlobalPointSlaves();
|
||||
}
|
||||
return globalPointSlavesPtr_();
|
||||
return *globalPointSlavesPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2210,7 +2211,7 @@ const
|
||||
{
|
||||
calcGlobalPointSlaves();
|
||||
}
|
||||
return globalPointTransformedSlavesPtr_();
|
||||
return *globalPointTransformedSlavesPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2220,7 +2221,7 @@ const Foam::mapDistribute& Foam::globalMeshData::globalPointSlavesMap() const
|
||||
{
|
||||
calcGlobalPointSlaves();
|
||||
}
|
||||
return globalPointSlavesMapPtr_();
|
||||
return *globalPointSlavesMapPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2233,7 +2234,7 @@ const Foam::globalIndex& Foam::globalMeshData::globalEdgeNumbering() const
|
||||
new globalIndex(coupledPatch().nEdges())
|
||||
);
|
||||
}
|
||||
return globalEdgeNumberingPtr_();
|
||||
return *globalEdgeNumberingPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2243,7 +2244,7 @@ const Foam::labelListList& Foam::globalMeshData::globalEdgeSlaves() const
|
||||
{
|
||||
calcGlobalEdgeSlaves();
|
||||
}
|
||||
return globalEdgeSlavesPtr_();
|
||||
return *globalEdgeSlavesPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2254,7 +2255,7 @@ const
|
||||
{
|
||||
calcGlobalEdgeSlaves();
|
||||
}
|
||||
return globalEdgeTransformedSlavesPtr_();
|
||||
return *globalEdgeTransformedSlavesPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2264,7 +2265,7 @@ const Foam::PackedBoolList& Foam::globalMeshData::globalEdgeOrientation() const
|
||||
{
|
||||
calcGlobalEdgeOrientation();
|
||||
}
|
||||
return globalEdgeOrientationPtr_();
|
||||
return *globalEdgeOrientationPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2274,7 +2275,7 @@ const Foam::mapDistribute& Foam::globalMeshData::globalEdgeSlavesMap() const
|
||||
{
|
||||
calcGlobalEdgeSlaves();
|
||||
}
|
||||
return globalEdgeSlavesMapPtr_();
|
||||
return *globalEdgeSlavesMapPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2285,7 +2286,7 @@ const
|
||||
{
|
||||
calcGlobalPointBoundaryFaces();
|
||||
}
|
||||
return globalBoundaryFaceNumberingPtr_();
|
||||
return *globalBoundaryFaceNumberingPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2296,7 +2297,7 @@ const
|
||||
{
|
||||
calcGlobalPointBoundaryFaces();
|
||||
}
|
||||
return globalPointBoundaryFacesPtr_();
|
||||
return *globalPointBoundaryFacesPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2307,7 +2308,7 @@ Foam::globalMeshData::globalPointTransformedBoundaryFaces() const
|
||||
{
|
||||
calcGlobalPointBoundaryFaces();
|
||||
}
|
||||
return globalPointTransformedBoundaryFacesPtr_();
|
||||
return *globalPointTransformedBoundaryFacesPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2318,7 +2319,7 @@ const
|
||||
{
|
||||
calcGlobalPointBoundaryFaces();
|
||||
}
|
||||
return globalPointBoundaryFacesMapPtr_();
|
||||
return *globalPointBoundaryFacesMapPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2328,7 +2329,7 @@ const Foam::labelList& Foam::globalMeshData::boundaryCells() const
|
||||
{
|
||||
calcGlobalPointBoundaryCells();
|
||||
}
|
||||
return boundaryCellsPtr_();
|
||||
return *boundaryCellsPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2339,7 +2340,7 @@ const
|
||||
{
|
||||
calcGlobalPointBoundaryCells();
|
||||
}
|
||||
return globalBoundaryCellNumberingPtr_();
|
||||
return *globalBoundaryCellNumberingPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2350,7 +2351,7 @@ const
|
||||
{
|
||||
calcGlobalPointBoundaryCells();
|
||||
}
|
||||
return globalPointBoundaryCellsPtr_();
|
||||
return *globalPointBoundaryCellsPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2361,7 +2362,7 @@ Foam::globalMeshData::globalPointTransformedBoundaryCells() const
|
||||
{
|
||||
calcGlobalPointBoundaryCells();
|
||||
}
|
||||
return globalPointTransformedBoundaryCellsPtr_();
|
||||
return *globalPointTransformedBoundaryCellsPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2372,7 +2373,7 @@ const
|
||||
{
|
||||
calcGlobalPointBoundaryCells();
|
||||
}
|
||||
return globalPointBoundaryCellsMapPtr_();
|
||||
return *globalPointBoundaryCellsMapPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2382,7 +2383,7 @@ const Foam::labelListList& Foam::globalMeshData::globalCoPointSlaves() const
|
||||
{
|
||||
calcGlobalCoPointSlaves();
|
||||
}
|
||||
return globalCoPointSlavesPtr_();
|
||||
return *globalCoPointSlavesPtr_;
|
||||
}
|
||||
|
||||
|
||||
@ -2392,7 +2393,7 @@ const Foam::mapDistribute& Foam::globalMeshData::globalCoPointSlavesMap() const
|
||||
{
|
||||
calcGlobalCoPointSlaves();
|
||||
}
|
||||
return globalCoPointSlavesMapPtr_();
|
||||
return *globalCoPointSlavesMapPtr_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -347,13 +347,13 @@ public:
|
||||
//- Corresponding map
|
||||
const mapDistribute& map() const
|
||||
{
|
||||
return map_();
|
||||
return *map_;
|
||||
}
|
||||
|
||||
//- Corresponding map
|
||||
mapDistribute& map()
|
||||
{
|
||||
return map_();
|
||||
return *map_;
|
||||
}
|
||||
|
||||
//- From (mesh or patch) point to index in procPoints
|
||||
|
||||
@ -183,7 +183,7 @@ const Foam::List<Foam::labelPair>& Foam::mapDistributeBase::schedule() const
|
||||
)
|
||||
);
|
||||
}
|
||||
return schedulePtr_();
|
||||
return *schedulePtr_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user