diff --git a/applications/solvers/combustion/PDRFoam/createFields.H b/applications/solvers/combustion/PDRFoam/createFields.H index 84155c4849..c0602016c8 100644 --- a/applications/solvers/combustion/PDRFoam/createFields.H +++ b/applications/solvers/combustion/PDRFoam/createFields.H @@ -165,7 +165,7 @@ IOdictionary PDRProperties autoPtr drag = PDRDragModel::New ( PDRProperties, - turbulence, + *turbulence, rho, U, phi @@ -176,7 +176,7 @@ autoPtr flameWrinkling = XiModel::New ( PDRProperties, thermo, - turbulence, + *turbulence, Su, rho, b, diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H index aefdbdee4f..b84ce6a7fa 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H @@ -89,22 +89,22 @@ public: const rhoThermo& thermo1() const { - return thermo1_(); + return *thermo1_; } const rhoThermo& thermo2() const { - return thermo2_(); + return *thermo2_; } rhoThermo& thermo1() { - return thermo1_(); + return *thermo1_; } rhoThermo& thermo2() { - return thermo2_(); + return *thermo2_; } //- Correct the thermodynamics of each phase diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.C b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.C index c97a5a1382..007b8206ae 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.C @@ -81,7 +81,7 @@ Foam::phaseModel::phaseModel Foam::autoPtr Foam::phaseModel::clone() const { NotImplemented; - return autoPtr(nullptr); + return autoPtr(); } diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H index 66d0ac8d63..44310e4df3 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H @@ -120,13 +120,13 @@ public: //- Return const-access to phase rhoThermo const rhoThermo& thermo() const { - return thermo_(); + return *thermo_; } //- Return access to phase rhoThermo rhoThermo& thermo() { - return thermo_(); + return *thermo_; } //- Return const-access to phase divergence diff --git a/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.H b/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.H index 0950bbaba0..d790264fef 100644 --- a/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.H +++ b/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.H @@ -106,13 +106,13 @@ public: //- Return const-access to the mixture viscosityModel const mixtureViscosityModel& muModel() const { - return muModel_(); + return *muModel_; } //- Return const-access to the continuous-phase viscosityModel const viscosityModel& nucModel() const { - return nucModel_(); + return *nucModel_; } //- Return const-access to the dispersed-phase density diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/incompressibleThreePhaseMixture.H b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/incompressibleThreePhaseMixture.H index 58341e6cad..393c388d9f 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/incompressibleThreePhaseMixture.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/incompressibleThreePhaseMixture.H @@ -181,19 +181,19 @@ public: //- Return const-access to phase1 viscosityModel const viscosityModel& nuModel1() const { - return nuModel1_(); + return *nuModel1_; } //- Return const-access to phase2 viscosityModel const viscosityModel& nuModel2() const { - return nuModel2_(); + return *nuModel2_; } //- Return const-access to phase3 viscosityModel const viscosityModel& nuModel3() const { - return nuModel3_(); + return *nuModel3_; } //- Return the dynamic laminar viscosity diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C index 224d0345d6..b57058d61f 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C @@ -205,7 +205,7 @@ Foam::phaseModel::~phaseModel() Foam::autoPtr Foam::phaseModel::clone() const { NotImplemented; - return autoPtr(nullptr); + return autoPtr(); } diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H index 90e48183ca..3740878610 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H @@ -190,12 +190,12 @@ public: const surfaceScalarField& phi() const { - return phiPtr_(); + return *phiPtr_; } surfaceScalarField& phi() { - return phiPtr_(); + return *phiPtr_; } const surfaceScalarField& alphaPhi() const diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C index 5fc59061a4..e14906619b 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C @@ -68,7 +68,7 @@ Foam::phase::phase Foam::autoPtr Foam::phase::clone() const { NotImplemented; - return autoPtr(nullptr); + return autoPtr(); } diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.H b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.H index 91341fcf5c..3ce0ba7d65 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.H +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.H @@ -120,7 +120,7 @@ public: //- Return const-access to phase1 viscosityModel const viscosityModel& nuModel() const { - return nuModel_(); + return *nuModel_; } //- Return the kinematic laminar viscosity diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatAndMassTransferPhaseSystem/HeatAndMassTransferPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatAndMassTransferPhaseSystem/HeatAndMassTransferPhaseSystem.C index c63f6bfd44..bb493847b0 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatAndMassTransferPhaseSystem/HeatAndMassTransferPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatAndMassTransferPhaseSystem/HeatAndMassTransferPhaseSystem.C @@ -59,14 +59,9 @@ HeatAndMassTransferPhaseSystem massTransferModels_ ); - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -197,14 +192,9 @@ Foam::HeatAndMassTransferPhaseSystem::dmdt ) ); - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -239,14 +229,9 @@ Foam::HeatAndMassTransferPhaseSystem::momentumTransfer() const phaseSystem::momentumTransferTable& eqns = eqnsPtr(); // Source term due to mass trasfer - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -291,17 +276,10 @@ Foam::HeatAndMassTransferPhaseSystem::heatTransfer() const } // Heat transfer with the interface - forAllConstIter - ( - heatTransferModelTable, - heatTransferModels_, - heatTransferModelIter - ) + forAllConstIters(heatTransferModels_, heatTransferModelIter) { - const phasePair& pair - ( - this->phasePairs_[heatTransferModelIter.key()] - ); + const phasePair& pair = + *(this->phasePairs_[heatTransferModelIter.key()]); const phaseModel* phase = &pair.phase1(); const phaseModel* otherPhase = &pair.phase2(); @@ -344,14 +322,9 @@ Foam::HeatAndMassTransferPhaseSystem::heatTransfer() const } // Source term due to mass transfer - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C index 9fee19e77f..465d0b3af9 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C @@ -128,16 +128,12 @@ Foam::HeatTransferPhaseSystem::heatTransfer() const ); } - forAllConstIter - ( - heatTransferModelTable, - heatTransferModels_, - heatTransferModelIter - ) + forAllConstIters(heatTransferModels_, heatTransferModelIter) { - const volScalarField K(heatTransferModelIter()->K()); + const phasePair& pair = + *(this->phasePairs_[heatTransferModelIter.key()]); - const phasePair& pair(this->phasePairs_[heatTransferModelIter.key()]); + const volScalarField K(heatTransferModelIter()->K()); const phaseModel* phase = &pair.phase1(); const phaseModel* otherPhase = &pair.phase2(); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C index 1c9b53c803..53f724680b 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C @@ -86,14 +86,9 @@ massTransfer() const } // Reset the interfacial mass flow rates - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -108,22 +103,18 @@ massTransfer() const } // Sum up the contribution from each interface composition model - forAllConstIter + forAllConstIters ( - interfaceCompositionModelTable, interfaceCompositionModels_, interfaceCompositionModelIter ) { - const interfaceCompositionModel& compositionModel - ( - interfaceCompositionModelIter() - ); + const phasePair& pair = + *(this->phasePairs_[interfaceCompositionModelIter.key()]); + + const interfaceCompositionModel& compositionModel = + *(interfaceCompositionModelIter.object()); - const phasePair& pair - ( - this->phasePairs_[interfaceCompositionModelIter.key()] - ); const phaseModel& phase = pair.phase1(); const phaseModel& otherPhase = pair.phase2(); const phasePairKey key(phase.name(), otherPhase.name()); @@ -209,14 +200,9 @@ correctThermo() // Yfi is likely to be a strong non-linear (typically exponential) function // of Tf, so the solution for the temperature is newton-accelerated - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C index 02969b89cb..43d5881fed 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C @@ -82,14 +82,10 @@ MomentumTransferPhaseSystem turbulentDispersionModels_ ); - forAllConstIter - ( - dragModelTable, - dragModels_, - dragModelIter - ) + forAllConstIters(dragModels_, dragModelIter) { - const phasePair& pair(this->phasePairs_[dragModelIter.key()]); + const phasePair& pair = + *(this->phasePairs_[dragModelIter.key()]); Kds_.insert ( @@ -102,14 +98,10 @@ MomentumTransferPhaseSystem ); } - forAllConstIter - ( - virtualMassModelTable, - virtualMassModels_, - virtualMassModelIter - ) + forAllConstIters(virtualMassModels_, virtualMassModelIter) { - const phasePair& pair(this->phasePairs_[virtualMassModelIter.key()]); + const phasePair& pair = + *(this->phasePairs_[virtualMassModelIter.key()]); Vms_.insert ( @@ -183,16 +175,11 @@ Foam::MomentumTransferPhaseSystem::Kd ) ); - forAllConstIter - ( - phaseSystem::KdTable, - Kds_, - KdIter - ) + forAllConstIters(Kds_, KdIter) { - const volScalarField& K(*KdIter()); + const phasePair& pair = *(this->phasePairs_[KdIter.key()]); - const phasePair& pair(this->phasePairs_[KdIter.key()]); + const volScalarField& K(*KdIter()); const phaseModel* phase1 = &pair.phase1(); const phaseModel* phase2 = &pair.phase2(); @@ -430,27 +417,17 @@ Foam::MomentumTransferPhaseSystem::momentumTransfer() const } // Update the drag coefficients - forAllConstIter - ( - dragModelTable, - dragModels_, - dragModelIter - ) + forAllConstIters(dragModels_, dragModelIter) { *Kds_[dragModelIter.key()] = dragModelIter()->K(); } // Add the implicit part of the drag force - forAllConstIter - ( - phaseSystem::KdTable, - Kds_, - KdIter - ) + forAllConstIters(Kds_, KdIter) { - const volScalarField& K(*KdIter()); + const phasePair& pair = *(this->phasePairs_[KdIter.key()]); - const phasePair& pair(this->phasePairs_[KdIter.key()]); + const volScalarField& K(*KdIter()); const phaseModel* phase = &pair.phase1(); const phaseModel* otherPhase = &pair.phase2(); @@ -466,27 +443,17 @@ Foam::MomentumTransferPhaseSystem::momentumTransfer() const } // Update the virtual mass coefficients - forAllConstIter - ( - virtualMassModelTable, - virtualMassModels_, - virtualMassModelIter - ) + forAllConstIters(virtualMassModels_, virtualMassModelIter) { *Vms_[virtualMassModelIter.key()] = virtualMassModelIter()->K(); } // Add the virtual mass force - forAllConstIter - ( - phaseSystem::VmTable, - Vms_, - VmIter - ) + forAllConstIters(Vms_, VmIter) { - const volScalarField& Vm(*VmIter()); + const phasePair& pair = *(this->phasePairs_[VmIter.key()]); - const phasePair& pair(this->phasePairs_[VmIter.key()]); + const volScalarField& Vm(*VmIter()); const phaseModel* phase = &pair.phase1(); const phaseModel* otherPhase = &pair.phase2(); @@ -557,33 +524,22 @@ Foam::MomentumTransferPhaseSystem::Fs() const PtrList& Fs = tFs(); // Add the lift force - forAllConstIter - ( - liftModelTable, - liftModels_, - liftModelIter - ) + forAllConstIters(liftModels_, modelIter) { - const volVectorField F(liftModelIter()->F()); + const phasePair& pair = *(this->phasePairs_[modelIter.key()]); - const phasePair& pair(this->phasePairs_[liftModelIter.key()]); + const volVectorField F(modelIter()->template F()); setF(Fs, pair.phase1().index()) += F; setF(Fs, pair.phase2().index()) -= F; } // Add the wall lubrication force - forAllConstIter - ( - wallLubricationModelTable, - wallLubricationModels_, - wallLubricationModelIter - ) + forAllConstIters(wallLubricationModels_, modelIter) { - const volVectorField F(wallLubricationModelIter()->F()); + const phasePair& pair = *(this->phasePairs_[modelIter.key()]); - const phasePair& - pair(this->phasePairs_[wallLubricationModelIter.key()]); + const volVectorField F(modelIter()->template F()); setF(Fs, pair.phase1().index()) += F; setF(Fs, pair.phase2().index()) -= F; @@ -647,15 +603,10 @@ Foam::MomentumTransferPhaseSystem::phiDs PtrList& phiDs = tphiDs(); // Add the turbulent dispersion force - forAllConstIter - ( - turbulentDispersionModelTable, - turbulentDispersionModels_, - turbulentDispersionModelIter - ) + forAllConstIters(turbulentDispersionModels_, turbulentDispersionModelIter) { - const phasePair& - pair(this->phasePairs_[turbulentDispersionModelIter.key()]); + const phasePair& pair = + *(this->phasePairs_[turbulentDispersionModelIter.key()]); const volScalarField D(turbulentDispersionModelIter()->D()); const surfaceScalarField snGradAlpha1 diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C index a6dd838d23..bb5c2462c3 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C @@ -42,14 +42,9 @@ ThermalPhaseChangePhaseSystem massTransfer_(this->lookup("massTransfer")) { - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -92,7 +87,7 @@ template const Foam::saturationModel& Foam::ThermalPhaseChangePhaseSystem::saturation() const { - return saturationModel_(); + return *saturationModel_; } @@ -109,14 +104,9 @@ Foam::ThermalPhaseChangePhaseSystem::heatTransfer() const phaseSystem::heatTransferTable& eqns = eqnsPtr(); // Accumulate mDotL contributions from boundaries - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -219,19 +209,15 @@ Foam::ThermalPhaseChangePhaseSystem::massTransfer() const } } - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { continue; } + const phaseModel& phase = pair.phase1(); const phaseModel& otherPhase = pair.phase2(); @@ -292,14 +278,9 @@ Foam::ThermalPhaseChangePhaseSystem::iDmdt ) ); - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -332,14 +313,9 @@ void Foam::ThermalPhaseChangePhaseSystem::correctThermo() BasePhaseSystem::correctThermo(); - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C index 2afa388aca..460e21ce85 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C @@ -401,7 +401,7 @@ template const Foam::phaseCompressibleTurbulenceModel& Foam::MovingPhaseModel::turbulence() const { - return turbulence_; + return *turbulence_; } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C index da10824230..26be4e1bc7 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C @@ -77,7 +77,7 @@ Foam::phaseModel::phaseModel Foam::autoPtr Foam::phaseModel::clone() const { NotImplemented; - return autoPtr(nullptr); + return autoPtr(); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C index 8f4bf7ee0f..768c905e1f 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C @@ -48,8 +48,8 @@ void Foam::phaseSystem::createSubModels key, modelType::New ( - *iter, - phasePairs_[key] + iter.object(), + phasePairs_[key]() ) ); } @@ -98,11 +98,11 @@ void Foam::phaseSystem::generatePairsAndSubModels const blendingMethod& blending ( blendingMethods_.found(modelName) - ? blendingMethods_[modelName] - : blendingMethods_["default"] + ? *(blendingMethods_[modelName]) + : *(blendingMethods_["default"]) ); - autoPtr noModel(nullptr); + autoPtr noModel; forAllConstIter(typename modelTypeTable, tempModels, iter) { diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H index a164b73f26..758c411968 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H @@ -217,16 +217,11 @@ while (pimple.correct()) ) ); - forAllConstIter - ( - phaseSystem::KdTable, - fluid.Kds(), - KdIter - ) + forAllConstIters(fluid.Kds(), KdIter) { const volScalarField& K(*KdIter()); - const phasePair& pair(fluid.phasePairs()[KdIter.key()]); + const phasePair& pair = *(fluid.phasePairs()[KdIter.key()]); const phaseModel* phase1 = &pair.phase1(); const phaseModel* phase2 = &pair.phase2(); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H index 3183796015..db917c4865 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H @@ -115,7 +115,7 @@ public: autoPtr clone() const { NotImplemented; - return autoPtr(nullptr); + return autoPtr(); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.C index cc089e347e..289054982d 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.C @@ -451,9 +451,11 @@ bool Foam::BlendedInterfacialModel::hasModel ) const { return - &phase == &(pair_.phase1()) + ( + &phase == &(pair_.phase1()) ? model1In2_.valid() - : model2In1_.valid(); + : model2In1_.valid() + ); } @@ -463,7 +465,7 @@ const modelType& Foam::BlendedInterfacialModel::phaseModel const class phaseModel& phase ) const { - return &phase == &(pair_.phase1()) ? model1In2_ : model2In1_; + return &phase == &(pair_.phase1()) ? *model1In2_ : *model2In1_; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H index c7655b9c34..29c150ce74 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H @@ -114,7 +114,7 @@ public: autoPtr clone() const { NotImplemented; - return autoPtr(nullptr); + return autoPtr(); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C index 9352b72397..139826e885 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C @@ -227,14 +227,14 @@ Foam::tmp Foam::phaseModel::d() const Foam::PhaseCompressibleTurbulenceModel& Foam::phaseModel::turbulence() { - return turbulence_(); + return *turbulence_; } const Foam::PhaseCompressibleTurbulenceModel& Foam::phaseModel::turbulence() const { - return turbulence_(); + return *turbulence_; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H index 894907fe7c..f0c88afa1e 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H @@ -162,14 +162,14 @@ public: //- Return the thermophysical model const rhoThermo& thermo() const { - return thermo_(); + return *thermo_; } //- Return non-const access to the thermophysical model // for correction rhoThermo& thermo() { - return thermo_(); + return *thermo_; } //- Return the laminar viscosity @@ -286,13 +286,13 @@ public: //- Return the volumetric flux const surfaceScalarField& phi() const { - return phiPtr_(); + return *phiPtr_; } //- Return non-const access to the volumetric flux surfaceScalarField& phi() { - return phiPtr_(); + return *phiPtr_; } //- Return the volumetric flux of the phase diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C index 5a99c32ae2..4750293fe8 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C @@ -177,12 +177,12 @@ Foam::twoPhaseSystem::twoPhaseSystem lookup("drag"), ( blendingMethods_.found("drag") - ? blendingMethods_["drag"] - : blendingMethods_["default"] + ? *(blendingMethods_["drag"]) + : *(blendingMethods_["default"]) ), - pair_, - pair1In2_, - pair2In1_, + *pair_, + *pair1In2_, + *pair2In1_, false // Do not zero drag coefficent at fixed-flux BCs ) ); @@ -194,12 +194,12 @@ Foam::twoPhaseSystem::twoPhaseSystem lookup("virtualMass"), ( blendingMethods_.found("virtualMass") - ? blendingMethods_["virtualMass"] - : blendingMethods_["default"] + ? *(blendingMethods_["virtualMass"]) + : *(blendingMethods_["default"]) ), - pair_, - pair1In2_, - pair2In1_ + *pair_, + *pair1In2_, + *pair2In1_ ) ); @@ -210,12 +210,12 @@ Foam::twoPhaseSystem::twoPhaseSystem lookup("heatTransfer"), ( blendingMethods_.found("heatTransfer") - ? blendingMethods_["heatTransfer"] - : blendingMethods_["default"] + ? *(blendingMethods_["heatTransfer"]) + : *(blendingMethods_["default"]) ), - pair_, - pair1In2_, - pair2In1_ + *pair_, + *pair1In2_, + *pair2In1_ ) ); @@ -226,12 +226,12 @@ Foam::twoPhaseSystem::twoPhaseSystem lookup("lift"), ( blendingMethods_.found("lift") - ? blendingMethods_["lift"] - : blendingMethods_["default"] + ? *(blendingMethods_["lift"]) + : *(blendingMethods_["default"]) ), - pair_, - pair1In2_, - pair2In1_ + *pair_, + *pair1In2_, + *pair2In1_ ) ); @@ -242,12 +242,12 @@ Foam::twoPhaseSystem::twoPhaseSystem lookup("wallLubrication"), ( blendingMethods_.found("wallLubrication") - ? blendingMethods_["wallLubrication"] - : blendingMethods_["default"] + ? *(blendingMethods_["wallLubrication"]) + : *(blendingMethods_["default"]) ), - pair_, - pair1In2_, - pair2In1_ + *pair_, + *pair1In2_, + *pair2In1_ ) ); @@ -258,12 +258,12 @@ Foam::twoPhaseSystem::twoPhaseSystem lookup("turbulentDispersion"), ( blendingMethods_.found("turbulentDispersion") - ? blendingMethods_["turbulentDispersion"] - : blendingMethods_["default"] + ? *(blendingMethods_["turbulentDispersion"]) + : *(blendingMethods_["default"]) ), - pair_, - pair1In2_, - pair2In1_ + *pair_, + *pair1In2_, + *pair2In1_ ) ); } @@ -272,7 +272,7 @@ Foam::twoPhaseSystem::twoPhaseSystem // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::twoPhaseSystem::~twoPhaseSystem() -{} +{} // Define here (incomplete type in header) // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/createFields.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/createFields.H index fd97d416f9..8d9ef025c8 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/createFields.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/createFields.H @@ -16,7 +16,7 @@ volVectorField D ); -autoPtr Tptr(nullptr); +autoPtr Tptr; if (thermalStress) { diff --git a/applications/test/autoPtr/Make/files b/applications/test/autoPtr/Make/files new file mode 100644 index 0000000000..a89ae35418 --- /dev/null +++ b/applications/test/autoPtr/Make/files @@ -0,0 +1,3 @@ +Test-autoPtr.C + +EXE = $(FOAM_USER_APPBIN)/Test-autoPtr diff --git a/applications/test/autoPtr/Make/options b/applications/test/autoPtr/Make/options new file mode 100644 index 0000000000..3ed9829402 --- /dev/null +++ b/applications/test/autoPtr/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude + +EXE_LIBS = \ + -lthermophysicalProperties diff --git a/applications/test/autoPtr/Test-autoPtr.C b/applications/test/autoPtr/Test-autoPtr.C new file mode 100644 index 0000000000..edd7f222e8 --- /dev/null +++ b/applications/test/autoPtr/Test-autoPtr.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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 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&& 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 +autoPtr testNullReturn1() +{ + return nullptr; +} + + +// Constructor from raw pointer is explicit +template +autoPtr testNullReturn2() +{ + T* p = new T; + + return p; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + { + auto list = autoPtr::New(10, label(-1)); + + Info<<"create: " << list() << nl; + + Info<<"create: " << autoPtr::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::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 liqProp + ( + autoPtr::New() + ); + + Info<<"liq 1: " << liqProp() << nl << nl; + } + + // Construct Base from Derived + { + autoPtr liqProp = + autoPtr::NewFrom(); + + Info<<"liq 2: " << liqProp() << nl << nl; + } + + // Construct Base from Derived + { + const autoPtr liqProp(autoPtr::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::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::New(identity(8))); + } + + // Memory transfer + { + Info<< nl << nl; + + auto list = autoPtr::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::New(); + auto ptr2 = autoPtr::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 ptr1 = testNullReturn1(); + + // Good this does not compile: + // autoPtr ptr2 = testNullReturn2(); + } + + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/fieldMapping/Test-fieldMapping.C b/applications/test/fieldMapping/Test-fieldMapping.C index a641819d7e..0ca3052e4c 100644 --- a/applications/test/fieldMapping/Test-fieldMapping.C +++ b/applications/test/fieldMapping/Test-fieldMapping.C @@ -202,7 +202,7 @@ int main(int argc, char *argv[]) autoPtr morphMap = meshMod.changeMesh(mesh, inflate); Info<< "Mapping fields" << nl << endl; - mesh.updateMesh(morphMap); + mesh.updateMesh(morphMap()); // Move mesh (since morphing does not do this) if (morphMap().hasMotionPoints()) @@ -212,7 +212,7 @@ int main(int argc, char *argv[]) } // Update numbering of cells/vertices. - faceRemover.updateMesh(morphMap); + faceRemover.updateMesh(morphMap()); Info<< "Writing fields" << nl << endl; diff --git a/applications/test/hexRef8/Test-hexRef8.C b/applications/test/hexRef8/Test-hexRef8.C index 66a55fbafc..d34ff23c42 100644 --- a/applications/test/hexRef8/Test-hexRef8.C +++ b/applications/test/hexRef8/Test-hexRef8.C @@ -276,7 +276,7 @@ int main(int argc, char *argv[]) // Update fields Info<< nl << "-- mapping mesh data" << endl; - mesh.updateMesh(map); + mesh.updateMesh(map()); // Inflate mesh if (map().hasMotionPoints()) @@ -287,7 +287,7 @@ int main(int argc, char *argv[]) // Update numbering of cells/vertices. Info<< nl << "-- mapping hexRef8 data" << endl; - meshCutter.updateMesh(map); + meshCutter.updateMesh(map()); } diff --git a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C index f6bac7844a..6bd47c6bf7 100644 --- a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C +++ b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C @@ -1155,7 +1155,9 @@ int main(int argc, char *argv[]) } // Change the mesh. Change points directly (no inflation). - autoPtr map = meshMod.changeMesh(subsetter.subMesh(), false); + autoPtr mapPtr = + meshMod.changeMesh(subsetter.subMesh(), false); + mapPolyMesh& map = *mapPtr; // Update fields subsetter.subMesh().updateMesh(map); @@ -1231,9 +1233,9 @@ int main(int argc, char *argv[]) // Move mesh (since morphing might not do this) - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - subsetter.subMesh().movePoints(map().preMotionPoints()); + subsetter.subMesh().movePoints(map.preMotionPoints()); } Info<< "Writing mesh with split blockedFaces to time " << runTime.value() diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C index fa307d05e6..f4d889d28a 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C @@ -186,7 +186,7 @@ int main(int argc, char *argv[]) polyMeshFilter::copySets(newMesh(), mesh); } - pointPriority = meshFilter.pointPriority(); + pointPriority = *(meshFilter.pointPriority()); } if (collapseFaceSet) @@ -203,14 +203,14 @@ int main(int argc, char *argv[]) // from the previous edge filtering to use as a stopping criterion. meshFilter.filter(indirectPatchFaces); { - polyTopoChange meshMod(newMesh); + polyTopoChange meshMod(newMesh()); meshMod.changeMesh(mesh, false); polyMeshFilter::copySets(newMesh(), mesh); } - pointPriority = meshFilter.pointPriority(); + pointPriority = *(meshFilter.pointPriority()); } if (collapseFaces) @@ -227,14 +227,14 @@ int main(int argc, char *argv[]) // from the previous edge filtering to use as a stopping criterion. meshFilter.filter(nBadFaces); { - polyTopoChange meshMod(newMesh); + polyTopoChange meshMod(newMesh()); meshMod.changeMesh(mesh, false); polyMeshFilter::copySets(newMesh(), mesh); } - pointPriority = meshFilter.pointPriority(); + pointPriority = *(meshFilter.pointPriority()); } // Write resulting mesh diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C index f1e3218540..3423d69865 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C +++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C @@ -113,7 +113,7 @@ label mergePatchFaces map = meshMod.changeMesh(mesh, false, true); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Move mesh (since morphing does not do this) if (map().hasMotionPoints()) @@ -269,7 +269,7 @@ label mergePatchFaces map = meshMod.changeMesh(mesh, false, true); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Move mesh (since morphing does not do this) if (map().hasMotionPoints()) @@ -322,7 +322,7 @@ label mergeEdges(const scalar minCos, polyMesh& mesh) autoPtr map = meshMod.changeMesh(mesh, false, true); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Move mesh (since morphing does not do this) if (map().hasMotionPoints()) diff --git a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C index 5b123d64e2..6901fcd8da 100644 --- a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C +++ b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C @@ -174,10 +174,10 @@ int main(int argc, char *argv[]) autoPtr map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Update numbering of cells/vertices. - meshCutter.updateMesh(map); + meshCutter.updateMesh(map()); // Optionally inflate mesh if (map().hasMotionPoints()) diff --git a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C index 2578a37e9b..bb78ffc827 100644 --- a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C +++ b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C @@ -155,18 +155,18 @@ int main(int argc, char *argv[]) meshMod ); - autoPtr morphMap = meshMod.changeMesh(mesh, false); + autoPtr map = meshMod.changeMesh(mesh, false); - mesh.updateMesh(morphMap); + mesh.updateMesh(map()); // Move mesh (since morphing does not do this) - if (morphMap().hasMotionPoints()) + if (map().hasMotionPoints()) { - mesh.movePoints(morphMap().preMotionPoints()); + mesh.movePoints(map().preMotionPoints()); } // Update numbering of cells/vertices. - faceRemover.updateMesh(morphMap); + faceRemover.updateMesh(map()); if (!overwrite) { diff --git a/applications/utilities/mesh/advanced/selectCells/selectCells.C b/applications/utilities/mesh/advanced/selectCells/selectCells.C index 8b4b2dcaf2..fef71bbd87 100644 --- a/applications/utilities/mesh/advanced/selectCells/selectCells.C +++ b/applications/utilities/mesh/advanced/selectCells/selectCells.C @@ -416,20 +416,14 @@ int main(int argc, char *argv[]) ); - // Surface - autoPtr surf(nullptr); - // Search engine on surface. - autoPtr querySurf(nullptr); - if (useSurface) { - surf.reset(new triSurface(surfName)); + triSurface surf(surfName); // Dump some stats - surf().writeStats(Info); + surf.writeStats(Info); - // Search engine on surface. - querySurf.reset(new triSurfaceSearch(surf)); + triSurfaceSearch querySurf(surf); // Set cellType[celli] according to relation to surface cutBySurface diff --git a/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C b/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C index 8596ca8f9c..98fa7d42a9 100644 --- a/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C +++ b/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C @@ -266,7 +266,7 @@ int main(int argc, char *argv[]) Info<< nl << "Bounding box size: " << mesh().bounds().span() << nl; // check number of regions - regionSplit rs(mesh); + regionSplit rs(mesh()); Info<< "Number of regions: " << rs.nRegions(); if (rs.nRegions() == 1) @@ -281,7 +281,7 @@ int main(int argc, char *argv[]) << "**************************************************" << nl; } Info<< endl; - reader.writeMesh(mesh, format); + reader.writeMesh(mesh(), format); // exportName only has a size when export is in effect if (exportName.size()) diff --git a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C index c3ffaf04f0..806ded99fb 100644 --- a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C +++ b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C @@ -119,7 +119,7 @@ int main(int argc, char *argv[]) autoPtr mesh = reader.mesh(runTime); - reader.writeMesh(mesh, format); + reader.writeMesh(mesh(), format); Info<< "\nEnd\n" << endl; diff --git a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C index 6d9295dd93..7d459ec82d 100644 --- a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C +++ b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C @@ -338,7 +338,7 @@ int main(int argc, char *argv[]) wordList(0) ) ); - const polyMesh& mesh = meshPtr; + const polyMesh& mesh = *meshPtr; if (readFaceFile) diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index 9051a84db5..f4bc4c55e8 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -433,7 +433,7 @@ int main(int argc, char *argv[]) autoPtr map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Move mesh (since morphing does not do this) if (map().hasMotionPoints()) @@ -788,7 +788,7 @@ int main(int argc, char *argv[]) ( layerExtrude.addedCells ( - meshFromMesh, + *meshFromMesh, layerExtrude.layerFaces() ) ); @@ -937,7 +937,7 @@ int main(int argc, char *argv[]) autoPtr map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Update stored data updateFaceLabels(map(), frontPatchFaces); @@ -1074,7 +1074,7 @@ int main(int argc, char *argv[]) autoPtr map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Update local data updateCellSet(map(), addedCellsSet); diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index db1b8c2480..869d54d80a 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -2470,7 +2470,7 @@ int main(int argc, char *argv[]) // Update numbering on extruder. - extruder.updateMesh(shellMap); + extruder.updateMesh(shellMap()); // Calculate offsets from shell mesh back to original mesh @@ -2818,7 +2818,7 @@ int main(int argc, char *argv[]) addBafflesMap = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(addBafflesMap); + mesh.updateMesh(addBafflesMap()); //XXXXXX diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C index d6d87e4c8f..10fda1151c 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C @@ -251,7 +251,7 @@ int main(int argc, char *argv[]) // Create a mesh from topo changes. autoPtr morphMap = meshMod().changeMesh(mesh(), false); - mesh().updateMesh(morphMap); + mesh().updateMesh(morphMap()); { edgeCollapser collapser(mesh()); @@ -302,7 +302,7 @@ int main(int argc, char *argv[]) autoPtr morphMap = meshModCollapse.changeMesh(mesh(), false); - mesh().updateMesh(morphMap); + mesh().updateMesh(morphMap()); } if (!overwrite) diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C index 97311eef3c..c053ce9e7b 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C @@ -142,13 +142,6 @@ Foam::DistributedDelaunayMesh::DistributedDelaunayMesh {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::DistributedDelaunayMesh::~DistributedDelaunayMesh() -{} - - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template @@ -491,7 +484,8 @@ Foam::label Foam::DistributedDelaunayMesh::referVertices const label preDistributionSize = parallelVertices.size(); - mapDistribute pointMap = buildMap(targetProcessor); + autoPtr pointMapPtr = buildMap(targetProcessor); + mapDistribute& pointMap = *pointMapPtr; // Make a copy of the original list. DynamicList originalParallelVertices(parallelVertices); diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H index 35b0859b53..07954827b8 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H @@ -141,7 +141,7 @@ public: //- Destructor - ~DistributedDelaunayMesh(); + ~DistributedDelaunayMesh() = default; // Queries diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C index 25d9188e01..210d027fe6 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C @@ -248,10 +248,10 @@ void Foam::backgroundMeshDecomposition::initialRefinement() ); // Update fields - mesh_.updateMesh(map); + mesh_.updateMesh(map()); // Update numbering of cells/vertices. - meshCutter_.updateMesh(map); + meshCutter_.updateMesh(map()); { // Map volumeStatus @@ -357,11 +357,11 @@ void Foam::backgroundMeshDecomposition::initialRefinement() ); // Update fields - mesh_.updateMesh(map); + mesh_.updateMesh(map()); // Update numbering of cells/vertices. - meshCutter_.updateMesh(map); - cellRemover.updateMesh(map); + meshCutter_.updateMesh(map()); + cellRemover.updateMesh(map()); { // Map volumeStatus @@ -416,7 +416,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement() newDecomp ); - meshCutter_.distribute(mapDist); + meshCutter_.distribute(mapDist()); mapDist().distributeCellData(volumeStatus); @@ -840,12 +840,6 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::backgroundMeshDecomposition::~backgroundMeshDecomposition() -{} - - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::autoPtr @@ -954,10 +948,10 @@ Foam::backgroundMeshDecomposition::distribute ); // Update fields - mesh_.updateMesh(map); + mesh_.updateMesh(map()); // Update numbering of cells/vertices. - meshCutter_.updateMesh(map); + meshCutter_.updateMesh(map()); Info<< " Background mesh refined from " << returnReduce(map().nOldCells(), sumOp