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
|
autoPtr<PDRDragModel> drag = PDRDragModel::New
|
||||||
(
|
(
|
||||||
PDRProperties,
|
PDRProperties,
|
||||||
turbulence,
|
*turbulence,
|
||||||
rho,
|
rho,
|
||||||
U,
|
U,
|
||||||
phi
|
phi
|
||||||
@ -176,7 +176,7 @@ autoPtr<XiModel> flameWrinkling = XiModel::New
|
|||||||
(
|
(
|
||||||
PDRProperties,
|
PDRProperties,
|
||||||
thermo,
|
thermo,
|
||||||
turbulence,
|
*turbulence,
|
||||||
Su,
|
Su,
|
||||||
rho,
|
rho,
|
||||||
b,
|
b,
|
||||||
|
|||||||
@ -89,22 +89,22 @@ public:
|
|||||||
|
|
||||||
const rhoThermo& thermo1() const
|
const rhoThermo& thermo1() const
|
||||||
{
|
{
|
||||||
return thermo1_();
|
return *thermo1_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rhoThermo& thermo2() const
|
const rhoThermo& thermo2() const
|
||||||
{
|
{
|
||||||
return thermo2_();
|
return *thermo2_;
|
||||||
}
|
}
|
||||||
|
|
||||||
rhoThermo& thermo1()
|
rhoThermo& thermo1()
|
||||||
{
|
{
|
||||||
return thermo1_();
|
return *thermo1_;
|
||||||
}
|
}
|
||||||
|
|
||||||
rhoThermo& thermo2()
|
rhoThermo& thermo2()
|
||||||
{
|
{
|
||||||
return thermo2_();
|
return *thermo2_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Correct the thermodynamics of each phase
|
//- Correct the thermodynamics of each phase
|
||||||
|
|||||||
@ -81,7 +81,7 @@ Foam::phaseModel::phaseModel
|
|||||||
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
|
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return autoPtr<phaseModel>(nullptr);
|
return autoPtr<phaseModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -120,13 +120,13 @@ public:
|
|||||||
//- Return const-access to phase rhoThermo
|
//- Return const-access to phase rhoThermo
|
||||||
const rhoThermo& thermo() const
|
const rhoThermo& thermo() const
|
||||||
{
|
{
|
||||||
return thermo_();
|
return *thermo_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return access to phase rhoThermo
|
//- Return access to phase rhoThermo
|
||||||
rhoThermo& thermo()
|
rhoThermo& thermo()
|
||||||
{
|
{
|
||||||
return thermo_();
|
return *thermo_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return const-access to phase divergence
|
//- Return const-access to phase divergence
|
||||||
|
|||||||
@ -106,13 +106,13 @@ public:
|
|||||||
//- Return const-access to the mixture viscosityModel
|
//- Return const-access to the mixture viscosityModel
|
||||||
const mixtureViscosityModel& muModel() const
|
const mixtureViscosityModel& muModel() const
|
||||||
{
|
{
|
||||||
return muModel_();
|
return *muModel_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return const-access to the continuous-phase viscosityModel
|
//- Return const-access to the continuous-phase viscosityModel
|
||||||
const viscosityModel& nucModel() const
|
const viscosityModel& nucModel() const
|
||||||
{
|
{
|
||||||
return nucModel_();
|
return *nucModel_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return const-access to the dispersed-phase density
|
//- Return const-access to the dispersed-phase density
|
||||||
|
|||||||
@ -181,19 +181,19 @@ public:
|
|||||||
//- Return const-access to phase1 viscosityModel
|
//- Return const-access to phase1 viscosityModel
|
||||||
const viscosityModel& nuModel1() const
|
const viscosityModel& nuModel1() const
|
||||||
{
|
{
|
||||||
return nuModel1_();
|
return *nuModel1_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return const-access to phase2 viscosityModel
|
//- Return const-access to phase2 viscosityModel
|
||||||
const viscosityModel& nuModel2() const
|
const viscosityModel& nuModel2() const
|
||||||
{
|
{
|
||||||
return nuModel2_();
|
return *nuModel2_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return const-access to phase3 viscosityModel
|
//- Return const-access to phase3 viscosityModel
|
||||||
const viscosityModel& nuModel3() const
|
const viscosityModel& nuModel3() const
|
||||||
{
|
{
|
||||||
return nuModel3_();
|
return *nuModel3_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the dynamic laminar viscosity
|
//- Return the dynamic laminar viscosity
|
||||||
|
|||||||
@ -205,7 +205,7 @@ Foam::phaseModel::~phaseModel()
|
|||||||
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
|
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return autoPtr<phaseModel>(nullptr);
|
return autoPtr<phaseModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -190,12 +190,12 @@ public:
|
|||||||
|
|
||||||
const surfaceScalarField& phi() const
|
const surfaceScalarField& phi() const
|
||||||
{
|
{
|
||||||
return phiPtr_();
|
return *phiPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
surfaceScalarField& phi()
|
surfaceScalarField& phi()
|
||||||
{
|
{
|
||||||
return phiPtr_();
|
return *phiPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const surfaceScalarField& alphaPhi() const
|
const surfaceScalarField& alphaPhi() const
|
||||||
|
|||||||
@ -68,7 +68,7 @@ Foam::phase::phase
|
|||||||
Foam::autoPtr<Foam::phase> Foam::phase::clone() const
|
Foam::autoPtr<Foam::phase> Foam::phase::clone() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return autoPtr<phase>(nullptr);
|
return autoPtr<phase>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -120,7 +120,7 @@ public:
|
|||||||
//- Return const-access to phase1 viscosityModel
|
//- Return const-access to phase1 viscosityModel
|
||||||
const viscosityModel& nuModel() const
|
const viscosityModel& nuModel() const
|
||||||
{
|
{
|
||||||
return nuModel_();
|
return *nuModel_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the kinematic laminar viscosity
|
//- Return the kinematic laminar viscosity
|
||||||
|
|||||||
@ -59,14 +59,9 @@ HeatAndMassTransferPhaseSystem
|
|||||||
massTransferModels_
|
massTransferModels_
|
||||||
);
|
);
|
||||||
|
|
||||||
forAllConstIter
|
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||||
(
|
|
||||||
phaseSystem::phasePairTable,
|
|
||||||
this->phasePairs_,
|
|
||||||
phasePairIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const phasePair& pair(phasePairIter());
|
const phasePair& pair = *(phasePairIter.object());
|
||||||
|
|
||||||
if (pair.ordered())
|
if (pair.ordered())
|
||||||
{
|
{
|
||||||
@ -197,14 +192,9 @@ Foam::HeatAndMassTransferPhaseSystem<BasePhaseSystem>::dmdt
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
forAllConstIter
|
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||||
(
|
|
||||||
phaseSystem::phasePairTable,
|
|
||||||
this->phasePairs_,
|
|
||||||
phasePairIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const phasePair& pair(phasePairIter());
|
const phasePair& pair = *(phasePairIter.object());
|
||||||
|
|
||||||
if (pair.ordered())
|
if (pair.ordered())
|
||||||
{
|
{
|
||||||
@ -239,14 +229,9 @@ Foam::HeatAndMassTransferPhaseSystem<BasePhaseSystem>::momentumTransfer() const
|
|||||||
phaseSystem::momentumTransferTable& eqns = eqnsPtr();
|
phaseSystem::momentumTransferTable& eqns = eqnsPtr();
|
||||||
|
|
||||||
// Source term due to mass trasfer
|
// Source term due to mass trasfer
|
||||||
forAllConstIter
|
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||||
(
|
|
||||||
phaseSystem::phasePairTable,
|
|
||||||
this->phasePairs_,
|
|
||||||
phasePairIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const phasePair& pair(phasePairIter());
|
const phasePair& pair = *(phasePairIter.object());
|
||||||
|
|
||||||
if (pair.ordered())
|
if (pair.ordered())
|
||||||
{
|
{
|
||||||
@ -291,17 +276,10 @@ Foam::HeatAndMassTransferPhaseSystem<BasePhaseSystem>::heatTransfer() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Heat transfer with the interface
|
// Heat transfer with the interface
|
||||||
forAllConstIter
|
forAllConstIters(heatTransferModels_, heatTransferModelIter)
|
||||||
(
|
|
||||||
heatTransferModelTable,
|
|
||||||
heatTransferModels_,
|
|
||||||
heatTransferModelIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const phasePair& pair
|
const phasePair& pair =
|
||||||
(
|
*(this->phasePairs_[heatTransferModelIter.key()]);
|
||||||
this->phasePairs_[heatTransferModelIter.key()]
|
|
||||||
);
|
|
||||||
|
|
||||||
const phaseModel* phase = &pair.phase1();
|
const phaseModel* phase = &pair.phase1();
|
||||||
const phaseModel* otherPhase = &pair.phase2();
|
const phaseModel* otherPhase = &pair.phase2();
|
||||||
@ -344,14 +322,9 @@ Foam::HeatAndMassTransferPhaseSystem<BasePhaseSystem>::heatTransfer() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Source term due to mass transfer
|
// Source term due to mass transfer
|
||||||
forAllConstIter
|
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||||
(
|
|
||||||
phaseSystem::phasePairTable,
|
|
||||||
this->phasePairs_,
|
|
||||||
phasePairIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const phasePair& pair(phasePairIter());
|
const phasePair& pair = *(phasePairIter.object());
|
||||||
|
|
||||||
if (pair.ordered())
|
if (pair.ordered())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -128,16 +128,12 @@ Foam::HeatTransferPhaseSystem<BasePhaseSystem>::heatTransfer() const
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAllConstIter
|
forAllConstIters(heatTransferModels_, heatTransferModelIter)
|
||||||
(
|
|
||||||
heatTransferModelTable,
|
|
||||||
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* phase = &pair.phase1();
|
||||||
const phaseModel* otherPhase = &pair.phase2();
|
const phaseModel* otherPhase = &pair.phase2();
|
||||||
|
|||||||
@ -86,14 +86,9 @@ massTransfer() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset the interfacial mass flow rates
|
// Reset the interfacial mass flow rates
|
||||||
forAllConstIter
|
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||||
(
|
|
||||||
phaseSystem::phasePairTable,
|
|
||||||
this->phasePairs_,
|
|
||||||
phasePairIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const phasePair& pair(phasePairIter());
|
const phasePair& pair = *(phasePairIter.object());
|
||||||
|
|
||||||
if (pair.ordered())
|
if (pair.ordered())
|
||||||
{
|
{
|
||||||
@ -108,22 +103,18 @@ massTransfer() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sum up the contribution from each interface composition model
|
// Sum up the contribution from each interface composition model
|
||||||
forAllConstIter
|
forAllConstIters
|
||||||
(
|
(
|
||||||
interfaceCompositionModelTable,
|
|
||||||
interfaceCompositionModels_,
|
interfaceCompositionModels_,
|
||||||
interfaceCompositionModelIter
|
interfaceCompositionModelIter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const interfaceCompositionModel& compositionModel
|
const phasePair& pair =
|
||||||
(
|
*(this->phasePairs_[interfaceCompositionModelIter.key()]);
|
||||||
interfaceCompositionModelIter()
|
|
||||||
);
|
const interfaceCompositionModel& compositionModel =
|
||||||
|
*(interfaceCompositionModelIter.object());
|
||||||
|
|
||||||
const phasePair& pair
|
|
||||||
(
|
|
||||||
this->phasePairs_[interfaceCompositionModelIter.key()]
|
|
||||||
);
|
|
||||||
const phaseModel& phase = pair.phase1();
|
const phaseModel& phase = pair.phase1();
|
||||||
const phaseModel& otherPhase = pair.phase2();
|
const phaseModel& otherPhase = pair.phase2();
|
||||||
const phasePairKey key(phase.name(), otherPhase.name());
|
const phasePairKey key(phase.name(), otherPhase.name());
|
||||||
@ -209,14 +200,9 @@ correctThermo()
|
|||||||
// Yfi is likely to be a strong non-linear (typically exponential) function
|
// Yfi is likely to be a strong non-linear (typically exponential) function
|
||||||
// of Tf, so the solution for the temperature is newton-accelerated
|
// of Tf, so the solution for the temperature is newton-accelerated
|
||||||
|
|
||||||
forAllConstIter
|
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||||
(
|
|
||||||
phaseSystem::phasePairTable,
|
|
||||||
this->phasePairs_,
|
|
||||||
phasePairIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const phasePair& pair(phasePairIter());
|
const phasePair& pair = *(phasePairIter.object());
|
||||||
|
|
||||||
if (pair.ordered())
|
if (pair.ordered())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -82,14 +82,10 @@ MomentumTransferPhaseSystem
|
|||||||
turbulentDispersionModels_
|
turbulentDispersionModels_
|
||||||
);
|
);
|
||||||
|
|
||||||
forAllConstIter
|
forAllConstIters(dragModels_, dragModelIter)
|
||||||
(
|
|
||||||
dragModelTable,
|
|
||||||
dragModels_,
|
|
||||||
dragModelIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const phasePair& pair(this->phasePairs_[dragModelIter.key()]);
|
const phasePair& pair =
|
||||||
|
*(this->phasePairs_[dragModelIter.key()]);
|
||||||
|
|
||||||
Kds_.insert
|
Kds_.insert
|
||||||
(
|
(
|
||||||
@ -102,14 +98,10 @@ MomentumTransferPhaseSystem
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAllConstIter
|
forAllConstIters(virtualMassModels_, virtualMassModelIter)
|
||||||
(
|
|
||||||
virtualMassModelTable,
|
|
||||||
virtualMassModels_,
|
|
||||||
virtualMassModelIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const phasePair& pair(this->phasePairs_[virtualMassModelIter.key()]);
|
const phasePair& pair =
|
||||||
|
*(this->phasePairs_[virtualMassModelIter.key()]);
|
||||||
|
|
||||||
Vms_.insert
|
Vms_.insert
|
||||||
(
|
(
|
||||||
@ -183,16 +175,11 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::Kd
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
forAllConstIter
|
forAllConstIters(Kds_, KdIter)
|
||||||
(
|
|
||||||
phaseSystem::KdTable,
|
|
||||||
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* phase1 = &pair.phase1();
|
||||||
const phaseModel* phase2 = &pair.phase2();
|
const phaseModel* phase2 = &pair.phase2();
|
||||||
@ -430,27 +417,17 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::momentumTransfer() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the drag coefficients
|
// Update the drag coefficients
|
||||||
forAllConstIter
|
forAllConstIters(dragModels_, dragModelIter)
|
||||||
(
|
|
||||||
dragModelTable,
|
|
||||||
dragModels_,
|
|
||||||
dragModelIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
*Kds_[dragModelIter.key()] = dragModelIter()->K();
|
*Kds_[dragModelIter.key()] = dragModelIter()->K();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the implicit part of the drag force
|
// Add the implicit part of the drag force
|
||||||
forAllConstIter
|
forAllConstIters(Kds_, KdIter)
|
||||||
(
|
|
||||||
phaseSystem::KdTable,
|
|
||||||
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* phase = &pair.phase1();
|
||||||
const phaseModel* otherPhase = &pair.phase2();
|
const phaseModel* otherPhase = &pair.phase2();
|
||||||
@ -466,27 +443,17 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::momentumTransfer() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the virtual mass coefficients
|
// Update the virtual mass coefficients
|
||||||
forAllConstIter
|
forAllConstIters(virtualMassModels_, virtualMassModelIter)
|
||||||
(
|
|
||||||
virtualMassModelTable,
|
|
||||||
virtualMassModels_,
|
|
||||||
virtualMassModelIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
*Vms_[virtualMassModelIter.key()] = virtualMassModelIter()->K();
|
*Vms_[virtualMassModelIter.key()] = virtualMassModelIter()->K();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the virtual mass force
|
// Add the virtual mass force
|
||||||
forAllConstIter
|
forAllConstIters(Vms_, VmIter)
|
||||||
(
|
|
||||||
phaseSystem::VmTable,
|
|
||||||
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* phase = &pair.phase1();
|
||||||
const phaseModel* otherPhase = &pair.phase2();
|
const phaseModel* otherPhase = &pair.phase2();
|
||||||
@ -557,33 +524,22 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::Fs() const
|
|||||||
PtrList<volVectorField>& Fs = tFs();
|
PtrList<volVectorField>& Fs = tFs();
|
||||||
|
|
||||||
// Add the lift force
|
// Add the lift force
|
||||||
forAllConstIter
|
forAllConstIters(liftModels_, modelIter)
|
||||||
(
|
|
||||||
liftModelTable,
|
|
||||||
liftModels_,
|
|
||||||
liftModelIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
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.phase1().index()) += F;
|
||||||
setF(Fs, pair.phase2().index()) -= F;
|
setF(Fs, pair.phase2().index()) -= F;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the wall lubrication force
|
// Add the wall lubrication force
|
||||||
forAllConstIter
|
forAllConstIters(wallLubricationModels_, modelIter)
|
||||||
(
|
|
||||||
wallLubricationModelTable,
|
|
||||||
wallLubricationModels_,
|
|
||||||
wallLubricationModelIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const volVectorField F(wallLubricationModelIter()->F<vector>());
|
const phasePair& pair = *(this->phasePairs_[modelIter.key()]);
|
||||||
|
|
||||||
const phasePair&
|
const volVectorField F(modelIter()->template F<vector>());
|
||||||
pair(this->phasePairs_[wallLubricationModelIter.key()]);
|
|
||||||
|
|
||||||
setF(Fs, pair.phase1().index()) += F;
|
setF(Fs, pair.phase1().index()) += F;
|
||||||
setF(Fs, pair.phase2().index()) -= F;
|
setF(Fs, pair.phase2().index()) -= F;
|
||||||
@ -647,15 +603,10 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiDs
|
|||||||
PtrList<surfaceScalarField>& phiDs = tphiDs();
|
PtrList<surfaceScalarField>& phiDs = tphiDs();
|
||||||
|
|
||||||
// Add the turbulent dispersion force
|
// Add the turbulent dispersion force
|
||||||
forAllConstIter
|
forAllConstIters(turbulentDispersionModels_, turbulentDispersionModelIter)
|
||||||
(
|
|
||||||
turbulentDispersionModelTable,
|
|
||||||
turbulentDispersionModels_,
|
|
||||||
turbulentDispersionModelIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const phasePair&
|
const phasePair& pair =
|
||||||
pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
|
*(this->phasePairs_[turbulentDispersionModelIter.key()]);
|
||||||
|
|
||||||
const volScalarField D(turbulentDispersionModelIter()->D());
|
const volScalarField D(turbulentDispersionModelIter()->D());
|
||||||
const surfaceScalarField snGradAlpha1
|
const surfaceScalarField snGradAlpha1
|
||||||
|
|||||||
@ -42,14 +42,9 @@ ThermalPhaseChangePhaseSystem
|
|||||||
massTransfer_(this->lookup("massTransfer"))
|
massTransfer_(this->lookup("massTransfer"))
|
||||||
{
|
{
|
||||||
|
|
||||||
forAllConstIter
|
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||||
(
|
|
||||||
phaseSystem::phasePairTable,
|
|
||||||
this->phasePairs_,
|
|
||||||
phasePairIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const phasePair& pair(phasePairIter());
|
const phasePair& pair = *(phasePairIter.object());
|
||||||
|
|
||||||
if (pair.ordered())
|
if (pair.ordered())
|
||||||
{
|
{
|
||||||
@ -92,7 +87,7 @@ template<class BasePhaseSystem>
|
|||||||
const Foam::saturationModel&
|
const Foam::saturationModel&
|
||||||
Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::saturation() const
|
Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::saturation() const
|
||||||
{
|
{
|
||||||
return saturationModel_();
|
return *saturationModel_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -109,14 +104,9 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::heatTransfer() const
|
|||||||
phaseSystem::heatTransferTable& eqns = eqnsPtr();
|
phaseSystem::heatTransferTable& eqns = eqnsPtr();
|
||||||
|
|
||||||
// Accumulate mDotL contributions from boundaries
|
// Accumulate mDotL contributions from boundaries
|
||||||
forAllConstIter
|
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||||
(
|
|
||||||
phaseSystem::phasePairTable,
|
|
||||||
this->phasePairs_,
|
|
||||||
phasePairIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const phasePair& pair(phasePairIter());
|
const phasePair& pair = *(phasePairIter.object());
|
||||||
|
|
||||||
if (pair.ordered())
|
if (pair.ordered())
|
||||||
{
|
{
|
||||||
@ -219,19 +209,15 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::massTransfer() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forAllConstIter
|
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||||
(
|
|
||||||
phaseSystem::phasePairTable,
|
|
||||||
this->phasePairs_,
|
|
||||||
phasePairIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const phasePair& pair(phasePairIter());
|
const phasePair& pair = *(phasePairIter.object());
|
||||||
|
|
||||||
if (pair.ordered())
|
if (pair.ordered())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const phaseModel& phase = pair.phase1();
|
const phaseModel& phase = pair.phase1();
|
||||||
const phaseModel& otherPhase = pair.phase2();
|
const phaseModel& otherPhase = pair.phase2();
|
||||||
|
|
||||||
@ -292,14 +278,9 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::iDmdt
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
forAllConstIter
|
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||||
(
|
|
||||||
phaseSystem::phasePairTable,
|
|
||||||
this->phasePairs_,
|
|
||||||
phasePairIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const phasePair& pair(phasePairIter());
|
const phasePair& pair = *(phasePairIter.object());
|
||||||
|
|
||||||
if (pair.ordered())
|
if (pair.ordered())
|
||||||
{
|
{
|
||||||
@ -332,14 +313,9 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
|
|||||||
|
|
||||||
BasePhaseSystem::correctThermo();
|
BasePhaseSystem::correctThermo();
|
||||||
|
|
||||||
forAllConstIter
|
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||||
(
|
|
||||||
phaseSystem::phasePairTable,
|
|
||||||
this->phasePairs_,
|
|
||||||
phasePairIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const phasePair& pair(phasePairIter());
|
const phasePair& pair = *(phasePairIter.object());
|
||||||
|
|
||||||
if (pair.ordered())
|
if (pair.ordered())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -401,7 +401,7 @@ template<class BasePhaseModel>
|
|||||||
const Foam::phaseCompressibleTurbulenceModel&
|
const Foam::phaseCompressibleTurbulenceModel&
|
||||||
Foam::MovingPhaseModel<BasePhaseModel>::turbulence() const
|
Foam::MovingPhaseModel<BasePhaseModel>::turbulence() const
|
||||||
{
|
{
|
||||||
return turbulence_;
|
return *turbulence_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ Foam::phaseModel::phaseModel
|
|||||||
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
|
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return autoPtr<phaseModel>(nullptr);
|
return autoPtr<phaseModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -48,8 +48,8 @@ void Foam::phaseSystem::createSubModels
|
|||||||
key,
|
key,
|
||||||
modelType::New
|
modelType::New
|
||||||
(
|
(
|
||||||
*iter,
|
iter.object(),
|
||||||
phasePairs_[key]
|
phasePairs_[key]()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -98,11 +98,11 @@ void Foam::phaseSystem::generatePairsAndSubModels
|
|||||||
const blendingMethod& blending
|
const blendingMethod& blending
|
||||||
(
|
(
|
||||||
blendingMethods_.found(modelName)
|
blendingMethods_.found(modelName)
|
||||||
? blendingMethods_[modelName]
|
? *(blendingMethods_[modelName])
|
||||||
: blendingMethods_["default"]
|
: *(blendingMethods_["default"])
|
||||||
);
|
);
|
||||||
|
|
||||||
autoPtr<modelType> noModel(nullptr);
|
autoPtr<modelType> noModel;
|
||||||
|
|
||||||
forAllConstIter(typename modelTypeTable, tempModels, iter)
|
forAllConstIter(typename modelTypeTable, tempModels, iter)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -217,16 +217,11 @@ while (pimple.correct())
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
forAllConstIter
|
forAllConstIters(fluid.Kds(), KdIter)
|
||||||
(
|
|
||||||
phaseSystem::KdTable,
|
|
||||||
fluid.Kds(),
|
|
||||||
KdIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const volScalarField& K(*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* phase1 = &pair.phase1();
|
||||||
const phaseModel* phase2 = &pair.phase2();
|
const phaseModel* phase2 = &pair.phase2();
|
||||||
|
|||||||
@ -115,7 +115,7 @@ public:
|
|||||||
autoPtr<IATEsource> clone() const
|
autoPtr<IATEsource> clone() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return autoPtr<IATEsource>(nullptr);
|
return autoPtr<IATEsource>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -451,9 +451,11 @@ bool Foam::BlendedInterfacialModel<modelType>::hasModel
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
&phase == &(pair_.phase1())
|
(
|
||||||
|
&phase == &(pair_.phase1())
|
||||||
? model1In2_.valid()
|
? model1In2_.valid()
|
||||||
: model2In1_.valid();
|
: model2In1_.valid()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -463,7 +465,7 @@ const modelType& Foam::BlendedInterfacialModel<modelType>::phaseModel
|
|||||||
const class phaseModel& phase
|
const class phaseModel& phase
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return &phase == &(pair_.phase1()) ? model1In2_ : model2In1_;
|
return &phase == &(pair_.phase1()) ? *model1In2_ : *model2In1_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -114,7 +114,7 @@ public:
|
|||||||
autoPtr<IATEsource> clone() const
|
autoPtr<IATEsource> clone() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
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::PhaseCompressibleTurbulenceModel<Foam::phaseModel>&
|
||||||
Foam::phaseModel::turbulence()
|
Foam::phaseModel::turbulence()
|
||||||
{
|
{
|
||||||
return turbulence_();
|
return *turbulence_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::PhaseCompressibleTurbulenceModel<Foam::phaseModel>&
|
const Foam::PhaseCompressibleTurbulenceModel<Foam::phaseModel>&
|
||||||
Foam::phaseModel::turbulence() const
|
Foam::phaseModel::turbulence() const
|
||||||
{
|
{
|
||||||
return turbulence_();
|
return *turbulence_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -162,14 +162,14 @@ public:
|
|||||||
//- Return the thermophysical model
|
//- Return the thermophysical model
|
||||||
const rhoThermo& thermo() const
|
const rhoThermo& thermo() const
|
||||||
{
|
{
|
||||||
return thermo_();
|
return *thermo_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return non-const access to the thermophysical model
|
//- Return non-const access to the thermophysical model
|
||||||
// for correction
|
// for correction
|
||||||
rhoThermo& thermo()
|
rhoThermo& thermo()
|
||||||
{
|
{
|
||||||
return thermo_();
|
return *thermo_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the laminar viscosity
|
//- Return the laminar viscosity
|
||||||
@ -286,13 +286,13 @@ public:
|
|||||||
//- Return the volumetric flux
|
//- Return the volumetric flux
|
||||||
const surfaceScalarField& phi() const
|
const surfaceScalarField& phi() const
|
||||||
{
|
{
|
||||||
return phiPtr_();
|
return *phiPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return non-const access to the volumetric flux
|
//- Return non-const access to the volumetric flux
|
||||||
surfaceScalarField& phi()
|
surfaceScalarField& phi()
|
||||||
{
|
{
|
||||||
return phiPtr_();
|
return *phiPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the volumetric flux of the phase
|
//- Return the volumetric flux of the phase
|
||||||
|
|||||||
@ -177,12 +177,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
lookup("drag"),
|
lookup("drag"),
|
||||||
(
|
(
|
||||||
blendingMethods_.found("drag")
|
blendingMethods_.found("drag")
|
||||||
? blendingMethods_["drag"]
|
? *(blendingMethods_["drag"])
|
||||||
: blendingMethods_["default"]
|
: *(blendingMethods_["default"])
|
||||||
),
|
),
|
||||||
pair_,
|
*pair_,
|
||||||
pair1In2_,
|
*pair1In2_,
|
||||||
pair2In1_,
|
*pair2In1_,
|
||||||
false // Do not zero drag coefficent at fixed-flux BCs
|
false // Do not zero drag coefficent at fixed-flux BCs
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -194,12 +194,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
lookup("virtualMass"),
|
lookup("virtualMass"),
|
||||||
(
|
(
|
||||||
blendingMethods_.found("virtualMass")
|
blendingMethods_.found("virtualMass")
|
||||||
? blendingMethods_["virtualMass"]
|
? *(blendingMethods_["virtualMass"])
|
||||||
: blendingMethods_["default"]
|
: *(blendingMethods_["default"])
|
||||||
),
|
),
|
||||||
pair_,
|
*pair_,
|
||||||
pair1In2_,
|
*pair1In2_,
|
||||||
pair2In1_
|
*pair2In1_
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -210,12 +210,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
lookup("heatTransfer"),
|
lookup("heatTransfer"),
|
||||||
(
|
(
|
||||||
blendingMethods_.found("heatTransfer")
|
blendingMethods_.found("heatTransfer")
|
||||||
? blendingMethods_["heatTransfer"]
|
? *(blendingMethods_["heatTransfer"])
|
||||||
: blendingMethods_["default"]
|
: *(blendingMethods_["default"])
|
||||||
),
|
),
|
||||||
pair_,
|
*pair_,
|
||||||
pair1In2_,
|
*pair1In2_,
|
||||||
pair2In1_
|
*pair2In1_
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -226,12 +226,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
lookup("lift"),
|
lookup("lift"),
|
||||||
(
|
(
|
||||||
blendingMethods_.found("lift")
|
blendingMethods_.found("lift")
|
||||||
? blendingMethods_["lift"]
|
? *(blendingMethods_["lift"])
|
||||||
: blendingMethods_["default"]
|
: *(blendingMethods_["default"])
|
||||||
),
|
),
|
||||||
pair_,
|
*pair_,
|
||||||
pair1In2_,
|
*pair1In2_,
|
||||||
pair2In1_
|
*pair2In1_
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -242,12 +242,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
lookup("wallLubrication"),
|
lookup("wallLubrication"),
|
||||||
(
|
(
|
||||||
blendingMethods_.found("wallLubrication")
|
blendingMethods_.found("wallLubrication")
|
||||||
? blendingMethods_["wallLubrication"]
|
? *(blendingMethods_["wallLubrication"])
|
||||||
: blendingMethods_["default"]
|
: *(blendingMethods_["default"])
|
||||||
),
|
),
|
||||||
pair_,
|
*pair_,
|
||||||
pair1In2_,
|
*pair1In2_,
|
||||||
pair2In1_
|
*pair2In1_
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -258,12 +258,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
lookup("turbulentDispersion"),
|
lookup("turbulentDispersion"),
|
||||||
(
|
(
|
||||||
blendingMethods_.found("turbulentDispersion")
|
blendingMethods_.found("turbulentDispersion")
|
||||||
? blendingMethods_["turbulentDispersion"]
|
? *(blendingMethods_["turbulentDispersion"])
|
||||||
: blendingMethods_["default"]
|
: *(blendingMethods_["default"])
|
||||||
),
|
),
|
||||||
pair_,
|
*pair_,
|
||||||
pair1In2_,
|
*pair1In2_,
|
||||||
pair2In1_
|
*pair2In1_
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::twoPhaseSystem::~twoPhaseSystem()
|
Foam::twoPhaseSystem::~twoPhaseSystem()
|
||||||
{}
|
{} // Define here (incomplete type in header)
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -16,7 +16,7 @@ volVectorField D
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
autoPtr<volScalarField> Tptr(nullptr);
|
autoPtr<volScalarField> Tptr;
|
||||||
|
|
||||||
if (thermalStress)
|
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);
|
autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh(mesh, inflate);
|
||||||
|
|
||||||
Info<< "Mapping fields" << nl << endl;
|
Info<< "Mapping fields" << nl << endl;
|
||||||
mesh.updateMesh(morphMap);
|
mesh.updateMesh(morphMap());
|
||||||
|
|
||||||
// Move mesh (since morphing does not do this)
|
// Move mesh (since morphing does not do this)
|
||||||
if (morphMap().hasMotionPoints())
|
if (morphMap().hasMotionPoints())
|
||||||
@ -212,7 +212,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update numbering of cells/vertices.
|
// Update numbering of cells/vertices.
|
||||||
faceRemover.updateMesh(morphMap);
|
faceRemover.updateMesh(morphMap());
|
||||||
|
|
||||||
|
|
||||||
Info<< "Writing fields" << nl << endl;
|
Info<< "Writing fields" << nl << endl;
|
||||||
|
|||||||
@ -276,7 +276,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
Info<< nl << "-- mapping mesh data" << endl;
|
Info<< nl << "-- mapping mesh data" << endl;
|
||||||
mesh.updateMesh(map);
|
mesh.updateMesh(map());
|
||||||
|
|
||||||
// Inflate mesh
|
// Inflate mesh
|
||||||
if (map().hasMotionPoints())
|
if (map().hasMotionPoints())
|
||||||
@ -287,7 +287,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Update numbering of cells/vertices.
|
// Update numbering of cells/vertices.
|
||||||
Info<< nl << "-- mapping hexRef8 data" << endl;
|
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).
|
// 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
|
// Update fields
|
||||||
subsetter.subMesh().updateMesh(map);
|
subsetter.subMesh().updateMesh(map);
|
||||||
@ -1231,9 +1233,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
// Move mesh (since morphing might not do this)
|
// 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()
|
Info<< "Writing mesh with split blockedFaces to time " << runTime.value()
|
||||||
|
|||||||
@ -186,7 +186,7 @@ int main(int argc, char *argv[])
|
|||||||
polyMeshFilter::copySets(newMesh(), mesh);
|
polyMeshFilter::copySets(newMesh(), mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointPriority = meshFilter.pointPriority();
|
pointPriority = *(meshFilter.pointPriority());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (collapseFaceSet)
|
if (collapseFaceSet)
|
||||||
@ -203,14 +203,14 @@ int main(int argc, char *argv[])
|
|||||||
// from the previous edge filtering to use as a stopping criterion.
|
// from the previous edge filtering to use as a stopping criterion.
|
||||||
meshFilter.filter(indirectPatchFaces);
|
meshFilter.filter(indirectPatchFaces);
|
||||||
{
|
{
|
||||||
polyTopoChange meshMod(newMesh);
|
polyTopoChange meshMod(newMesh());
|
||||||
|
|
||||||
meshMod.changeMesh(mesh, false);
|
meshMod.changeMesh(mesh, false);
|
||||||
|
|
||||||
polyMeshFilter::copySets(newMesh(), mesh);
|
polyMeshFilter::copySets(newMesh(), mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointPriority = meshFilter.pointPriority();
|
pointPriority = *(meshFilter.pointPriority());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (collapseFaces)
|
if (collapseFaces)
|
||||||
@ -227,14 +227,14 @@ int main(int argc, char *argv[])
|
|||||||
// from the previous edge filtering to use as a stopping criterion.
|
// from the previous edge filtering to use as a stopping criterion.
|
||||||
meshFilter.filter(nBadFaces);
|
meshFilter.filter(nBadFaces);
|
||||||
{
|
{
|
||||||
polyTopoChange meshMod(newMesh);
|
polyTopoChange meshMod(newMesh());
|
||||||
|
|
||||||
meshMod.changeMesh(mesh, false);
|
meshMod.changeMesh(mesh, false);
|
||||||
|
|
||||||
polyMeshFilter::copySets(newMesh(), mesh);
|
polyMeshFilter::copySets(newMesh(), mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointPriority = meshFilter.pointPriority();
|
pointPriority = *(meshFilter.pointPriority());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write resulting mesh
|
// Write resulting mesh
|
||||||
|
|||||||
@ -113,7 +113,7 @@ label mergePatchFaces
|
|||||||
map = meshMod.changeMesh(mesh, false, true);
|
map = meshMod.changeMesh(mesh, false, true);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh.updateMesh(map);
|
mesh.updateMesh(map());
|
||||||
|
|
||||||
// Move mesh (since morphing does not do this)
|
// Move mesh (since morphing does not do this)
|
||||||
if (map().hasMotionPoints())
|
if (map().hasMotionPoints())
|
||||||
@ -269,7 +269,7 @@ label mergePatchFaces
|
|||||||
map = meshMod.changeMesh(mesh, false, true);
|
map = meshMod.changeMesh(mesh, false, true);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh.updateMesh(map);
|
mesh.updateMesh(map());
|
||||||
|
|
||||||
// Move mesh (since morphing does not do this)
|
// Move mesh (since morphing does not do this)
|
||||||
if (map().hasMotionPoints())
|
if (map().hasMotionPoints())
|
||||||
@ -322,7 +322,7 @@ label mergeEdges(const scalar minCos, polyMesh& mesh)
|
|||||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false, true);
|
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false, true);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh.updateMesh(map);
|
mesh.updateMesh(map());
|
||||||
|
|
||||||
// Move mesh (since morphing does not do this)
|
// Move mesh (since morphing does not do this)
|
||||||
if (map().hasMotionPoints())
|
if (map().hasMotionPoints())
|
||||||
|
|||||||
@ -174,10 +174,10 @@ int main(int argc, char *argv[])
|
|||||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh.updateMesh(map);
|
mesh.updateMesh(map());
|
||||||
|
|
||||||
// Update numbering of cells/vertices.
|
// Update numbering of cells/vertices.
|
||||||
meshCutter.updateMesh(map);
|
meshCutter.updateMesh(map());
|
||||||
|
|
||||||
// Optionally inflate mesh
|
// Optionally inflate mesh
|
||||||
if (map().hasMotionPoints())
|
if (map().hasMotionPoints())
|
||||||
|
|||||||
@ -155,18 +155,18 @@ int main(int argc, char *argv[])
|
|||||||
meshMod
|
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)
|
// 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.
|
// Update numbering of cells/vertices.
|
||||||
faceRemover.updateMesh(morphMap);
|
faceRemover.updateMesh(map());
|
||||||
|
|
||||||
if (!overwrite)
|
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)
|
if (useSurface)
|
||||||
{
|
{
|
||||||
surf.reset(new triSurface(surfName));
|
triSurface surf(surfName);
|
||||||
|
|
||||||
// Dump some stats
|
// Dump some stats
|
||||||
surf().writeStats(Info);
|
surf.writeStats(Info);
|
||||||
|
|
||||||
// Search engine on surface.
|
triSurfaceSearch querySurf(surf);
|
||||||
querySurf.reset(new triSurfaceSearch(surf));
|
|
||||||
|
|
||||||
// Set cellType[celli] according to relation to surface
|
// Set cellType[celli] according to relation to surface
|
||||||
cutBySurface
|
cutBySurface
|
||||||
|
|||||||
@ -266,7 +266,7 @@ int main(int argc, char *argv[])
|
|||||||
Info<< nl << "Bounding box size: " << mesh().bounds().span() << nl;
|
Info<< nl << "Bounding box size: " << mesh().bounds().span() << nl;
|
||||||
|
|
||||||
// check number of regions
|
// check number of regions
|
||||||
regionSplit rs(mesh);
|
regionSplit rs(mesh());
|
||||||
|
|
||||||
Info<< "Number of regions: " << rs.nRegions();
|
Info<< "Number of regions: " << rs.nRegions();
|
||||||
if (rs.nRegions() == 1)
|
if (rs.nRegions() == 1)
|
||||||
@ -281,7 +281,7 @@ int main(int argc, char *argv[])
|
|||||||
<< "**************************************************" << nl;
|
<< "**************************************************" << nl;
|
||||||
}
|
}
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
reader.writeMesh(mesh, format);
|
reader.writeMesh(mesh(), format);
|
||||||
|
|
||||||
// exportName only has a size when export is in effect
|
// exportName only has a size when export is in effect
|
||||||
if (exportName.size())
|
if (exportName.size())
|
||||||
|
|||||||
@ -119,7 +119,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
autoPtr<polyMesh> mesh = reader.mesh(runTime);
|
autoPtr<polyMesh> mesh = reader.mesh(runTime);
|
||||||
reader.writeMesh(mesh, format);
|
reader.writeMesh(mesh(), format);
|
||||||
|
|
||||||
|
|
||||||
Info<< "\nEnd\n" << endl;
|
Info<< "\nEnd\n" << endl;
|
||||||
|
|||||||
@ -338,7 +338,7 @@ int main(int argc, char *argv[])
|
|||||||
wordList(0)
|
wordList(0)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const polyMesh& mesh = meshPtr;
|
const polyMesh& mesh = *meshPtr;
|
||||||
|
|
||||||
|
|
||||||
if (readFaceFile)
|
if (readFaceFile)
|
||||||
|
|||||||
@ -433,7 +433,7 @@ int main(int argc, char *argv[])
|
|||||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh.updateMesh(map);
|
mesh.updateMesh(map());
|
||||||
|
|
||||||
// Move mesh (since morphing does not do this)
|
// Move mesh (since morphing does not do this)
|
||||||
if (map().hasMotionPoints())
|
if (map().hasMotionPoints())
|
||||||
@ -788,7 +788,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
layerExtrude.addedCells
|
layerExtrude.addedCells
|
||||||
(
|
(
|
||||||
meshFromMesh,
|
*meshFromMesh,
|
||||||
layerExtrude.layerFaces()
|
layerExtrude.layerFaces()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -937,7 +937,7 @@ int main(int argc, char *argv[])
|
|||||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh.updateMesh(map);
|
mesh.updateMesh(map());
|
||||||
|
|
||||||
// Update stored data
|
// Update stored data
|
||||||
updateFaceLabels(map(), frontPatchFaces);
|
updateFaceLabels(map(), frontPatchFaces);
|
||||||
@ -1074,7 +1074,7 @@ int main(int argc, char *argv[])
|
|||||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh.updateMesh(map);
|
mesh.updateMesh(map());
|
||||||
|
|
||||||
// Update local data
|
// Update local data
|
||||||
updateCellSet(map(), addedCellsSet);
|
updateCellSet(map(), addedCellsSet);
|
||||||
|
|||||||
@ -2470,7 +2470,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
// Update numbering on extruder.
|
// Update numbering on extruder.
|
||||||
extruder.updateMesh(shellMap);
|
extruder.updateMesh(shellMap());
|
||||||
|
|
||||||
|
|
||||||
// Calculate offsets from shell mesh back to original mesh
|
// Calculate offsets from shell mesh back to original mesh
|
||||||
@ -2818,7 +2818,7 @@ int main(int argc, char *argv[])
|
|||||||
addBafflesMap = meshMod.changeMesh(mesh, false);
|
addBafflesMap = meshMod.changeMesh(mesh, false);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh.updateMesh(addBafflesMap);
|
mesh.updateMesh(addBafflesMap());
|
||||||
|
|
||||||
|
|
||||||
//XXXXXX
|
//XXXXXX
|
||||||
|
|||||||
@ -251,7 +251,7 @@ int main(int argc, char *argv[])
|
|||||||
// Create a mesh from topo changes.
|
// Create a mesh from topo changes.
|
||||||
autoPtr<mapPolyMesh> morphMap = meshMod().changeMesh(mesh(), false);
|
autoPtr<mapPolyMesh> morphMap = meshMod().changeMesh(mesh(), false);
|
||||||
|
|
||||||
mesh().updateMesh(morphMap);
|
mesh().updateMesh(morphMap());
|
||||||
|
|
||||||
{
|
{
|
||||||
edgeCollapser collapser(mesh());
|
edgeCollapser collapser(mesh());
|
||||||
@ -302,7 +302,7 @@ int main(int argc, char *argv[])
|
|||||||
autoPtr<mapPolyMesh> morphMap
|
autoPtr<mapPolyMesh> morphMap
|
||||||
= meshModCollapse.changeMesh(mesh(), false);
|
= meshModCollapse.changeMesh(mesh(), false);
|
||||||
|
|
||||||
mesh().updateMesh(morphMap);
|
mesh().updateMesh(morphMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!overwrite)
|
if (!overwrite)
|
||||||
|
|||||||
@ -142,13 +142,6 @@ Foam::DistributedDelaunayMesh<Triangulation>::DistributedDelaunayMesh
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Triangulation>
|
|
||||||
Foam::DistributedDelaunayMesh<Triangulation>::~DistributedDelaunayMesh()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Triangulation>
|
template<class Triangulation>
|
||||||
@ -491,7 +484,8 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices
|
|||||||
|
|
||||||
const label preDistributionSize = parallelVertices.size();
|
const label preDistributionSize = parallelVertices.size();
|
||||||
|
|
||||||
mapDistribute pointMap = buildMap(targetProcessor);
|
autoPtr<mapDistribute> pointMapPtr = buildMap(targetProcessor);
|
||||||
|
mapDistribute& pointMap = *pointMapPtr;
|
||||||
|
|
||||||
// Make a copy of the original list.
|
// Make a copy of the original list.
|
||||||
DynamicList<Vb> originalParallelVertices(parallelVertices);
|
DynamicList<Vb> originalParallelVertices(parallelVertices);
|
||||||
|
|||||||
@ -141,7 +141,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~DistributedDelaunayMesh();
|
~DistributedDelaunayMesh() = default;
|
||||||
|
|
||||||
|
|
||||||
// Queries
|
// Queries
|
||||||
|
|||||||
@ -248,10 +248,10 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh_.updateMesh(map);
|
mesh_.updateMesh(map());
|
||||||
|
|
||||||
// Update numbering of cells/vertices.
|
// Update numbering of cells/vertices.
|
||||||
meshCutter_.updateMesh(map);
|
meshCutter_.updateMesh(map());
|
||||||
|
|
||||||
{
|
{
|
||||||
// Map volumeStatus
|
// Map volumeStatus
|
||||||
@ -357,11 +357,11 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh_.updateMesh(map);
|
mesh_.updateMesh(map());
|
||||||
|
|
||||||
// Update numbering of cells/vertices.
|
// Update numbering of cells/vertices.
|
||||||
meshCutter_.updateMesh(map);
|
meshCutter_.updateMesh(map());
|
||||||
cellRemover.updateMesh(map);
|
cellRemover.updateMesh(map());
|
||||||
|
|
||||||
{
|
{
|
||||||
// Map volumeStatus
|
// Map volumeStatus
|
||||||
@ -416,7 +416,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
|||||||
newDecomp
|
newDecomp
|
||||||
);
|
);
|
||||||
|
|
||||||
meshCutter_.distribute(mapDist);
|
meshCutter_.distribute(mapDist());
|
||||||
|
|
||||||
mapDist().distributeCellData(volumeStatus);
|
mapDist().distributeCellData(volumeStatus);
|
||||||
|
|
||||||
@ -840,12 +840,6 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::backgroundMeshDecomposition::~backgroundMeshDecomposition()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::autoPtr<Foam::mapDistributePolyMesh>
|
Foam::autoPtr<Foam::mapDistributePolyMesh>
|
||||||
@ -954,10 +948,10 @@ Foam::backgroundMeshDecomposition::distribute
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh_.updateMesh(map);
|
mesh_.updateMesh(map());
|
||||||
|
|
||||||
// Update numbering of cells/vertices.
|
// Update numbering of cells/vertices.
|
||||||
meshCutter_.updateMesh(map);
|
meshCutter_.updateMesh(map());
|
||||||
|
|
||||||
Info<< " Background mesh refined from "
|
Info<< " Background mesh refined from "
|
||||||
<< returnReduce(map().nOldCells(), sumOp<label>())
|
<< returnReduce(map().nOldCells(), sumOp<label>())
|
||||||
@ -1000,7 +994,7 @@ Foam::backgroundMeshDecomposition::distribute
|
|||||||
|
|
||||||
autoPtr<mapDistributePolyMesh> mapDist = distributor.distribute(newDecomp);
|
autoPtr<mapDistributePolyMesh> mapDist = distributor.distribute(newDecomp);
|
||||||
|
|
||||||
meshCutter_.distribute(mapDist);
|
meshCutter_.distribute(mapDist());
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -204,7 +204,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~backgroundMeshDecomposition();
|
~backgroundMeshDecomposition() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|||||||
@ -34,7 +34,7 @@ const Foam::fvMesh& Foam::backgroundMeshDecomposition::mesh() const
|
|||||||
const Foam::indexedOctree<Foam::treeDataBPatch>&
|
const Foam::indexedOctree<Foam::treeDataBPatch>&
|
||||||
Foam::backgroundMeshDecomposition::tree() const
|
Foam::backgroundMeshDecomposition::tree() const
|
||||||
{
|
{
|
||||||
return bFTreePtr_();
|
return *bFTreePtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -509,7 +509,7 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh()
|
|||||||
if (!distributeBackground(cellSizeMesh))
|
if (!distributeBackground(cellSizeMesh))
|
||||||
{
|
{
|
||||||
// Synchronise the cell size mesh if it has not been distributed
|
// 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())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
cellSizeMesh.distribute(decomposition_);
|
cellSizeMesh.distribute(decomposition_());
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< " Iteration " << i
|
Info<< " Iteration " << i
|
||||||
@ -549,7 +549,7 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh()
|
|||||||
// Need to distribute the cell size mesh to cover the background mesh
|
// Need to distribute the cell size mesh to cover the background mesh
|
||||||
if (!distributeBackground(cellSizeMesh))
|
if (!distributeBackground(cellSizeMesh))
|
||||||
{
|
{
|
||||||
cellSizeMesh.distribute(decomposition_);
|
cellSizeMesh.distribute(decomposition_());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -563,7 +563,7 @@ Foam::conformalVoronoiMesh::decomposition() const
|
|||||||
<< exit(FatalError) << endl;
|
<< exit(FatalError) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return decomposition_();
|
return *decomposition_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -132,7 +132,7 @@ bool Foam::conformalVoronoiMesh::distributeBackground(const Triangulation& mesh)
|
|||||||
cellWeights
|
cellWeights
|
||||||
);
|
);
|
||||||
|
|
||||||
cellShapeControl_.shapeControlMesh().distribute(decomposition_);
|
cellShapeControl_.shapeControlMesh().distribute(decomposition_());
|
||||||
|
|
||||||
distribute();
|
distribute();
|
||||||
|
|
||||||
|
|||||||
@ -113,10 +113,4 @@ Foam::autoPtr<Foam::initialPointsMethod> Foam::initialPointsMethod::New
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::initialPointsMethod::~initialPointsMethod()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -156,7 +156,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~initialPointsMethod();
|
virtual ~initialPointsMethod() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -185,7 +185,7 @@ public:
|
|||||||
|
|
||||||
const backgroundMeshDecomposition& decomposition() const
|
const backgroundMeshDecomposition& decomposition() const
|
||||||
{
|
{
|
||||||
return decomposition_;
|
return *decomposition_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Const access to the details dictionary
|
//- Const access to the details dictionary
|
||||||
|
|||||||
@ -101,7 +101,7 @@ public:
|
|||||||
virtual autoPtr<searchableSurfaceFeatures> clone() const
|
virtual autoPtr<searchableSurfaceFeatures> clone() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
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);
|
autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh(pMesh, false);
|
||||||
|
|
||||||
pMesh.updateMesh(morphMap);
|
pMesh.updateMesh(morphMap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -544,7 +544,7 @@ Foam::label Foam::checkGeometry
|
|||||||
nonAlignedPoints.write();
|
nonAlignedPoints.write();
|
||||||
if (setWriter.valid())
|
if (setWriter.valid())
|
||||||
{
|
{
|
||||||
mergeAndWrite(setWriter, nonAlignedPoints);
|
mergeAndWrite(setWriter(), nonAlignedPoints);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -786,7 +786,7 @@ Foam::label Foam::checkGeometry
|
|||||||
points.write();
|
points.write();
|
||||||
if (setWriter.valid())
|
if (setWriter.valid())
|
||||||
{
|
{
|
||||||
mergeAndWrite(setWriter, points);
|
mergeAndWrite(setWriter(), points);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -809,7 +809,7 @@ Foam::label Foam::checkGeometry
|
|||||||
nearPoints.write();
|
nearPoints.write();
|
||||||
if (setWriter.valid())
|
if (setWriter.valid())
|
||||||
{
|
{
|
||||||
mergeAndWrite(setWriter, nearPoints);
|
mergeAndWrite(setWriter(), nearPoints);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -225,7 +225,7 @@ Foam::label Foam::checkTopology
|
|||||||
points.write();
|
points.write();
|
||||||
if (setWriter.valid())
|
if (setWriter.valid())
|
||||||
{
|
{
|
||||||
mergeAndWrite(setWriter, points);
|
mergeAndWrite(setWriter(), points);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -528,7 +528,7 @@ Foam::label Foam::checkTopology
|
|||||||
points.write();
|
points.write();
|
||||||
if (setWriter.valid())
|
if (setWriter.valid())
|
||||||
{
|
{
|
||||||
mergeAndWrite(setWriter, points);
|
mergeAndWrite(setWriter(), points);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -639,7 +639,7 @@ Foam::label Foam::checkTopology
|
|||||||
points.write();
|
points.write();
|
||||||
if (setWriter.valid())
|
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);
|
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh.updateMesh(map);
|
mesh.updateMesh(map());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Correct boundary faces mapped-out-of-nothing.
|
// Correct boundary faces mapped-out-of-nothing.
|
||||||
// This is just a hack to correct the value field.
|
// This is just a hack to correct the value field.
|
||||||
{
|
{
|
||||||
fvMeshMapper mapper(mesh, map);
|
fvMeshMapper mapper(mesh, map());
|
||||||
bool hasWarned = false;
|
bool hasWarned = false;
|
||||||
|
|
||||||
forAllConstIter(wordHashSet, bafflePatches, iter)
|
forAllConstIter(wordHashSet, bafflePatches, iter)
|
||||||
|
|||||||
@ -109,7 +109,7 @@ public:
|
|||||||
autoPtr<faceSelection> clone() const
|
autoPtr<faceSelection> clone() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return autoPtr<faceSelection>(nullptr);
|
return autoPtr<faceSelection>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -86,7 +86,7 @@ public:
|
|||||||
autoPtr<faceSelection> clone() const
|
autoPtr<faceSelection> clone() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return autoPtr<faceSelection>(nullptr);
|
return autoPtr<faceSelection>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,7 @@ public:
|
|||||||
autoPtr<faceSelection> clone() const
|
autoPtr<faceSelection> clone() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
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);
|
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh.updateMesh(map);
|
mesh.updateMesh(map());
|
||||||
|
|
||||||
// Move mesh (since morphing does not do this)
|
// Move mesh (since morphing does not do this)
|
||||||
if (map().hasMotionPoints())
|
if (map().hasMotionPoints())
|
||||||
@ -520,7 +520,7 @@ int main(int argc, char *argv[])
|
|||||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh.updateMesh(map);
|
mesh.updateMesh(map());
|
||||||
|
|
||||||
// Move mesh (since morphing does not do this)
|
// Move mesh (since morphing does not do this)
|
||||||
if (map().hasMotionPoints())
|
if (map().hasMotionPoints())
|
||||||
|
|||||||
@ -531,7 +531,7 @@ int main(int argc, char *argv[])
|
|||||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh.updateMesh(map);
|
mesh.updateMesh(map());
|
||||||
|
|
||||||
// Optionally inflate mesh
|
// Optionally inflate mesh
|
||||||
if (map().hasMotionPoints())
|
if (map().hasMotionPoints())
|
||||||
|
|||||||
@ -1089,7 +1089,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
mesh.updateMesh(map);
|
mesh.updateMesh(map());
|
||||||
|
|
||||||
// Update proc maps
|
// Update proc maps
|
||||||
if (cellProcAddressing.headerOk())
|
if (cellProcAddressing.headerOk())
|
||||||
|
|||||||
@ -472,7 +472,7 @@ bool doCommand
|
|||||||
setSource().applyToSet(topoSetSource::NEW, currentSet);
|
setSource().applyToSet(topoSetSource::NEW, currentSet);
|
||||||
|
|
||||||
// Combine new value of currentSet with old one.
|
// Combine new value of currentSet with old one.
|
||||||
currentSet.subset(oldSet);
|
currentSet.subset(oldSet());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -814,7 +814,7 @@ int main(int argc, char *argv[])
|
|||||||
// Main command read & execute loop
|
// Main command read & execute loop
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
autoPtr<IFstream> fileStreamPtr(nullptr);
|
autoPtr<IFstream> fileStreamPtr;
|
||||||
|
|
||||||
if (batch)
|
if (batch)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -257,7 +257,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints
|
|||||||
|
|
||||||
if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0)
|
if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0)
|
||||||
{
|
{
|
||||||
return autoPtr<mapPolyMesh>(nullptr);
|
return autoPtr<mapPolyMesh>();
|
||||||
}
|
}
|
||||||
|
|
||||||
polyTopoChange meshMod(mesh);
|
polyTopoChange meshMod(mesh);
|
||||||
@ -268,7 +268,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints
|
|||||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false, true);
|
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false, true);
|
||||||
|
|
||||||
// Update fields. No inflation, parallel sync.
|
// Update fields. No inflation, parallel sync.
|
||||||
mesh.updateMesh(map);
|
mesh.updateMesh(map());
|
||||||
|
|
||||||
// pointProcAddressing give indices into the master mesh so adapt them
|
// pointProcAddressing give indices into the master mesh so adapt them
|
||||||
// for changed point numbering.
|
// for changed point numbering.
|
||||||
@ -699,7 +699,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
masterMesh[proci],
|
masterMesh[proci],
|
||||||
meshToAdd,
|
meshToAdd,
|
||||||
couples
|
couples()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Added processor
|
// Added processor
|
||||||
@ -738,7 +738,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
masterMesh[proci],
|
masterMesh[proci],
|
||||||
masterMesh[next],
|
masterMesh[next],
|
||||||
couples
|
couples()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Processors that were already in masterMesh
|
// Processors that were already in masterMesh
|
||||||
|
|||||||
@ -1810,18 +1810,20 @@ void reconstructLagrangian
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
const parLagrangianRedistributor& lagrangianReconstructor =
|
const parLagrangianRedistributor& lagrangianReconstructor =
|
||||||
lagrangianReconstructorPtr();
|
*lagrangianReconstructorPtr;
|
||||||
|
|
||||||
for (const word& cloudName : cloudNames)
|
for (const word& cloudName : cloudNames)
|
||||||
{
|
{
|
||||||
Info<< "Reconstructing lagrangian fields for cloud "
|
Info<< "Reconstructing lagrangian fields for cloud "
|
||||||
<< cloudName << nl << endl;
|
<< cloudName << nl << endl;
|
||||||
|
|
||||||
autoPtr<mapDistributeBase> lagrangianMap =
|
autoPtr<mapDistributeBase> lagrangianMapPtr =
|
||||||
lagrangianReconstructor.redistributeLagrangianPositions
|
lagrangianReconstructor.redistributeLagrangianPositions
|
||||||
(
|
(
|
||||||
cloudName
|
cloudName
|
||||||
);
|
);
|
||||||
|
const mapDistributeBase& lagrangianMap = *lagrangianMapPtr;
|
||||||
|
|
||||||
IOobjectList sprayObjs
|
IOobjectList sprayObjs
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
@ -2129,8 +2131,9 @@ void redistributeLagrangian
|
|||||||
|
|
||||||
forAll(clouds, i)
|
forAll(clouds, i)
|
||||||
{
|
{
|
||||||
autoPtr<mapDistributeBase> lagrangianMap =
|
autoPtr<mapDistributeBase> lagrangianMapPtr =
|
||||||
distributor.redistributeLagrangianPositions(clouds[i]);
|
distributor.redistributeLagrangianPositions(clouds[i]);
|
||||||
|
const mapDistributeBase& lagrangianMap = *lagrangianMapPtr;
|
||||||
|
|
||||||
distributor.redistributeStoredLagrangianFields
|
distributor.redistributeStoredLagrangianFields
|
||||||
<IOField<label>>
|
<IOField<label>>
|
||||||
@ -2694,7 +2697,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
baseMeshPtr(),
|
baseMeshPtr(),
|
||||||
mesh,
|
mesh,
|
||||||
distMap,
|
distMap(),
|
||||||
Pstream::master() // do I need to write?
|
Pstream::master() // do I need to write?
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -2778,7 +2781,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
baseMeshPtr(),
|
baseMeshPtr(),
|
||||||
mesh,
|
mesh,
|
||||||
distMap,
|
distMap(),
|
||||||
Pstream::master()
|
Pstream::master()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -2804,7 +2807,7 @@ int main(int argc, char *argv[])
|
|||||||
lagrangianReconstructorPtr,
|
lagrangianReconstructorPtr,
|
||||||
baseMeshPtr(),
|
baseMeshPtr(),
|
||||||
mesh,
|
mesh,
|
||||||
distMap,
|
distMap(),
|
||||||
selectedLagrangianFields
|
selectedLagrangianFields
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -3012,7 +3015,7 @@ int main(int argc, char *argv[])
|
|||||||
lagrangianReconstructorPtr,
|
lagrangianReconstructorPtr,
|
||||||
mesh,
|
mesh,
|
||||||
nOldCells,
|
nOldCells,
|
||||||
distMap,
|
distMap(),
|
||||||
clouds
|
clouds
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -142,7 +142,7 @@ bool Foam::ensightCloud::writeCloudField
|
|||||||
IOField<Type> field(fieldObject);
|
IOField<Type> field(fieldObject);
|
||||||
fieldObject.readOpt() = rOpt;
|
fieldObject.readOpt() = rOpt;
|
||||||
|
|
||||||
writeCloudField(field, output.rawRef());
|
writeCloudField(field, output.ref());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -83,7 +83,7 @@ bool Foam::ensightSerialCloud::writeCloudField
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
IOField<Type> field(fieldObject);
|
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)
|
if (!optNoMesh)
|
||||||
{
|
{
|
||||||
autoPtr<ensightGeoFile> os = ensCase.newGeometry(meshMoving);
|
autoPtr<ensightGeoFile> os = ensCase.newGeometry(meshMoving);
|
||||||
partsList.write(os.rawRef());
|
partsList.write(os.ref());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -127,7 +127,7 @@ public:
|
|||||||
|
|
||||||
inline vtk::formatter& format()
|
inline vtk::formatter& format()
|
||||||
{
|
{
|
||||||
return format_();
|
return *format_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline label nParcels() const
|
inline label nParcels() const
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
const scalar xMin = p->minValue();
|
const scalar xMin = p->minValue();
|
||||||
const scalar xMax = p->maxValue();
|
const scalar xMax = p->maxValue();
|
||||||
|
|
||||||
autoPtr<OFstream> filePtr(nullptr);
|
autoPtr<OFstream> filePtr;
|
||||||
if (writeData)
|
if (writeData)
|
||||||
{
|
{
|
||||||
fileName fName = pdfPath/(p->type() + ".data");
|
fileName fName = pdfPath/(p->type() + ".data");
|
||||||
|
|||||||
@ -76,7 +76,7 @@ public:
|
|||||||
autoPtr<searchableSurfaceModifier> clone() const
|
autoPtr<searchableSurfaceModifier> clone() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return autoPtr<searchableSurfaceModifier>(nullptr);
|
return autoPtr<searchableSurfaceModifier>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -100,7 +100,7 @@ public:
|
|||||||
autoPtr<searchableSurfaceModifier> clone() const
|
autoPtr<searchableSurfaceModifier> clone() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return autoPtr<searchableSurfaceModifier>(nullptr);
|
return autoPtr<searchableSurfaceModifier>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -96,7 +96,7 @@ public:
|
|||||||
autoPtr<searchableSurfaceModifier> clone() const
|
autoPtr<searchableSurfaceModifier> clone() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return autoPtr<searchableSurfaceModifier>(nullptr);
|
return autoPtr<searchableSurfaceModifier>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -220,7 +220,7 @@ Foam::dynamicIndexedOctree<Type>::divide
|
|||||||
{
|
{
|
||||||
if (!replaced)
|
if (!replaced)
|
||||||
{
|
{
|
||||||
contents_[contentI]().transfer(subIndices());
|
contents_[contentI]->transfer(subIndices());
|
||||||
nod.subNodes_[octant] = contentPlusOctant(contentI, octant);
|
nod.subNodes_[octant] = contentPlusOctant(contentI, octant);
|
||||||
|
|
||||||
replaced = true;
|
replaced = true;
|
||||||
@ -239,7 +239,7 @@ Foam::dynamicIndexedOctree<Type>::divide
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
contents_[sz]().transfer(subIndices());
|
contents_[sz]->transfer(subIndices());
|
||||||
|
|
||||||
nod.subNodes_[octant] = contentPlusOctant(sz, octant);
|
nod.subNodes_[octant] = contentPlusOctant(sz, octant);
|
||||||
}
|
}
|
||||||
@ -280,7 +280,7 @@ void Foam::dynamicIndexedOctree<Type>::recursiveSubDivision
|
|||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
contents_[contentI]().size() > minSize_
|
contents_[contentI]->size() > minSize_
|
||||||
&& nLevels < maxLevels_
|
&& nLevels < maxLevels_
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -524,7 +524,7 @@ void Foam::dynamicIndexedOctree<Type>::findNearest
|
|||||||
{
|
{
|
||||||
shapes_.findNearest
|
shapes_.findNearest
|
||||||
(
|
(
|
||||||
contents_[getContent(index)],
|
*(contents_[getContent(index)]),
|
||||||
sample,
|
sample,
|
||||||
|
|
||||||
nearestDistSqr,
|
nearestDistSqr,
|
||||||
@ -589,7 +589,7 @@ void Foam::dynamicIndexedOctree<Type>::findNearest
|
|||||||
{
|
{
|
||||||
shapes_.findNearest
|
shapes_.findNearest
|
||||||
(
|
(
|
||||||
contents_[getContent(index)],
|
*(contents_[getContent(index)]),
|
||||||
ln,
|
ln,
|
||||||
|
|
||||||
tightest,
|
tightest,
|
||||||
@ -1341,7 +1341,7 @@ void Foam::dynamicIndexedOctree<Type>::traverseNode
|
|||||||
|
|
||||||
if (isContent(index))
|
if (isContent(index))
|
||||||
{
|
{
|
||||||
const labelList& indices = contents_[getContent(index)];
|
const labelList& indices = *(contents_[getContent(index)]);
|
||||||
|
|
||||||
if (indices.size())
|
if (indices.size())
|
||||||
{
|
{
|
||||||
@ -1755,7 +1755,7 @@ void Foam::dynamicIndexedOctree<Type>::findBox
|
|||||||
|
|
||||||
if (subBb.overlaps(searchBox))
|
if (subBb.overlaps(searchBox))
|
||||||
{
|
{
|
||||||
const labelList& indices = contents_[getContent(index)];
|
const labelList& indices = *(contents_[getContent(index)]);
|
||||||
|
|
||||||
forAll(indices, i)
|
forAll(indices, i)
|
||||||
{
|
{
|
||||||
@ -1803,7 +1803,7 @@ void Foam::dynamicIndexedOctree<Type>::findSphere
|
|||||||
|
|
||||||
if (subBb.overlaps(centre, radiusSqr))
|
if (subBb.overlaps(centre, radiusSqr))
|
||||||
{
|
{
|
||||||
const labelList& indices = contents_[getContent(index)];
|
const labelList& indices = *(contents_[getContent(index)]);
|
||||||
|
|
||||||
forAll(indices, i)
|
forAll(indices, i)
|
||||||
{
|
{
|
||||||
@ -2016,7 +2016,7 @@ Foam::label Foam::dynamicIndexedOctree<Type>::countElements
|
|||||||
}
|
}
|
||||||
else if (isContent(index))
|
else if (isContent(index))
|
||||||
{
|
{
|
||||||
nElems += contents_[getContent(index)]().size();
|
nElems += contents_[getContent(index)]->size();
|
||||||
}
|
}
|
||||||
else
|
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
|
// Need to check for the presence of content, in-case the node is empty
|
||||||
if (isContent(contentIndex))
|
if (isContent(contentIndex))
|
||||||
{
|
{
|
||||||
labelList indices = contents_[getContent(contentIndex)];
|
const labelList& indices = *(contents_[getContent(contentIndex)]);
|
||||||
|
|
||||||
forAll(indices, elemI)
|
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
|
// Need to check for the presence of content, in-case the node is empty
|
||||||
if (isContent(contentIndex))
|
if (isContent(contentIndex))
|
||||||
{
|
{
|
||||||
return contents_[getContent(contentIndex)];
|
return *(contents_[getContent(contentIndex)]);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return emptyList<label>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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.
|
// Create topnode.
|
||||||
node topNode = divide(bb_, 0, -1, 0);
|
node topNode = divide(bb_, 0, -1, 0);
|
||||||
@ -2518,7 +2516,7 @@ bool Foam::dynamicIndexedOctree<Type>::insertIndex
|
|||||||
{
|
{
|
||||||
const label contentI = getContent(subNodeLabel);
|
const label contentI = getContent(subNodeLabel);
|
||||||
|
|
||||||
contents_[contentI]().append(index);
|
contents_[contentI]->append(index);
|
||||||
|
|
||||||
recursiveSubDivision
|
recursiveSubDivision
|
||||||
(
|
(
|
||||||
@ -2545,7 +2543,7 @@ bool Foam::dynamicIndexedOctree<Type>::insertIndex
|
|||||||
autoPtr<DynamicList<label>>(new DynamicList<label>(1))
|
autoPtr<DynamicList<label>>(new DynamicList<label>(1))
|
||||||
);
|
);
|
||||||
|
|
||||||
contents_[sz]().append(index);
|
contents_[sz]->append(index);
|
||||||
|
|
||||||
nodes_[nodIndex].subNodes_[octant]
|
nodes_[nodIndex].subNodes_[octant]
|
||||||
= contentPlusOctant(sz, octant);
|
= contentPlusOctant(sz, octant);
|
||||||
@ -2618,7 +2616,7 @@ Foam::label Foam::dynamicIndexedOctree<Type>::removeIndex
|
|||||||
|
|
||||||
if (shapes().overlaps(index, subBb))
|
if (shapes().overlaps(index, subBb))
|
||||||
{
|
{
|
||||||
DynamicList<label>& contentList = contents_[contentI]();
|
DynamicList<label>& contentList = *(contents_[contentI]);
|
||||||
|
|
||||||
DynamicList<label> newContent(contentList.size());
|
DynamicList<label> newContent(contentList.size());
|
||||||
|
|
||||||
@ -2644,7 +2642,7 @@ Foam::label Foam::dynamicIndexedOctree<Type>::removeIndex
|
|||||||
contentList.transfer(newContent);
|
contentList.transfer(newContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
totalContents += contents_[contentI]().size();
|
totalContents += contents_[contentI]->size();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2695,7 +2693,7 @@ void Foam::dynamicIndexedOctree<Type>::print
|
|||||||
}
|
}
|
||||||
else if (isContent(index))
|
else if (isContent(index))
|
||||||
{
|
{
|
||||||
const labelList& indices = contents_[getContent(index)];
|
const labelList& indices = *(contents_[getContent(index)]);
|
||||||
|
|
||||||
if (false) //debug)
|
if (false) //debug)
|
||||||
{
|
{
|
||||||
@ -2735,7 +2733,7 @@ void Foam::dynamicIndexedOctree<Type>::writeTreeInfo() const
|
|||||||
label nEntries = 0;
|
label nEntries = 0;
|
||||||
forAll(contents_, i)
|
forAll(contents_, i)
|
||||||
{
|
{
|
||||||
nEntries += contents_[i]().size();
|
nEntries += contents_[i]->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
Pout<< "indexedOctree<Type>::indexedOctree"
|
Pout<< "indexedOctree<Type>::indexedOctree"
|
||||||
|
|||||||
@ -50,7 +50,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef DynamicList<autoPtr<DynamicList<label >>> contentListList;
|
typedef DynamicList<autoPtr<DynamicList<label>>> contentListList;
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
template<class Type> class dynamicIndexedOctree;
|
template<class Type> class dynamicIndexedOctree;
|
||||||
|
|||||||
@ -262,12 +262,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlock
|
|||||||
is.fatalCheck("read(Istream&) : reading entry");
|
is.fatalCheck("read(Istream&) : reading entry");
|
||||||
|
|
||||||
string buf(data.begin(), data.size());
|
string buf(data.begin(), data.size());
|
||||||
realIsPtr = new IStringStream
|
realIsPtr.reset
|
||||||
(
|
(
|
||||||
buf,
|
new IStringStream
|
||||||
IOstream::ASCII,
|
(
|
||||||
IOstream::currentVersion,
|
buf,
|
||||||
is.name()
|
IOstream::ASCII,
|
||||||
|
IOstream::currentVersion,
|
||||||
|
is.name()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Read header
|
// Read header
|
||||||
@ -314,12 +317,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlock
|
|||||||
is.fatalCheck("read(Istream&) : reading entry");
|
is.fatalCheck("read(Istream&) : reading entry");
|
||||||
}
|
}
|
||||||
string buf(data.begin(), data.size());
|
string buf(data.begin(), data.size());
|
||||||
realIsPtr = new IStringStream
|
realIsPtr.reset
|
||||||
(
|
(
|
||||||
buf,
|
new IStringStream
|
||||||
IOstream::ASCII,
|
(
|
||||||
IOstream::currentVersion,
|
buf,
|
||||||
is.name()
|
IOstream::ASCII,
|
||||||
|
IOstream::currentVersion,
|
||||||
|
is.name()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Apply master stream settings to realIsPtr
|
// Apply master stream settings to realIsPtr
|
||||||
@ -484,12 +490,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
|||||||
is.fatalCheck("read(Istream&) : reading entry");
|
is.fatalCheck("read(Istream&) : reading entry");
|
||||||
|
|
||||||
string buf(data.begin(), data.size());
|
string buf(data.begin(), data.size());
|
||||||
realIsPtr = new IStringStream
|
realIsPtr.reset
|
||||||
(
|
(
|
||||||
buf,
|
new IStringStream
|
||||||
IOstream::ASCII,
|
(
|
||||||
IOstream::currentVersion,
|
buf,
|
||||||
fName
|
IOstream::ASCII,
|
||||||
|
IOstream::currentVersion,
|
||||||
|
fName
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Read header
|
// Read header
|
||||||
@ -538,12 +547,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
|||||||
is >> data;
|
is >> data;
|
||||||
|
|
||||||
string buf(data.begin(), data.size());
|
string buf(data.begin(), data.size());
|
||||||
realIsPtr = new IStringStream
|
realIsPtr.reset
|
||||||
(
|
(
|
||||||
buf,
|
new IStringStream
|
||||||
IOstream::ASCII,
|
(
|
||||||
IOstream::currentVersion,
|
buf,
|
||||||
fName
|
IOstream::ASCII,
|
||||||
|
IOstream::currentVersion,
|
||||||
|
fName
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -567,12 +579,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
|||||||
is.fatalCheck("read(Istream&) : reading entry");
|
is.fatalCheck("read(Istream&) : reading entry");
|
||||||
|
|
||||||
string buf(data.begin(), data.size());
|
string buf(data.begin(), data.size());
|
||||||
realIsPtr = new IStringStream
|
realIsPtr.reset
|
||||||
(
|
(
|
||||||
buf,
|
new IStringStream
|
||||||
IOstream::ASCII,
|
(
|
||||||
IOstream::currentVersion,
|
buf,
|
||||||
fName
|
IOstream::ASCII,
|
||||||
|
IOstream::currentVersion,
|
||||||
|
fName
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Read header
|
// Read header
|
||||||
@ -611,12 +626,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
|||||||
is >> data;
|
is >> data;
|
||||||
|
|
||||||
string buf(data.begin(), data.size());
|
string buf(data.begin(), data.size());
|
||||||
realIsPtr = new IStringStream
|
realIsPtr.reset
|
||||||
(
|
(
|
||||||
buf,
|
new IStringStream
|
||||||
IOstream::ASCII,
|
(
|
||||||
IOstream::currentVersion,
|
buf,
|
||||||
fName
|
IOstream::ASCII,
|
||||||
|
IOstream::currentVersion,
|
||||||
|
fName
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,12 +48,6 @@ void Foam::token::parseError(const char* expected) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::token::compound::~compound()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::autoPtr<Foam::token::compound> Foam::token::compound::New
|
Foam::autoPtr<Foam::token::compound> Foam::token::compound::New
|
||||||
|
|||||||
@ -143,9 +143,13 @@ public:
|
|||||||
:
|
:
|
||||||
public refCount
|
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:
|
public:
|
||||||
|
|
||||||
@ -171,25 +175,22 @@ public:
|
|||||||
empty_(false)
|
empty_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//- No default copy construct
|
|
||||||
compound(const compound&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
// Selectors
|
// Selectors
|
||||||
|
|
||||||
//- Select null constructed
|
//- Select null constructed
|
||||||
static autoPtr<compound> New(const word& type, Istream& is);
|
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
|
//- Destructor
|
||||||
virtual ~compound();
|
virtual ~compound() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return true if name is a known compound type
|
|
||||||
static bool isCompound(const word& name);
|
|
||||||
|
|
||||||
bool empty() const
|
bool empty() const
|
||||||
{
|
{
|
||||||
return empty_;
|
return empty_;
|
||||||
@ -207,9 +208,6 @@ public:
|
|||||||
|
|
||||||
// Operators
|
// Operators
|
||||||
|
|
||||||
//- No default assign operator
|
|
||||||
compound& operator=(const compound&) = delete;
|
|
||||||
|
|
||||||
//- Output operator
|
//- Output operator
|
||||||
friend Ostream& operator<<(Ostream& os, const compound& ct);
|
friend Ostream& operator<<(Ostream& os, const compound& ct);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -466,7 +466,7 @@ public:
|
|||||||
//- Return previous TimeState if time is being sub-cycled
|
//- Return previous TimeState if time is being sub-cycled
|
||||||
const TimeState& prevTimeState() const
|
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);
|
is.fatalCheck(FUNCTION_NAME);
|
||||||
|
|
||||||
autoPtr<entry> ptr(nullptr);
|
autoPtr<entry> ptr;
|
||||||
|
|
||||||
// Get the next keyword and if invalid return false
|
// Get the next keyword and if invalid return false
|
||||||
keyType keyword;
|
keyType keyword;
|
||||||
|
|||||||
@ -197,7 +197,7 @@ public:
|
|||||||
autoPtr<functionObject> clone() const
|
autoPtr<functionObject> clone() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return autoPtr<functionObject>(nullptr);
|
return autoPtr<functionObject>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -483,7 +483,7 @@ Foam::IOdictionary& Foam::functionObjectList::stateDict()
|
|||||||
createStateDict();
|
createStateDict();
|
||||||
}
|
}
|
||||||
|
|
||||||
return stateDictPtr_();
|
return *stateDictPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -494,7 +494,7 @@ const Foam::IOdictionary& Foam::functionObjectList::stateDict() const
|
|||||||
createStateDict();
|
createStateDict();
|
||||||
}
|
}
|
||||||
|
|
||||||
return stateDictPtr_();
|
return *stateDictPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,7 @@ Foam::functionObjects::timeControl::writeControl() const
|
|||||||
inline const Foam::functionObject&
|
inline const Foam::functionObject&
|
||||||
Foam::functionObjects::timeControl::filter() const
|
Foam::functionObjects::timeControl::filter() const
|
||||||
{
|
{
|
||||||
return foPtr_();
|
return *foPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -214,7 +214,7 @@ Foam::OFstream& Foam::functionObjects::writeFile::file()
|
|||||||
<< "File pointer not allocated";
|
<< "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);
|
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()
|
).ptr()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return redirectPatchFieldPtr_();
|
return *redirectPatchFieldPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -78,7 +78,7 @@ uniformFixedValuePointPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValuePointPatchField<Type>(ptf, p, iF, mapper),
|
fixedValuePointPatchField<Type>(ptf, p, iF, mapper),
|
||||||
uniformValue_(ptf.uniformValue_, false)
|
uniformValue_(ptf.uniformValue_.clone())
|
||||||
{
|
{
|
||||||
// For safety re-evaluate
|
// For safety re-evaluate
|
||||||
const scalar t = this->db().time().timeOutputValue();
|
const scalar t = this->db().time().timeOutputValue();
|
||||||
@ -94,7 +94,7 @@ uniformFixedValuePointPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValuePointPatchField<Type>(ptf),
|
fixedValuePointPatchField<Type>(ptf),
|
||||||
uniformValue_(ptf.uniformValue_, false)
|
uniformValue_(ptf.uniformValue_.clone())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ uniformFixedValuePointPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValuePointPatchField<Type>(ptf, iF),
|
fixedValuePointPatchField<Type>(ptf, iF),
|
||||||
uniformValue_(ptf.uniformValue_, false)
|
uniformValue_(ptf.uniformValue_.clone())
|
||||||
{
|
{
|
||||||
// For safety re-evaluate
|
// For safety re-evaluate
|
||||||
const scalar t = this->db().time().timeOutputValue();
|
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);
|
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())
|
if (newHandlerPtr.valid())
|
||||||
{
|
{
|
||||||
fileOperation::fileHandlerPtr_ = newHandlerPtr;
|
fileOperation::fileHandlerPtr_ = std::move(newHandlerPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -93,7 +93,7 @@ public:
|
|||||||
autoPtr<procLduInterface> clone()
|
autoPtr<procLduInterface> clone()
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return autoPtr<procLduInterface>(nullptr);
|
return autoPtr<procLduInterface>();
|
||||||
}
|
}
|
||||||
|
|
||||||
static autoPtr<procLduInterface> New(Istream& is)
|
static autoPtr<procLduInterface> New(Istream& is)
|
||||||
|
|||||||
@ -139,7 +139,7 @@ Foam::lduMatrix::preconditioner::New
|
|||||||
"no diagonal or off-diagonal coefficient"
|
"no diagonal or off-diagonal coefficient"
|
||||||
<< exit(FatalIOError);
|
<< 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"
|
"no diagonal or off-diagonal coefficient"
|
||||||
<< exit(FatalIOError);
|
<< 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"
|
"no diagonal or off-diagonal coefficient"
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
|
|
||||||
return autoPtr<lduMatrix::solver>(nullptr);
|
return autoPtr<lduMatrix::solver>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -252,7 +252,7 @@ Foam::GAMGAgglomeration::GAMGAgglomeration
|
|||||||
*this,
|
*this,
|
||||||
controlDict
|
controlDict
|
||||||
)
|
)
|
||||||
: autoPtr<GAMGProcAgglomeration>(nullptr)
|
: autoPtr<GAMGProcAgglomeration>()
|
||||||
),
|
),
|
||||||
|
|
||||||
nCells_(maxLevels_),
|
nCells_(maxLevels_),
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,8 +25,15 @@ Class
|
|||||||
Foam::autoPtr
|
Foam::autoPtr
|
||||||
|
|
||||||
Description
|
Description
|
||||||
An auto-pointer similar to the STL auto_ptr but with automatic casting
|
Pointer management similar to std::unique_ptr, with some additional
|
||||||
to a reference to the type and with pointer allocation checking on access.
|
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
|
SourceFiles
|
||||||
autoPtrI.H
|
autoPtrI.H
|
||||||
@ -36,6 +43,13 @@ SourceFiles
|
|||||||
#ifndef autoPtr_H
|
#ifndef autoPtr_H
|
||||||
#define autoPtr_H
|
#define autoPtr_H
|
||||||
|
|
||||||
|
// Transitional features/misfeatures:
|
||||||
|
#define Foam_autoPtr_copyConstruct
|
||||||
|
#define Foam_autoPtr_copyAssign
|
||||||
|
#define Foam_autoPtr_castOperator
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -48,114 +62,217 @@ namespace Foam
|
|||||||
template<class T>
|
template<class T>
|
||||||
class autoPtr
|
class autoPtr
|
||||||
{
|
{
|
||||||
// Public data
|
//- Pointer to managed object
|
||||||
|
T* ptr_;
|
||||||
//- Pointer to object
|
|
||||||
mutable T* ptr_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
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
|
// Constructors
|
||||||
|
|
||||||
//- Construct null with nullptr
|
//- Construct with no managed object.
|
||||||
inline explicit autoPtr();
|
inline constexpr autoPtr() noexcept;
|
||||||
|
|
||||||
//- Store object pointer
|
//- Construct with no managed object (literal nullptr).
|
||||||
inline explicit autoPtr(T* p);
|
inline constexpr autoPtr(std::nullptr_t) noexcept;
|
||||||
|
|
||||||
//- Construct as copy by transferring pointer to this autoPtr and
|
//- Construct, taking ownership of the pointer.
|
||||||
//- setting the arguments pointer to nullptr
|
inline explicit autoPtr(T* p) noexcept;
|
||||||
inline autoPtr(const autoPtr<T>& ap);
|
|
||||||
|
|
||||||
//- Construct either by transferring pointer or cloning.
|
//- Move construct, transferring ownership.
|
||||||
// Should only be called with type that supports cloning
|
inline autoPtr(autoPtr<T>&& ap) noexcept;
|
||||||
inline autoPtr(const autoPtr<T>& ap, const bool reuse);
|
|
||||||
|
//- 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
|
//- Destructs the managed object if such is present
|
||||||
inline ~autoPtr();
|
inline ~autoPtr() noexcept;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Check
|
// Check
|
||||||
|
|
||||||
//- Return true if the autoPtr is empty (ie, no pointer set)
|
//- True if the managed pointer is null
|
||||||
inline bool empty() const;
|
inline bool empty() const noexcept;
|
||||||
|
|
||||||
//- Return true if the autoPtr valid (ie, the pointer is set)
|
//- True if the managed pointer is non-null
|
||||||
inline bool valid() const;
|
inline bool valid() const noexcept;
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
// Access
|
||||||
|
|
||||||
//- Release ownership of the object pointer and return the pointer
|
//- Return pointer to managed object without nullptr checking.
|
||||||
inline T* ptr();
|
// Pointer remains under autoPtr management.
|
||||||
|
inline T* get() noexcept;
|
||||||
|
|
||||||
//- Set pointer to that given.
|
//- Return const pointer to managed object without nullptr checking.
|
||||||
// If object pointer already set issue a FatalError
|
// Pointer remains under autoPtr management.
|
||||||
inline void set(T* p);
|
inline const T* get() const noexcept;
|
||||||
|
|
||||||
//- If object pointer already set, delete object and set to given
|
//- Return reference to the managed object without nullptr checking.
|
||||||
//- pointer
|
// When get() == nullptr, additional guards may be required to avoid
|
||||||
inline void reset(T* p = nullptr);
|
// inadvertent access to a nullptr.
|
||||||
|
inline T& ref();
|
||||||
//- Delete object (if the pointer is valid)
|
|
||||||
//- and set pointer to nullptr
|
|
||||||
inline void clear();
|
|
||||||
|
|
||||||
|
|
||||||
// Access
|
// Edit
|
||||||
|
|
||||||
//- Return the pointer, without nullptr checking.
|
//- Return pointer to the managed object and release ownership.
|
||||||
// Pointer remains under autoPtr management.
|
inline T* release() noexcept;
|
||||||
inline T* rawPtr();
|
|
||||||
|
|
||||||
//- Const access to the pointer, without nullptr checking.
|
//- Return pointer to the managed object and release ownership.
|
||||||
// Pointer remains under autoPtr management.
|
//- Identical behaviour to release().
|
||||||
inline const T* rawPtr() const;
|
// \note Provided for method naming consistent with Foam::tmp
|
||||||
|
inline T* ptr() noexcept;
|
||||||
|
|
||||||
//- Return the reference, without nullptr checking.
|
//- Delete managed object and set pointer to nullptr
|
||||||
inline T& rawRef();
|
inline void clear() noexcept;
|
||||||
|
|
||||||
//- Return the const reference, without nullptr checking.
|
//- Delete managed object and set to new given pointer
|
||||||
inline const T& rawRef() const;
|
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.
|
//- Construct copy by invoking clone on underlying managed object
|
||||||
// Fatal if no pointer is allocated.
|
// \param args list of arguments for clone
|
||||||
inline T& operator()();
|
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
|
// Member Operators
|
||||||
// Fatal if no pointer is allocated.
|
|
||||||
inline operator const T&() const;
|
|
||||||
|
|
||||||
//- Dereferences (non-const) pointer to the managed object
|
//- Return reference to the managed object.
|
||||||
// Fatal if no pointer is allocated.
|
// Fatal error if no pointer is managed
|
||||||
inline T* operator->();
|
inline T& operator*();
|
||||||
|
|
||||||
//- Dereferences (const) pointer to the managed object
|
//- Return const reference to the object.
|
||||||
// Fatal if no pointer is allocated.
|
// Fatal error if no pointer is managed
|
||||||
inline const T* operator->() const;
|
inline const T& operator*() const;
|
||||||
|
|
||||||
//- Take over the object pointer from parameter
|
//- Dereferences (non-const) pointer to the managed object
|
||||||
inline void operator=(T* p);
|
// Fatal error if no pointer is managed
|
||||||
|
inline T* operator->();
|
||||||
|
|
||||||
//- Take over the object pointer from parameter
|
//- Dereferences (const) pointer to the managed object
|
||||||
inline void operator=(const autoPtr<T>& ap);
|
// 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
|
} // End namespace Foam
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,75 +26,119 @@ License
|
|||||||
#include "error.H"
|
#include "error.H"
|
||||||
#include <typeinfo>
|
#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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline Foam::autoPtr<T>::autoPtr()
|
inline constexpr Foam::autoPtr<T>::autoPtr() noexcept
|
||||||
:
|
:
|
||||||
ptr_(nullptr)
|
ptr_(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
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)
|
ptr_(p)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline Foam::autoPtr<T>::autoPtr(const autoPtr<T>& ap)
|
inline Foam::autoPtr<T>::autoPtr(autoPtr<T>&& ap) noexcept
|
||||||
:
|
:
|
||||||
ptr_(ap.ptr_)
|
ptr_(ap.release())
|
||||||
{
|
{}
|
||||||
ap.ptr_ = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline Foam::autoPtr<T>::autoPtr(const autoPtr<T>& ap, const bool reuse)
|
template<class U>
|
||||||
{
|
inline Foam::autoPtr<T>::autoPtr(autoPtr<U>&& ap)
|
||||||
if (reuse)
|
:
|
||||||
{
|
ptr_(ap.release())
|
||||||
ptr_ = ap.ptr_;
|
{}
|
||||||
ap.ptr_ = nullptr;
|
|
||||||
}
|
|
||||||
else if (ap.valid())
|
|
||||||
{
|
|
||||||
ptr_ = ap().clone().ptr();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ptr_ = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
#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>
|
template<class T>
|
||||||
inline Foam::autoPtr<T>::~autoPtr()
|
inline Foam::autoPtr<T>::~autoPtr() noexcept
|
||||||
{
|
{
|
||||||
clear();
|
reset(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline bool Foam::autoPtr<T>::empty() const
|
inline bool Foam::autoPtr<T>::empty() const noexcept
|
||||||
{
|
{
|
||||||
return !ptr_;
|
return !ptr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline bool Foam::autoPtr<T>::valid() const
|
inline bool Foam::autoPtr<T>::valid() const noexcept
|
||||||
{
|
{
|
||||||
return ptr_;
|
return ptr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
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_;
|
T* p = ptr_;
|
||||||
ptr_ = nullptr;
|
ptr_ = nullptr;
|
||||||
@ -103,103 +147,82 @@ inline T* Foam::autoPtr<T>::ptr()
|
|||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline void Foam::autoPtr<T>::set(T* p)
|
inline T* Foam::autoPtr<T>::ptr() noexcept
|
||||||
{
|
{
|
||||||
if (ptr_)
|
return release();
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "object of type " << typeid(T).name()
|
|
||||||
<< " already allocated"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr_ = p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline void Foam::autoPtr<T>::reset(T* p)
|
inline void Foam::autoPtr<T>::clear() noexcept
|
||||||
{
|
|
||||||
if (ptr_)
|
|
||||||
{
|
|
||||||
delete ptr_;
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr_ = p;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
inline void Foam::autoPtr<T>::clear()
|
|
||||||
{
|
{
|
||||||
reset(nullptr);
|
reset(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
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>
|
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>
|
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>
|
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 * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline T& Foam::autoPtr<T>::operator()()
|
inline T& Foam::autoPtr<T>::operator*()
|
||||||
{
|
{
|
||||||
if (!ptr_)
|
if (!ptr_)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "object of type " << typeid(T).name()
|
<< "object of type " << typeid(T).name() << " is unallocated"
|
||||||
<< " is not allocated"
|
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return *ptr_;
|
return *ptr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline const T& Foam::autoPtr<T>::operator()() const
|
inline const T& Foam::autoPtr<T>::operator*() const
|
||||||
{
|
{
|
||||||
if (!ptr_)
|
return const_cast<autoPtr<T>*>(this)->operator*();
|
||||||
{
|
|
||||||
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()();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -209,11 +232,9 @@ inline T* Foam::autoPtr<T>::operator->()
|
|||||||
if (!ptr_)
|
if (!ptr_)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "object of type " << typeid(T).name()
|
<< "object of type " << typeid(T).name() << " is unallocated"
|
||||||
<< " is not allocated"
|
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ptr_;
|
return ptr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,25 +242,59 @@ inline T* Foam::autoPtr<T>::operator->()
|
|||||||
template<class T>
|
template<class T>
|
||||||
inline const T* Foam::autoPtr<T>::operator->() const
|
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>
|
template<class T>
|
||||||
inline void Foam::autoPtr<T>::operator=(T* p)
|
inline T& Foam::autoPtr<T>::operator()()
|
||||||
{
|
{
|
||||||
reset(p);
|
return operator*();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
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)
|
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;
|
sharedPointGlobalLabels = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sharedPointGlobalLabelsPtr_();
|
|
||||||
|
return *sharedPointGlobalLabelsPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2025,7 +2026,7 @@ const Foam::labelList& Foam::globalMeshData::sharedPointLabels() const
|
|||||||
{
|
{
|
||||||
calcSharedPoints();
|
calcSharedPoints();
|
||||||
}
|
}
|
||||||
return sharedPointLabelsPtr_();
|
return *sharedPointLabelsPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2035,7 +2036,7 @@ const Foam::labelList& Foam::globalMeshData::sharedPointAddr() const
|
|||||||
{
|
{
|
||||||
calcSharedPoints();
|
calcSharedPoints();
|
||||||
}
|
}
|
||||||
return sharedPointAddrPtr_();
|
return *sharedPointAddrPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2055,7 +2056,7 @@ const Foam::labelList& Foam::globalMeshData::sharedEdgeLabels() const
|
|||||||
{
|
{
|
||||||
calcSharedEdges();
|
calcSharedEdges();
|
||||||
}
|
}
|
||||||
return sharedEdgeLabelsPtr_();
|
return *sharedEdgeLabelsPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2065,7 +2066,7 @@ const Foam::labelList& Foam::globalMeshData::sharedEdgeAddr() const
|
|||||||
{
|
{
|
||||||
calcSharedEdges();
|
calcSharedEdges();
|
||||||
}
|
}
|
||||||
return sharedEdgeAddrPtr_();
|
return *sharedEdgeAddrPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2126,7 +2127,7 @@ const Foam::indirectPrimitivePatch& Foam::globalMeshData::coupledPatch() const
|
|||||||
<< endl;
|
<< 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);
|
em.insert(me[i], i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return coupledPatchMeshEdgeMapPtr_();
|
return *coupledPatchMeshEdgeMapPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2178,7 +2179,7 @@ const Foam::globalIndex& Foam::globalMeshData::globalPointNumbering() const
|
|||||||
new globalIndex(coupledPatch().nPoints())
|
new globalIndex(coupledPatch().nPoints())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return globalPointNumberingPtr_();
|
return *globalPointNumberingPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2189,7 +2190,7 @@ Foam::globalMeshData::globalTransforms() const
|
|||||||
{
|
{
|
||||||
globalTransformsPtr_.reset(new globalIndexAndTransform(mesh_));
|
globalTransformsPtr_.reset(new globalIndexAndTransform(mesh_));
|
||||||
}
|
}
|
||||||
return globalTransformsPtr_();
|
return *globalTransformsPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2199,7 +2200,7 @@ const Foam::labelListList& Foam::globalMeshData::globalPointSlaves() const
|
|||||||
{
|
{
|
||||||
calcGlobalPointSlaves();
|
calcGlobalPointSlaves();
|
||||||
}
|
}
|
||||||
return globalPointSlavesPtr_();
|
return *globalPointSlavesPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2210,7 +2211,7 @@ const
|
|||||||
{
|
{
|
||||||
calcGlobalPointSlaves();
|
calcGlobalPointSlaves();
|
||||||
}
|
}
|
||||||
return globalPointTransformedSlavesPtr_();
|
return *globalPointTransformedSlavesPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2220,7 +2221,7 @@ const Foam::mapDistribute& Foam::globalMeshData::globalPointSlavesMap() const
|
|||||||
{
|
{
|
||||||
calcGlobalPointSlaves();
|
calcGlobalPointSlaves();
|
||||||
}
|
}
|
||||||
return globalPointSlavesMapPtr_();
|
return *globalPointSlavesMapPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2233,7 +2234,7 @@ const Foam::globalIndex& Foam::globalMeshData::globalEdgeNumbering() const
|
|||||||
new globalIndex(coupledPatch().nEdges())
|
new globalIndex(coupledPatch().nEdges())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return globalEdgeNumberingPtr_();
|
return *globalEdgeNumberingPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2243,7 +2244,7 @@ const Foam::labelListList& Foam::globalMeshData::globalEdgeSlaves() const
|
|||||||
{
|
{
|
||||||
calcGlobalEdgeSlaves();
|
calcGlobalEdgeSlaves();
|
||||||
}
|
}
|
||||||
return globalEdgeSlavesPtr_();
|
return *globalEdgeSlavesPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2254,7 +2255,7 @@ const
|
|||||||
{
|
{
|
||||||
calcGlobalEdgeSlaves();
|
calcGlobalEdgeSlaves();
|
||||||
}
|
}
|
||||||
return globalEdgeTransformedSlavesPtr_();
|
return *globalEdgeTransformedSlavesPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2264,7 +2265,7 @@ const Foam::PackedBoolList& Foam::globalMeshData::globalEdgeOrientation() const
|
|||||||
{
|
{
|
||||||
calcGlobalEdgeOrientation();
|
calcGlobalEdgeOrientation();
|
||||||
}
|
}
|
||||||
return globalEdgeOrientationPtr_();
|
return *globalEdgeOrientationPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2274,7 +2275,7 @@ const Foam::mapDistribute& Foam::globalMeshData::globalEdgeSlavesMap() const
|
|||||||
{
|
{
|
||||||
calcGlobalEdgeSlaves();
|
calcGlobalEdgeSlaves();
|
||||||
}
|
}
|
||||||
return globalEdgeSlavesMapPtr_();
|
return *globalEdgeSlavesMapPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2285,7 +2286,7 @@ const
|
|||||||
{
|
{
|
||||||
calcGlobalPointBoundaryFaces();
|
calcGlobalPointBoundaryFaces();
|
||||||
}
|
}
|
||||||
return globalBoundaryFaceNumberingPtr_();
|
return *globalBoundaryFaceNumberingPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2296,7 +2297,7 @@ const
|
|||||||
{
|
{
|
||||||
calcGlobalPointBoundaryFaces();
|
calcGlobalPointBoundaryFaces();
|
||||||
}
|
}
|
||||||
return globalPointBoundaryFacesPtr_();
|
return *globalPointBoundaryFacesPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2307,7 +2308,7 @@ Foam::globalMeshData::globalPointTransformedBoundaryFaces() const
|
|||||||
{
|
{
|
||||||
calcGlobalPointBoundaryFaces();
|
calcGlobalPointBoundaryFaces();
|
||||||
}
|
}
|
||||||
return globalPointTransformedBoundaryFacesPtr_();
|
return *globalPointTransformedBoundaryFacesPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2318,7 +2319,7 @@ const
|
|||||||
{
|
{
|
||||||
calcGlobalPointBoundaryFaces();
|
calcGlobalPointBoundaryFaces();
|
||||||
}
|
}
|
||||||
return globalPointBoundaryFacesMapPtr_();
|
return *globalPointBoundaryFacesMapPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2328,7 +2329,7 @@ const Foam::labelList& Foam::globalMeshData::boundaryCells() const
|
|||||||
{
|
{
|
||||||
calcGlobalPointBoundaryCells();
|
calcGlobalPointBoundaryCells();
|
||||||
}
|
}
|
||||||
return boundaryCellsPtr_();
|
return *boundaryCellsPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2339,7 +2340,7 @@ const
|
|||||||
{
|
{
|
||||||
calcGlobalPointBoundaryCells();
|
calcGlobalPointBoundaryCells();
|
||||||
}
|
}
|
||||||
return globalBoundaryCellNumberingPtr_();
|
return *globalBoundaryCellNumberingPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2350,7 +2351,7 @@ const
|
|||||||
{
|
{
|
||||||
calcGlobalPointBoundaryCells();
|
calcGlobalPointBoundaryCells();
|
||||||
}
|
}
|
||||||
return globalPointBoundaryCellsPtr_();
|
return *globalPointBoundaryCellsPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2361,7 +2362,7 @@ Foam::globalMeshData::globalPointTransformedBoundaryCells() const
|
|||||||
{
|
{
|
||||||
calcGlobalPointBoundaryCells();
|
calcGlobalPointBoundaryCells();
|
||||||
}
|
}
|
||||||
return globalPointTransformedBoundaryCellsPtr_();
|
return *globalPointTransformedBoundaryCellsPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2372,7 +2373,7 @@ const
|
|||||||
{
|
{
|
||||||
calcGlobalPointBoundaryCells();
|
calcGlobalPointBoundaryCells();
|
||||||
}
|
}
|
||||||
return globalPointBoundaryCellsMapPtr_();
|
return *globalPointBoundaryCellsMapPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2382,7 +2383,7 @@ const Foam::labelListList& Foam::globalMeshData::globalCoPointSlaves() const
|
|||||||
{
|
{
|
||||||
calcGlobalCoPointSlaves();
|
calcGlobalCoPointSlaves();
|
||||||
}
|
}
|
||||||
return globalCoPointSlavesPtr_();
|
return *globalCoPointSlavesPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2392,7 +2393,7 @@ const Foam::mapDistribute& Foam::globalMeshData::globalCoPointSlavesMap() const
|
|||||||
{
|
{
|
||||||
calcGlobalCoPointSlaves();
|
calcGlobalCoPointSlaves();
|
||||||
}
|
}
|
||||||
return globalCoPointSlavesMapPtr_();
|
return *globalCoPointSlavesMapPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -347,13 +347,13 @@ public:
|
|||||||
//- Corresponding map
|
//- Corresponding map
|
||||||
const mapDistribute& map() const
|
const mapDistribute& map() const
|
||||||
{
|
{
|
||||||
return map_();
|
return *map_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Corresponding map
|
//- Corresponding map
|
||||||
mapDistribute& map()
|
mapDistribute& map()
|
||||||
{
|
{
|
||||||
return map_();
|
return *map_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- From (mesh or patch) point to index in procPoints
|
//- 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