diff --git a/applications/solvers/combustion/PDRFoam/createFields.H b/applications/solvers/combustion/PDRFoam/createFields.H index 84155c484965bbefccfb8b90bdde8bc3b6ebb9b3..c0602016c83af0969f274a500bafb4b7d971f644 100644 --- a/applications/solvers/combustion/PDRFoam/createFields.H +++ b/applications/solvers/combustion/PDRFoam/createFields.H @@ -165,7 +165,7 @@ IOdictionary PDRProperties autoPtr<PDRDragModel> drag = PDRDragModel::New ( PDRProperties, - turbulence, + *turbulence, rho, U, phi @@ -176,7 +176,7 @@ autoPtr<XiModel> flameWrinkling = XiModel::New ( PDRProperties, thermo, - turbulence, + *turbulence, Su, rho, b, diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H index aefdbdee4fbc2f06a74ce37d95a8b9fbb0877bc5..b84ce6a7fac4a0434ae7f4789df6dec1c3e38aa7 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 c97a5a1382f02cacf7f45266b4cb0f9657557c20..007b8206ae23c70076d049cc35c343a012eb7b28 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> Foam::phaseModel::clone() const { NotImplemented; - return autoPtr<phaseModel>(nullptr); + return autoPtr<phaseModel>(); } diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H index 66d0ac8d63a8d6c008f18a09a75dc98d6c149d99..44310e4df36408ae514b4c9cbaf7d82a05d5570f 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 0950bbaba08cc03cc1dde131180a56b705d816d6..d790264fef2be93569017090652de36fc13f2f6c 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 58341e6cad0dca6f1136e8bd258e8a0a3f60b75a..393c388d9fdf90a1fcdb01391a5678e900b8e31f 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 224d0345d6ddc8481542d436e11399fa4187a0f3..b57058d61ff3829def823b4c2260083257586219 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> Foam::phaseModel::clone() const { NotImplemented; - return autoPtr<phaseModel>(nullptr); + return autoPtr<phaseModel>(); } diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H index 90e48183cae4ac612202ad6a98aa80e7fc727a40..37408786106c3ce49295a23319cbd52519d8f33f 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 5fc59061a4f8d4c3d1fc61e4ee8356581bb76c78..e14906619b4dfd343d3f26fc67ccb66f4e0f4173 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> Foam::phase::clone() const { NotImplemented; - return autoPtr<phase>(nullptr); + return autoPtr<phase>(); } diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.H b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.H index 91341fcf5c1bc182ee8c862102d70390e88bbb2c..3ce0ba7d65e52e38739a89132b746227c90cae98 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 c63f6bfd447ba2b4d91e4d33cfb019ff9dc5438a..bb493847b05b01c21410cc1fc9c38b5e1a9b5c4b 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<BasePhaseSystem>::dmdt ) ); - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -239,14 +229,9 @@ Foam::HeatAndMassTransferPhaseSystem<BasePhaseSystem>::momentumTransfer() const phaseSystem::momentumTransferTable& eqns = eqnsPtr(); // Source term due to mass trasfer - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -291,17 +276,10 @@ Foam::HeatAndMassTransferPhaseSystem<BasePhaseSystem>::heatTransfer() const } // Heat transfer with the interface - forAllConstIter - ( - heatTransferModelTable, - heatTransferModels_, - heatTransferModelIter - ) + forAllConstIters(heatTransferModels_, heatTransferModelIter) { - const phasePair& pair - ( - this->phasePairs_[heatTransferModelIter.key()] - ); + const phasePair& pair = + *(this->phasePairs_[heatTransferModelIter.key()]); const phaseModel* phase = &pair.phase1(); const phaseModel* otherPhase = &pair.phase2(); @@ -344,14 +322,9 @@ Foam::HeatAndMassTransferPhaseSystem<BasePhaseSystem>::heatTransfer() const } // Source term due to mass transfer - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C index 9fee19e77fdead51e7f5cb59f943cc2c924422c4..465d0b3af961cc6a115f5f7463052d29779cba89 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<BasePhaseSystem>::heatTransfer() const ); } - forAllConstIter - ( - heatTransferModelTable, - heatTransferModels_, - heatTransferModelIter - ) + forAllConstIters(heatTransferModels_, heatTransferModelIter) { - const volScalarField K(heatTransferModelIter()->K()); + const phasePair& pair = + *(this->phasePairs_[heatTransferModelIter.key()]); - const phasePair& pair(this->phasePairs_[heatTransferModelIter.key()]); + const volScalarField K(heatTransferModelIter()->K()); const phaseModel* phase = &pair.phase1(); const phaseModel* otherPhase = &pair.phase2(); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C index 1c9b53c803cd98ab9256edb36853a1922119f135..53f724680beb03faf5e837f59614df7299e2963b 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 02969b89cb86825dda8f261d7118df25cbe53164..43d5881fed049580e4f84e3b2ae0c407b1355799 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<BasePhaseSystem>::Kd ) ); - forAllConstIter - ( - phaseSystem::KdTable, - Kds_, - KdIter - ) + forAllConstIters(Kds_, KdIter) { - const volScalarField& K(*KdIter()); + const phasePair& pair = *(this->phasePairs_[KdIter.key()]); - const phasePair& pair(this->phasePairs_[KdIter.key()]); + const volScalarField& K(*KdIter()); const phaseModel* phase1 = &pair.phase1(); const phaseModel* phase2 = &pair.phase2(); @@ -430,27 +417,17 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::momentumTransfer() const } // Update the drag coefficients - forAllConstIter - ( - dragModelTable, - dragModels_, - dragModelIter - ) + forAllConstIters(dragModels_, dragModelIter) { *Kds_[dragModelIter.key()] = dragModelIter()->K(); } // Add the implicit part of the drag force - forAllConstIter - ( - phaseSystem::KdTable, - Kds_, - KdIter - ) + forAllConstIters(Kds_, KdIter) { - const volScalarField& K(*KdIter()); + const phasePair& pair = *(this->phasePairs_[KdIter.key()]); - const phasePair& pair(this->phasePairs_[KdIter.key()]); + const volScalarField& K(*KdIter()); const phaseModel* phase = &pair.phase1(); const phaseModel* otherPhase = &pair.phase2(); @@ -466,27 +443,17 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::momentumTransfer() const } // Update the virtual mass coefficients - forAllConstIter - ( - virtualMassModelTable, - virtualMassModels_, - virtualMassModelIter - ) + forAllConstIters(virtualMassModels_, virtualMassModelIter) { *Vms_[virtualMassModelIter.key()] = virtualMassModelIter()->K(); } // Add the virtual mass force - forAllConstIter - ( - phaseSystem::VmTable, - Vms_, - VmIter - ) + forAllConstIters(Vms_, VmIter) { - const volScalarField& Vm(*VmIter()); + const phasePair& pair = *(this->phasePairs_[VmIter.key()]); - const phasePair& pair(this->phasePairs_[VmIter.key()]); + const volScalarField& Vm(*VmIter()); const phaseModel* phase = &pair.phase1(); const phaseModel* otherPhase = &pair.phase2(); @@ -557,33 +524,22 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::Fs() const PtrList<volVectorField>& Fs = tFs(); // Add the lift force - forAllConstIter - ( - liftModelTable, - liftModels_, - liftModelIter - ) + forAllConstIters(liftModels_, modelIter) { - const volVectorField F(liftModelIter()->F<vector>()); + const phasePair& pair = *(this->phasePairs_[modelIter.key()]); - const phasePair& pair(this->phasePairs_[liftModelIter.key()]); + const volVectorField F(modelIter()->template F<vector>()); setF(Fs, pair.phase1().index()) += F; setF(Fs, pair.phase2().index()) -= F; } // Add the wall lubrication force - forAllConstIter - ( - wallLubricationModelTable, - wallLubricationModels_, - wallLubricationModelIter - ) + forAllConstIters(wallLubricationModels_, modelIter) { - const volVectorField F(wallLubricationModelIter()->F<vector>()); + const phasePair& pair = *(this->phasePairs_[modelIter.key()]); - const phasePair& - pair(this->phasePairs_[wallLubricationModelIter.key()]); + const volVectorField F(modelIter()->template F<vector>()); setF(Fs, pair.phase1().index()) += F; setF(Fs, pair.phase2().index()) -= F; @@ -647,15 +603,10 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiDs PtrList<surfaceScalarField>& phiDs = tphiDs(); // Add the turbulent dispersion force - forAllConstIter - ( - turbulentDispersionModelTable, - turbulentDispersionModels_, - turbulentDispersionModelIter - ) + forAllConstIters(turbulentDispersionModels_, turbulentDispersionModelIter) { - const phasePair& - pair(this->phasePairs_[turbulentDispersionModelIter.key()]); + const phasePair& pair = + *(this->phasePairs_[turbulentDispersionModelIter.key()]); const volScalarField D(turbulentDispersionModelIter()->D()); const surfaceScalarField snGradAlpha1 diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C index a6dd838d235fa6ae89b11f3bd17aa4aacac90523..bb5c2462c34bf8827e6740096d5b678b7d2fee24 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<class BasePhaseSystem> const Foam::saturationModel& Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::saturation() const { - return saturationModel_(); + return *saturationModel_; } @@ -109,14 +104,9 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::heatTransfer() const phaseSystem::heatTransferTable& eqns = eqnsPtr(); // Accumulate mDotL contributions from boundaries - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -219,19 +209,15 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::massTransfer() const } } - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { continue; } + const phaseModel& phase = pair.phase1(); const phaseModel& otherPhase = pair.phase2(); @@ -292,14 +278,9 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::iDmdt ) ); - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -332,14 +313,9 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo() BasePhaseSystem::correctThermo(); - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C index 2afa388aca951c7c9a496765af7d099f4eab41d7..460e21ce8592a485757de290706869dd836d74ec 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<class BasePhaseModel> const Foam::phaseCompressibleTurbulenceModel& Foam::MovingPhaseModel<BasePhaseModel>::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 da10824230fabd22c7741cf1df2556930d4c4956..26be4e1bc7051ac6804949e9ec3a56f881bc5bbd 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> Foam::phaseModel::clone() const { NotImplemented; - return autoPtr<phaseModel>(nullptr); + return autoPtr<phaseModel>(); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C index 8f4bf7ee0fdc00c86742d1310530be340065b53d..768c905e1fff11705734501f206794b6f573cce8 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<modelType> noModel(nullptr); + autoPtr<modelType> 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 a164b73f26945ae542f625ae1f60609e7baab070..758c411968e0d19eaa4f2926205214cc4aef83c0 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 318379601500686e191cdd22b448a213e6358f76..db917c48659f3483213dd6a34c0ec9e2fb1df2b1 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<IATEsource> clone() const { NotImplemented; - return autoPtr<IATEsource>(nullptr); + return autoPtr<IATEsource>(); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.C index cc089e347e955c5e35b4608b4219a755614bba4e..289054982d922728f78e090203986cd763795231 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<modelType>::hasModel ) const { return - &phase == &(pair_.phase1()) + ( + &phase == &(pair_.phase1()) ? model1In2_.valid() - : model2In1_.valid(); + : model2In1_.valid() + ); } @@ -463,7 +465,7 @@ const modelType& Foam::BlendedInterfacialModel<modelType>::phaseModel const class phaseModel& phase ) const { - return &phase == &(pair_.phase1()) ? model1In2_ : model2In1_; + return &phase == &(pair_.phase1()) ? *model1In2_ : *model2In1_; } 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 c7655b9c342ce081f7d95bba98281e1122896a3b..29c150ce741b5aa0c8ded27270ff1813129b6053 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<IATEsource> clone() const { NotImplemented; - return autoPtr<IATEsource>(nullptr); + return autoPtr<IATEsource>(); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C index 9352b7239733692ed8e5bc2dce356996f764aeea..139826e885862d502bd02a847b8b1305ea42d57d 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::volScalarField> Foam::phaseModel::d() const Foam::PhaseCompressibleTurbulenceModel<Foam::phaseModel>& Foam::phaseModel::turbulence() { - return turbulence_(); + return *turbulence_; } const Foam::PhaseCompressibleTurbulenceModel<Foam::phaseModel>& Foam::phaseModel::turbulence() const { - return turbulence_(); + return *turbulence_; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H index 894907fe7cc109b7c352c4ac2daa1da54df8905f..f0c88afa1efb7cc9b2ce87f8695d5cce00475c98 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 5a99c32ae2d2c68083eb36eafe51519f50d0cf88..4750293fe81ced25d1c8d62fbf832ae839f286c0 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 fd97d416f90cc84dce2f47d4159d531987a75be4..8d9ef025c81e69e0dabdf41c96a8a5105e317600 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/createFields.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/createFields.H @@ -16,7 +16,7 @@ volVectorField D ); -autoPtr<volScalarField> Tptr(nullptr); +autoPtr<volScalarField> Tptr; if (thermalStress) { diff --git a/applications/test/autoPtr/Make/files b/applications/test/autoPtr/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..a89ae354187ffe5df177a8b3e2bb452f79bc33c5 --- /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 0000000000000000000000000000000000000000..3ed98294028302fbaac997d2688cc0c00ba0c382 --- /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 0000000000000000000000000000000000000000..edd7f222e828131002fd9d4e1c5d6828ed9760d2 --- /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 <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; +} + + +// ************************************************************************* // diff --git a/applications/test/fieldMapping/Test-fieldMapping.C b/applications/test/fieldMapping/Test-fieldMapping.C index a641819d7eab96593313c34aa94747fa7fff62d5..0ca3052e4cee6b219524d04966e79ea2612ba566 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<mapPolyMesh> morphMap = meshMod.changeMesh(mesh, inflate); Info<< "Mapping fields" << nl << endl; - mesh.updateMesh(morphMap); + mesh.updateMesh(morphMap()); // Move mesh (since morphing does not do this) if (morphMap().hasMotionPoints()) @@ -212,7 +212,7 @@ int main(int argc, char *argv[]) } // Update numbering of cells/vertices. - faceRemover.updateMesh(morphMap); + faceRemover.updateMesh(morphMap()); Info<< "Writing fields" << nl << endl; diff --git a/applications/test/hexRef8/Test-hexRef8.C b/applications/test/hexRef8/Test-hexRef8.C index 66a55fbafcb01f363d1e544811546ca886c40c2a..d34ff23c42379c831f865736bcf2c7cdbc719db5 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 f6bac7844acb0e28d0539777a71dd93f70c8d44a..6bd47c6bf7d9575117d4af47b1c71fd143fdb1b4 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<mapPolyMesh> map = meshMod.changeMesh(subsetter.subMesh(), false); + autoPtr<mapPolyMesh> mapPtr = + meshMod.changeMesh(subsetter.subMesh(), false); + mapPolyMesh& map = *mapPtr; // Update fields subsetter.subMesh().updateMesh(map); @@ -1231,9 +1233,9 @@ int main(int argc, char *argv[]) // Move mesh (since morphing might not do this) - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - subsetter.subMesh().movePoints(map().preMotionPoints()); + subsetter.subMesh().movePoints(map.preMotionPoints()); } Info<< "Writing mesh with split blockedFaces to time " << runTime.value() diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C index fa307d05e69b2bee53329e2294e8940ea6f352bb..f4d889d28ab332ce410728c3b0c331058db4088f 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 f1e32185406c2e44d547dcc8699ccc1619b77fd3..3423d698654de6cde2881cec057435437745af5b 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<mapPolyMesh> map = meshMod.changeMesh(mesh, false, true); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Move mesh (since morphing does not do this) if (map().hasMotionPoints()) diff --git a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C index 5b123d64e22d41fc1819ff84b56b7c2294177a5a..6901fcd8dab33e295a7faef2506b000b395af159 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<mapPolyMesh> map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Update numbering of cells/vertices. - meshCutter.updateMesh(map); + meshCutter.updateMesh(map()); // Optionally inflate mesh if (map().hasMotionPoints()) diff --git a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C index 2578a37e9b0c8e5c9870c66a423d2ac2e92ff1f7..bb78ffc827346f46d0727241f584f7e50b90431f 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<mapPolyMesh> morphMap = meshMod.changeMesh(mesh, false); + autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false); - mesh.updateMesh(morphMap); + mesh.updateMesh(map()); // Move mesh (since morphing does not do this) - if (morphMap().hasMotionPoints()) + if (map().hasMotionPoints()) { - mesh.movePoints(morphMap().preMotionPoints()); + mesh.movePoints(map().preMotionPoints()); } // Update numbering of cells/vertices. - faceRemover.updateMesh(morphMap); + faceRemover.updateMesh(map()); if (!overwrite) { diff --git a/applications/utilities/mesh/advanced/selectCells/selectCells.C b/applications/utilities/mesh/advanced/selectCells/selectCells.C index 8b4b2dcaf2c2fa42c627151ddf9c472cb8b4a785..fef71bbd874c269010d9a6afbc5e2ee33320d291 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<triSurface> surf(nullptr); - // Search engine on surface. - autoPtr<triSurfaceSearch> querySurf(nullptr); - if (useSurface) { - surf.reset(new triSurface(surfName)); + triSurface surf(surfName); // Dump some stats - surf().writeStats(Info); + surf.writeStats(Info); - // Search engine on surface. - querySurf.reset(new triSurfaceSearch(surf)); + triSurfaceSearch querySurf(surf); // Set cellType[celli] according to relation to surface cutBySurface diff --git a/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C b/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C index 8596ca8f9c87f69d5f283f996aa3a88ae30b41d1..98fa7d42a9f771e9cab21a218866eb94e35fa511 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 c3ffaf04f00e5fca35b6a4385a5fcfb6fbdada55..806ded99fb1c0c8361967c2fe850dc80aa5edfca 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<polyMesh> 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 6d9295dd931642473832d5904960a953f1914a2c..7d459ec82d91f8e3322c3643488f964c2a2d4104 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 9051a84db5a4d934f17a2a293b4d601d0607b9e9..f4bc4c55e88cf34dc487a701f3e7820055d61dec 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<mapPolyMesh> map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Move mesh (since morphing does not do this) if (map().hasMotionPoints()) @@ -788,7 +788,7 @@ int main(int argc, char *argv[]) ( layerExtrude.addedCells ( - meshFromMesh, + *meshFromMesh, layerExtrude.layerFaces() ) ); @@ -937,7 +937,7 @@ int main(int argc, char *argv[]) autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Update stored data updateFaceLabels(map(), frontPatchFaces); @@ -1074,7 +1074,7 @@ int main(int argc, char *argv[]) autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Update local data updateCellSet(map(), addedCellsSet); diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index db1b8c2480e7c7519a89d1dcdbdcdd78986a9124..869d54d80a147a87f2e0b2994855f2598da88dc3 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 d6d87e4c8fdadf60b383400cbb9398c67f7246fa..10fda1151cb10cc10e9e2d28912caa66fa2cf1da 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<mapPolyMesh> morphMap = meshMod().changeMesh(mesh(), false); - mesh().updateMesh(morphMap); + mesh().updateMesh(morphMap()); { edgeCollapser collapser(mesh()); @@ -302,7 +302,7 @@ int main(int argc, char *argv[]) autoPtr<mapPolyMesh> morphMap = meshModCollapse.changeMesh(mesh(), false); - mesh().updateMesh(morphMap); + mesh().updateMesh(morphMap()); } if (!overwrite) diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C index 97311eef3cbdefdb4f6412ac96b75545d673df35..c053ce9e7bbe53a66b8bd685865398bc5df0dc49 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<Triangulation>::DistributedDelaunayMesh {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Triangulation> -Foam::DistributedDelaunayMesh<Triangulation>::~DistributedDelaunayMesh() -{} - - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template<class Triangulation> @@ -491,7 +484,8 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices const label preDistributionSize = parallelVertices.size(); - mapDistribute pointMap = buildMap(targetProcessor); + autoPtr<mapDistribute> pointMapPtr = buildMap(targetProcessor); + mapDistribute& pointMap = *pointMapPtr; // Make a copy of the original list. DynamicList<Vb> originalParallelVertices(parallelVertices); diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H index 35b0859b53c1543ae3dc8c2e0af155a359a84f3b..07954827b8901e1b5fd3491bf5a0b05c537a7e86 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 25d9188e015a631bc73e514c8be59097ae35c593..210d027fe6261bc87678b0e977aacbbf368ed435 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<Foam::mapDistributePolyMesh> @@ -954,10 +948,10 @@ Foam::backgroundMeshDecomposition::distribute ); // Update fields - mesh_.updateMesh(map); + mesh_.updateMesh(map()); // Update numbering of cells/vertices. - meshCutter_.updateMesh(map); + meshCutter_.updateMesh(map()); Info<< " Background mesh refined from " << returnReduce(map().nOldCells(), sumOp<label>()) @@ -1000,7 +994,7 @@ Foam::backgroundMeshDecomposition::distribute autoPtr<mapDistributePolyMesh> mapDist = distributor.distribute(newDecomp); - meshCutter_.distribute(mapDist); + meshCutter_.distribute(mapDist()); if (debug) { diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H index aec8cce0c2ae8eb22c0f6dc1f765ed6f41161f49..864822e088a913aec056166d668ef93304220864 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H @@ -204,7 +204,7 @@ public: //- Destructor - ~backgroundMeshDecomposition(); + ~backgroundMeshDecomposition() = default; // Member Functions diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecompositionI.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecompositionI.H index b8dcb5187f151844e36013c14fa441a3da869fd1..34f25547c07fc0f0dc71a9cf61f5654fd5a79aa4 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecompositionI.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecompositionI.H @@ -34,7 +34,7 @@ const Foam::fvMesh& Foam::backgroundMeshDecomposition::mesh() const const Foam::indexedOctree<Foam::treeDataBPatch>& Foam::backgroundMeshDecomposition::tree() const { - return bFTreePtr_(); + return *bFTreePtr_; } diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index cc87adcb70269a011e9684212f3a3ae2cb628992..66759a3adafe1743d3888587d97f30070d4b7e3e 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -509,7 +509,7 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh() if (!distributeBackground(cellSizeMesh)) { // Synchronise the cell size mesh if it has not been distributed - cellSizeMesh.distribute(decomposition_); + cellSizeMesh.distribute(decomposition_()); } } @@ -531,7 +531,7 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh() if (Pstream::parRun()) { - cellSizeMesh.distribute(decomposition_); + cellSizeMesh.distribute(decomposition_()); } Info<< " Iteration " << i @@ -549,7 +549,7 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh() // Need to distribute the cell size mesh to cover the background mesh if (!distributeBackground(cellSizeMesh)) { - cellSizeMesh.distribute(decomposition_); + cellSizeMesh.distribute(decomposition_()); } } diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H index 7f458dbed698f865881b6d111dd7f6833781f0b9..3f6220b526a918f034f0eb47f9c775890026eec0 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H @@ -563,7 +563,7 @@ Foam::conformalVoronoiMesh::decomposition() const << exit(FatalError) << endl; } - return decomposition_(); + return *decomposition_; } diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshTemplates.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshTemplates.C index c4fdca83d8898689d7317834e5bb8f47d22940b4..3edd639318beb89d3db5017e50d9d743d012759f 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshTemplates.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshTemplates.C @@ -132,7 +132,7 @@ bool Foam::conformalVoronoiMesh::distributeBackground(const Triangulation& mesh) cellWeights ); - cellShapeControl_.shapeControlMesh().distribute(decomposition_); + cellShapeControl_.shapeControlMesh().distribute(decomposition_()); distribute(); diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.C index 48e45954fb76352910e1f3e50c51a5a952979984..7ffba4ad14c68d08ee57edf512fa0d732894d9b1 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.C @@ -113,10 +113,4 @@ Foam::autoPtr<Foam::initialPointsMethod> Foam::initialPointsMethod::New } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::initialPointsMethod::~initialPointsMethod() -{} - - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.H index 276526543b21401f2f15700b74f9039ad2e96b54..5c7a940996a567a048be5c1cd717612f99ae5954 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.H @@ -156,7 +156,7 @@ public: //- Destructor - virtual ~initialPointsMethod(); + virtual ~initialPointsMethod() = default; // Member Functions @@ -185,7 +185,7 @@ public: const backgroundMeshDecomposition& decomposition() const { - return decomposition_; + return *decomposition_; } //- Const access to the details dictionary diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchableSurfaceFeatures.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchableSurfaceFeatures.H index 3b7335d620549650189d3d04561fb27686f17c3b..fe1c509207a14b3f33ce468038c9cf9871ae59ed 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchableSurfaceFeatures.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchableSurfaceFeatures.H @@ -101,7 +101,7 @@ public: virtual autoPtr<searchableSurfaceFeatures> clone() const { NotImplemented; - return autoPtr<searchableSurfaceFeatures>(nullptr); + return autoPtr<searchableSurfaceFeatures>(); } diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C index 39e905bd314eef48e2fb1c309b546d583fcd62f6..c70356421752a16b2f1b1ed9c7649d8931ca696b 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C @@ -200,7 +200,7 @@ int main(int argc, char *argv[]) autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh(pMesh, false); - pMesh.updateMesh(morphMap); + pMesh.updateMesh(morphMap()); } } diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index e34823f1887444e86f54143302ba48fd89ecb87c..b645b090b02646b9abc222a5a1908d107cd403a7 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C @@ -544,7 +544,7 @@ Foam::label Foam::checkGeometry nonAlignedPoints.write(); if (setWriter.valid()) { - mergeAndWrite(setWriter, nonAlignedPoints); + mergeAndWrite(setWriter(), nonAlignedPoints); } } } @@ -786,7 +786,7 @@ Foam::label Foam::checkGeometry points.write(); if (setWriter.valid()) { - mergeAndWrite(setWriter, points); + mergeAndWrite(setWriter(), points); } } } @@ -809,7 +809,7 @@ Foam::label Foam::checkGeometry nearPoints.write(); if (setWriter.valid()) { - mergeAndWrite(setWriter, nearPoints); + mergeAndWrite(setWriter(), nearPoints); } } } diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C index a936fb993b4a2fd0507b20ab5b79e06e56d2275c..f5e94023f3bfdf2c498103a7b4ed0caa3789c775 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C @@ -225,7 +225,7 @@ Foam::label Foam::checkTopology points.write(); if (setWriter.valid()) { - mergeAndWrite(setWriter, points); + mergeAndWrite(setWriter(), points); } } } @@ -528,7 +528,7 @@ Foam::label Foam::checkTopology points.write(); if (setWriter.valid()) { - mergeAndWrite(setWriter, points); + mergeAndWrite(setWriter(), points); } } } @@ -639,7 +639,7 @@ Foam::label Foam::checkTopology points.write(); if (setWriter.valid()) { - mergeAndWrite(setWriter, points); + mergeAndWrite(setWriter(), points); } } diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index e7702b69ddc4f08ec8272c12d4aea0ed65372aed..9e3f2ca574abe6ce68b37c109d5c984af6fa99c9 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C @@ -824,14 +824,13 @@ int main(int argc, char *argv[]) autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); - + mesh.updateMesh(map()); // Correct boundary faces mapped-out-of-nothing. // This is just a hack to correct the value field. { - fvMeshMapper mapper(mesh, map); + fvMeshMapper mapper(mesh, map()); bool hasWarned = false; forAllConstIter(wordHashSet, bafflePatches, iter) diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.H b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.H index 41eb0b631544045df70e13b2354f360165d801a0..b17f016212c292fac95819d8ef3e82a8cb733f16 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.H +++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.H @@ -109,7 +109,7 @@ public: autoPtr<faceSelection> clone() const { NotImplemented; - return autoPtr<faceSelection>(nullptr); + return autoPtr<faceSelection>(); } diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.H b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.H index 10b7f377ed2feb89085bda2f212ff3cb94dd6492..20e7f66fe5db4a23ed8a82ef200ad6cbb8c545ac 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.H +++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.H @@ -86,7 +86,7 @@ public: autoPtr<faceSelection> clone() const { NotImplemented; - return autoPtr<faceSelection>(nullptr); + return autoPtr<faceSelection>(); } diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.H b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.H index 30262ef8a980362e94960047877c3bbb839f8cc0..8f934ae3c3f36ca04d542e903bf098c5b8179c25 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.H +++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.H @@ -79,7 +79,7 @@ public: autoPtr<faceSelection> clone() const { NotImplemented; - return autoPtr<faceSelection>(nullptr); + return autoPtr<faceSelection>(); } diff --git a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C index 5fbbae586f3f8f0b6751d87864e64858e6bd55c0..bd0522caa9e64c287119284815d0075ccd2f9d9f 100644 --- a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C +++ b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C @@ -450,7 +450,7 @@ int main(int argc, char *argv[]) autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Move mesh (since morphing does not do this) if (map().hasMotionPoints()) @@ -520,7 +520,7 @@ int main(int argc, char *argv[]) autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Move mesh (since morphing does not do this) if (map().hasMotionPoints()) diff --git a/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMeshApp.C b/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMeshApp.C index 0234ce16d7a453a62d44298b10b434d32b0f8b1e..bb4cd5d5ad7eb281b5c76ec75f10b3d3e40fc561 100644 --- a/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMeshApp.C +++ b/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMeshApp.C @@ -531,7 +531,7 @@ int main(int argc, char *argv[]) autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Optionally inflate mesh if (map().hasMotionPoints()) diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index f681501641ebd442731d6e1223e8a1e72a69206c..6ddc7cda15eaf8cf34c36bf34ac78c930b4629aa 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -1089,7 +1089,7 @@ int main(int argc, char *argv[]) // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Update proc maps if (cellProcAddressing.headerOk()) diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C index 6141bec908b28c592d04a7e5f6cc6e7ff5be7e89..18f5ab5b34a1ca497b13bebe0b26f9857377c029 100644 --- a/applications/utilities/mesh/manipulation/setSet/setSet.C +++ b/applications/utilities/mesh/manipulation/setSet/setSet.C @@ -472,7 +472,7 @@ bool doCommand setSource().applyToSet(topoSetSource::NEW, currentSet); // Combine new value of currentSet with old one. - currentSet.subset(oldSet); + currentSet.subset(oldSet()); } break; } @@ -814,7 +814,7 @@ int main(int argc, char *argv[]) // Main command read & execute loop // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - autoPtr<IFstream> fileStreamPtr(nullptr); + autoPtr<IFstream> fileStreamPtr; if (batch) { diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C index e42eecb04f1cdfdfd2108bee4ff2e824425ab767..1842fd24902349e526a044f05f98f1db4ab54963 100644 --- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C +++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C @@ -257,7 +257,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0) { - return autoPtr<mapPolyMesh>(nullptr); + return autoPtr<mapPolyMesh>(); } polyTopoChange meshMod(mesh); @@ -268,7 +268,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false, true); // Update fields. No inflation, parallel sync. - mesh.updateMesh(map); + mesh.updateMesh(map()); // pointProcAddressing give indices into the master mesh so adapt them // for changed point numbering. @@ -699,7 +699,7 @@ int main(int argc, char *argv[]) ( masterMesh[proci], meshToAdd, - couples + couples() ); // Added processor @@ -738,7 +738,7 @@ int main(int argc, char *argv[]) ( masterMesh[proci], masterMesh[next], - couples + couples() ); // Processors that were already in masterMesh diff --git a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C index 10c3ea80c5aa7f8b7fd9057fb5f3deebe674a965..ea1c13be715cbb2e1d98ec90e1108c60c327be5a 100644 --- a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C +++ b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C @@ -1810,18 +1810,20 @@ void reconstructLagrangian ); } const parLagrangianRedistributor& lagrangianReconstructor = - lagrangianReconstructorPtr(); + *lagrangianReconstructorPtr; for (const word& cloudName : cloudNames) { Info<< "Reconstructing lagrangian fields for cloud " << cloudName << nl << endl; - autoPtr<mapDistributeBase> lagrangianMap = + autoPtr<mapDistributeBase> lagrangianMapPtr = lagrangianReconstructor.redistributeLagrangianPositions ( cloudName ); + const mapDistributeBase& lagrangianMap = *lagrangianMapPtr; + IOobjectList sprayObjs ( mesh, @@ -2129,8 +2131,9 @@ void redistributeLagrangian forAll(clouds, i) { - autoPtr<mapDistributeBase> lagrangianMap = - distributor.redistributeLagrangianPositions(clouds[i]); + autoPtr<mapDistributeBase> lagrangianMapPtr = + distributor.redistributeLagrangianPositions(clouds[i]); + const mapDistributeBase& lagrangianMap = *lagrangianMapPtr; distributor.redistributeStoredLagrangianFields <IOField<label>> @@ -2694,7 +2697,7 @@ int main(int argc, char *argv[]) ( baseMeshPtr(), mesh, - distMap, + distMap(), Pstream::master() // do I need to write? ) ); @@ -2778,7 +2781,7 @@ int main(int argc, char *argv[]) ( baseMeshPtr(), mesh, - distMap, + distMap(), Pstream::master() ) ); @@ -2804,7 +2807,7 @@ int main(int argc, char *argv[]) lagrangianReconstructorPtr, baseMeshPtr(), mesh, - distMap, + distMap(), selectedLagrangianFields ); @@ -3012,7 +3015,7 @@ int main(int argc, char *argv[]) lagrangianReconstructorPtr, mesh, nOldCells, - distMap, + distMap(), clouds ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightOutputCloudTemplates.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightOutputCloudTemplates.C index 04fd865c2cac7e4a4fbc6684bbb3f3fa4f924cd5..fb318c062d30040fa942b883fb763df82256e97b 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightOutputCloudTemplates.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightOutputCloudTemplates.C @@ -142,7 +142,7 @@ bool Foam::ensightCloud::writeCloudField IOField<Type> field(fieldObject); fieldObject.readOpt() = rOpt; - writeCloudField(field, output.rawRef()); + writeCloudField(field, output.ref()); } return true; diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputSerialCloudTemplates.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputSerialCloudTemplates.C index 42034d0a1e8420ff989702f5b549e68fffbad114..060e139b7a0e95576dbff9593fcf2973051171a7 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputSerialCloudTemplates.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputSerialCloudTemplates.C @@ -83,7 +83,7 @@ bool Foam::ensightSerialCloud::writeCloudField ) { IOField<Type> field(fieldObject); - return writeCloudField(field, output.rawRef()); + return writeCloudField(field, output.ref()); } diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C index 7722eedbabb05bc3c122c3f50becb208c5f0c64c..f21a8dc5c72d9ebeecf836c4191a51e11a1a1c9a 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C @@ -269,7 +269,7 @@ int main(int argc, char *argv[]) if (!optNoMesh) { autoPtr<ensightGeoFile> os = ensCase.newGeometry(meshMoving); - partsList.write(os.rawRef()); + partsList.write(os.ref()); } } diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamVtkLagrangianWriter.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamVtkLagrangianWriter.H index 5e6d2fc9c7b54239b9ef29bc3b1d2848eb7f3d02..bbfbb6e4db17bf0a316ea1801b1a8c690591722b 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamVtkLagrangianWriter.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamVtkLagrangianWriter.H @@ -127,7 +127,7 @@ public: inline vtk::formatter& format() { - return format_(); + return *format_; } inline label nParcels() const diff --git a/applications/utilities/postProcessing/miscellaneous/pdfPlot/createFields.H b/applications/utilities/postProcessing/miscellaneous/pdfPlot/createFields.H index 860d7c2eb9a93537bdbe608befd8f6390be94671..9c663017f511fcd48097f1fbbb81cd7a545fafb2 100644 --- a/applications/utilities/postProcessing/miscellaneous/pdfPlot/createFields.H +++ b/applications/utilities/postProcessing/miscellaneous/pdfPlot/createFields.H @@ -34,7 +34,7 @@ const scalar xMin = p->minValue(); const scalar xMax = p->maxValue(); - autoPtr<OFstream> filePtr(nullptr); + autoPtr<OFstream> filePtr; if (writeData) { fileName fName = pdfPath/(p->type() + ".data"); diff --git a/applications/utilities/surface/surfacePatch/searchableSurfaceModifier/autoPatch.H b/applications/utilities/surface/surfacePatch/searchableSurfaceModifier/autoPatch.H index c50c6ebb1124d329e55bdd02f31b3b4beb96c9a8..40d23bbb9632cd85b7d83436c9a38fe4518af1b1 100644 --- a/applications/utilities/surface/surfacePatch/searchableSurfaceModifier/autoPatch.H +++ b/applications/utilities/surface/surfacePatch/searchableSurfaceModifier/autoPatch.H @@ -76,7 +76,7 @@ public: autoPtr<searchableSurfaceModifier> clone() const { NotImplemented; - return autoPtr<searchableSurfaceModifier>(nullptr); + return autoPtr<searchableSurfaceModifier>(); } diff --git a/applications/utilities/surface/surfacePatch/searchableSurfaceModifier/cut.H b/applications/utilities/surface/surfacePatch/searchableSurfaceModifier/cut.H index 413e69b935aab185bf9bad7245ca8daa8a8c6ef8..1024e5e44b0ff91d5cc1766a03f1b7ceedfa3a46 100644 --- a/applications/utilities/surface/surfacePatch/searchableSurfaceModifier/cut.H +++ b/applications/utilities/surface/surfacePatch/searchableSurfaceModifier/cut.H @@ -100,7 +100,7 @@ public: autoPtr<searchableSurfaceModifier> clone() const { NotImplemented; - return autoPtr<searchableSurfaceModifier>(nullptr); + return autoPtr<searchableSurfaceModifier>(); } diff --git a/applications/utilities/surface/surfacePatch/searchableSurfaceModifier/searchableSurfaceModifier.H b/applications/utilities/surface/surfacePatch/searchableSurfaceModifier/searchableSurfaceModifier.H index b8329f366cd4ace283bc2935a8ffd2261f0bffb4..897bad68a0fc2ee09a7ab4bb40d014984622b305 100644 --- a/applications/utilities/surface/surfacePatch/searchableSurfaceModifier/searchableSurfaceModifier.H +++ b/applications/utilities/surface/surfacePatch/searchableSurfaceModifier/searchableSurfaceModifier.H @@ -96,7 +96,7 @@ public: autoPtr<searchableSurfaceModifier> clone() const { NotImplemented; - return autoPtr<searchableSurfaceModifier>(nullptr); + return autoPtr<searchableSurfaceModifier>(); } diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C index 20475acead2cfbedc82e85d2a72d74c71b354fc5..b1909bc78aa1dab60395fd73516f9aa67ad9b764 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C @@ -220,7 +220,7 @@ Foam::dynamicIndexedOctree<Type>::divide { if (!replaced) { - contents_[contentI]().transfer(subIndices()); + contents_[contentI]->transfer(subIndices()); nod.subNodes_[octant] = contentPlusOctant(contentI, octant); replaced = true; @@ -239,7 +239,7 @@ Foam::dynamicIndexedOctree<Type>::divide ) ); - contents_[sz]().transfer(subIndices()); + contents_[sz]->transfer(subIndices()); nod.subNodes_[octant] = contentPlusOctant(sz, octant); } @@ -280,7 +280,7 @@ void Foam::dynamicIndexedOctree<Type>::recursiveSubDivision { if ( - contents_[contentI]().size() > minSize_ + contents_[contentI]->size() > minSize_ && nLevels < maxLevels_ ) { @@ -524,7 +524,7 @@ void Foam::dynamicIndexedOctree<Type>::findNearest { shapes_.findNearest ( - contents_[getContent(index)], + *(contents_[getContent(index)]), sample, nearestDistSqr, @@ -589,7 +589,7 @@ void Foam::dynamicIndexedOctree<Type>::findNearest { shapes_.findNearest ( - contents_[getContent(index)], + *(contents_[getContent(index)]), ln, tightest, @@ -1341,7 +1341,7 @@ void Foam::dynamicIndexedOctree<Type>::traverseNode if (isContent(index)) { - const labelList& indices = contents_[getContent(index)]; + const labelList& indices = *(contents_[getContent(index)]); if (indices.size()) { @@ -1755,7 +1755,7 @@ void Foam::dynamicIndexedOctree<Type>::findBox if (subBb.overlaps(searchBox)) { - const labelList& indices = contents_[getContent(index)]; + const labelList& indices = *(contents_[getContent(index)]); forAll(indices, i) { @@ -1803,7 +1803,7 @@ void Foam::dynamicIndexedOctree<Type>::findSphere if (subBb.overlaps(centre, radiusSqr)) { - const labelList& indices = contents_[getContent(index)]; + const labelList& indices = *(contents_[getContent(index)]); forAll(indices, i) { @@ -2016,7 +2016,7 @@ Foam::label Foam::dynamicIndexedOctree<Type>::countElements } else if (isContent(index)) { - nElems += contents_[getContent(index)]().size(); + nElems += contents_[getContent(index)]->size(); } else { @@ -2302,7 +2302,7 @@ Foam::label Foam::dynamicIndexedOctree<Type>::findInside // Need to check for the presence of content, in-case the node is empty if (isContent(contentIndex)) { - labelList indices = contents_[getContent(contentIndex)]; + const labelList& indices = *(contents_[getContent(contentIndex)]); forAll(indices, elemI) { @@ -2334,12 +2334,10 @@ const Foam::labelList& Foam::dynamicIndexedOctree<Type>::findIndices // Need to check for the presence of content, in-case the node is empty if (isContent(contentIndex)) { - return contents_[getContent(contentIndex)]; - } - else - { - return emptyList<label>(); + return *(contents_[getContent(contentIndex)]); } + + return emptyList<label>(); } @@ -2454,7 +2452,7 @@ bool Foam::dynamicIndexedOctree<Type>::insert(label startIndex, label endIndex) ) ); - contents_[0]().append(0); + contents_[0]->append(0); // Create topnode. node topNode = divide(bb_, 0, -1, 0); @@ -2518,7 +2516,7 @@ bool Foam::dynamicIndexedOctree<Type>::insertIndex { const label contentI = getContent(subNodeLabel); - contents_[contentI]().append(index); + contents_[contentI]->append(index); recursiveSubDivision ( @@ -2545,7 +2543,7 @@ bool Foam::dynamicIndexedOctree<Type>::insertIndex autoPtr<DynamicList<label>>(new DynamicList<label>(1)) ); - contents_[sz]().append(index); + contents_[sz]->append(index); nodes_[nodIndex].subNodes_[octant] = contentPlusOctant(sz, octant); @@ -2618,7 +2616,7 @@ Foam::label Foam::dynamicIndexedOctree<Type>::removeIndex if (shapes().overlaps(index, subBb)) { - DynamicList<label>& contentList = contents_[contentI](); + DynamicList<label>& contentList = *(contents_[contentI]); DynamicList<label> newContent(contentList.size()); @@ -2644,7 +2642,7 @@ Foam::label Foam::dynamicIndexedOctree<Type>::removeIndex contentList.transfer(newContent); } - totalContents += contents_[contentI]().size(); + totalContents += contents_[contentI]->size(); } else { @@ -2695,7 +2693,7 @@ void Foam::dynamicIndexedOctree<Type>::print } else if (isContent(index)) { - const labelList& indices = contents_[getContent(index)]; + const labelList& indices = *(contents_[getContent(index)]); if (false) //debug) { @@ -2735,7 +2733,7 @@ void Foam::dynamicIndexedOctree<Type>::writeTreeInfo() const label nEntries = 0; forAll(contents_, i) { - nEntries += contents_[i]().size(); + nEntries += contents_[i]->size(); } Pout<< "indexedOctree<Type>::indexedOctree" diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H index 8017a943fb5945fd81a4ea992e4ba48647d0024b..c76391fe06da997a4230ed655f920ef83bf38f0f 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H @@ -50,7 +50,7 @@ SourceFiles namespace Foam { -typedef DynamicList<autoPtr<DynamicList<label >>> contentListList; +typedef DynamicList<autoPtr<DynamicList<label>>> contentListList; // Forward declaration of classes template<class Type> class dynamicIndexedOctree; diff --git a/src/OpenFOAM/db/IOobjects/decomposedBlockData/decomposedBlockData.C b/src/OpenFOAM/db/IOobjects/decomposedBlockData/decomposedBlockData.C index 6d315cd7a6b6cdcc475261ee873f95d258385b55..1604a31e5763d6ecdc306f33d9bab794e900d6ec 100644 --- a/src/OpenFOAM/db/IOobjects/decomposedBlockData/decomposedBlockData.C +++ b/src/OpenFOAM/db/IOobjects/decomposedBlockData/decomposedBlockData.C @@ -262,12 +262,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlock is.fatalCheck("read(Istream&) : reading entry"); string buf(data.begin(), data.size()); - realIsPtr = new IStringStream + realIsPtr.reset ( - buf, - IOstream::ASCII, - IOstream::currentVersion, - is.name() + new IStringStream + ( + buf, + IOstream::ASCII, + IOstream::currentVersion, + is.name() + ) ); // Read header @@ -314,12 +317,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlock is.fatalCheck("read(Istream&) : reading entry"); } string buf(data.begin(), data.size()); - realIsPtr = new IStringStream + realIsPtr.reset ( - buf, - IOstream::ASCII, - IOstream::currentVersion, - is.name() + new IStringStream + ( + buf, + IOstream::ASCII, + IOstream::currentVersion, + is.name() + ) ); // Apply master stream settings to realIsPtr @@ -484,12 +490,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks is.fatalCheck("read(Istream&) : reading entry"); string buf(data.begin(), data.size()); - realIsPtr = new IStringStream + realIsPtr.reset ( - buf, - IOstream::ASCII, - IOstream::currentVersion, - fName + new IStringStream + ( + buf, + IOstream::ASCII, + IOstream::currentVersion, + fName + ) ); // Read header @@ -538,12 +547,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks is >> data; string buf(data.begin(), data.size()); - realIsPtr = new IStringStream + realIsPtr.reset ( - buf, - IOstream::ASCII, - IOstream::currentVersion, - fName + new IStringStream + ( + buf, + IOstream::ASCII, + IOstream::currentVersion, + fName + ) ); } } @@ -567,12 +579,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks is.fatalCheck("read(Istream&) : reading entry"); string buf(data.begin(), data.size()); - realIsPtr = new IStringStream + realIsPtr.reset ( - buf, - IOstream::ASCII, - IOstream::currentVersion, - fName + new IStringStream + ( + buf, + IOstream::ASCII, + IOstream::currentVersion, + fName + ) ); // Read header @@ -611,12 +626,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks is >> data; string buf(data.begin(), data.size()); - realIsPtr = new IStringStream + realIsPtr.reset ( - buf, - IOstream::ASCII, - IOstream::currentVersion, - fName + new IStringStream + ( + buf, + IOstream::ASCII, + IOstream::currentVersion, + fName + ) ); } } diff --git a/src/OpenFOAM/db/IOstreams/token/token.C b/src/OpenFOAM/db/IOstreams/token/token.C index c082df43cc9352d22daa616aa202f9fcf3f5a5e5..dbe34e6aa0dfcb90888283a78ebdda15e4ec4db1 100644 --- a/src/OpenFOAM/db/IOstreams/token/token.C +++ b/src/OpenFOAM/db/IOstreams/token/token.C @@ -48,12 +48,6 @@ void Foam::token::parseError(const char* expected) const } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::token::compound::~compound() -{} - - // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // Foam::autoPtr<Foam::token::compound> Foam::token::compound::New diff --git a/src/OpenFOAM/db/IOstreams/token/token.H b/src/OpenFOAM/db/IOstreams/token/token.H index 868019ba3afc025a3481d42447ddb58db5a297fe..ad3c39c4024f567cb7fbf7f89fe33dd2b2b70d33 100644 --- a/src/OpenFOAM/db/IOstreams/token/token.H +++ b/src/OpenFOAM/db/IOstreams/token/token.H @@ -143,9 +143,13 @@ public: : public refCount { - // Private data + bool empty_; - bool empty_; + //- No default copy construct + compound(const compound&) = delete; + + //- No default assign operator + compound& operator=(const compound&) = delete; public: @@ -171,25 +175,22 @@ public: empty_(false) {} - //- No default copy construct - compound(const compound&) = delete; - // Selectors //- Select null constructed static autoPtr<compound> New(const word& type, Istream& is); + //- Return true if name is a known (registered) compound type + static bool isCompound(const word& name); + //- Destructor - virtual ~compound(); + virtual ~compound() = default; // Member Functions - //- Return true if name is a known compound type - static bool isCompound(const word& name); - bool empty() const { return empty_; @@ -207,9 +208,6 @@ public: // Operators - //- No default assign operator - compound& operator=(const compound&) = delete; - //- Output operator friend Ostream& operator<<(Ostream& os, const compound& ct); }; diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index 16b78f40c3ebe08480d6a4bc7920ae29106a7290..608e835a0d1d3f6bd05a77923a7d61b6e1461abf 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.H @@ -466,7 +466,7 @@ public: //- Return previous TimeState if time is being sub-cycled const TimeState& prevTimeState() const { - return prevTimeState_(); + return *prevTimeState_; } diff --git a/src/OpenFOAM/db/dictionary/entry/entryIO.C b/src/OpenFOAM/db/dictionary/entry/entryIO.C index b1fb4b92baad4c17ffa7b9c56cce5da792ce39b8..aea73192715df5db2b363efbeb8de1cd13bcb004 100644 --- a/src/OpenFOAM/db/dictionary/entry/entryIO.C +++ b/src/OpenFOAM/db/dictionary/entry/entryIO.C @@ -437,7 +437,7 @@ Foam::autoPtr<Foam::entry> Foam::entry::New(Istream& is) { is.fatalCheck(FUNCTION_NAME); - autoPtr<entry> ptr(nullptr); + autoPtr<entry> ptr; // Get the next keyword and if invalid return false keyType keyword; diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H index 3f47feba8c4537e65248ed233827c9b498d78359..825b562af7542deda5e4b35e6a333a1b680c4992 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H @@ -197,7 +197,7 @@ public: autoPtr<functionObject> clone() const { NotImplemented; - return autoPtr<functionObject>(nullptr); + return autoPtr<functionObject>(); } diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index d6ec115a0f4a08414292952a682aa3a7ad2276ce..76ee09ff27f1192209658edb48cb36e0b1ce78ae 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -483,7 +483,7 @@ Foam::IOdictionary& Foam::functionObjectList::stateDict() createStateDict(); } - return stateDictPtr_(); + return *stateDictPtr_; } @@ -494,7 +494,7 @@ const Foam::IOdictionary& Foam::functionObjectList::stateDict() const createStateDict(); } - return stateDictPtr_(); + return *stateDictPtr_; } diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObjectI.H b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObjectI.H index e759243b5c5fa91b5c1efa9fa502037ec40e4c16..7fddc48b550d568f756912cbf4d9e5025c031445 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObjectI.H +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObjectI.H @@ -54,7 +54,7 @@ Foam::functionObjects::timeControl::writeControl() const inline const Foam::functionObject& Foam::functionObjects::timeControl::filter() const { - return foPtr_(); + return *foPtr_; } diff --git a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C index a4156499a89177a55ada004603297719798dbcab..9c8e6f405632019ac83423264254abbcabbb94e4 100644 --- a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C +++ b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C @@ -214,7 +214,7 @@ Foam::OFstream& Foam::functionObjects::writeFile::file() << "File pointer not allocated"; } - return filePtr_(); + return *filePtr_; } diff --git a/src/OpenFOAM/db/regIOobject/regIOobjectRead.C b/src/OpenFOAM/db/regIOobject/regIOobjectRead.C index 2bd29561b5120dcdb4cf309cd9d9fa59b7b6e93f..bdabea535250234e7abee730999c06e6e936c55c 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobjectRead.C +++ b/src/OpenFOAM/db/regIOobject/regIOobjectRead.C @@ -131,7 +131,7 @@ Foam::Istream& Foam::regIOobject::readStream(const bool valid) isPtr_ = fileHandler().readStream(*this, objPath, type(), valid); } - return isPtr_(); + return *isPtr_; } @@ -174,7 +174,7 @@ Foam::Istream& Foam::regIOobject::readStream } } - return isPtr_(); + return *isPtr_; } diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C index df0062d38a3d2245117f05cf79b3b22d8e207363..755ca039672ac5abebefe2f87f4a5f6deaeed1e0 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C @@ -285,7 +285,7 @@ Foam::codedFixedValuePointPatchField<Type>::redirectPatchField() const ).ptr() ); } - return redirectPatchFieldPtr_(); + return *redirectPatchFieldPtr_; } diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/uniformFixedValue/uniformFixedValuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/derived/uniformFixedValue/uniformFixedValuePointPatchField.C index cd0b7ec418d04a28c9f9f3265ad3eb6da118ba67..a68d0e82d0716ad4bdcc6bc7e47ff6f41a6b46bf 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/uniformFixedValue/uniformFixedValuePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/derived/uniformFixedValue/uniformFixedValuePointPatchField.C @@ -78,7 +78,7 @@ uniformFixedValuePointPatchField ) : fixedValuePointPatchField<Type>(ptf, p, iF, mapper), - uniformValue_(ptf.uniformValue_, false) + uniformValue_(ptf.uniformValue_.clone()) { // For safety re-evaluate const scalar t = this->db().time().timeOutputValue(); @@ -94,7 +94,7 @@ uniformFixedValuePointPatchField ) : fixedValuePointPatchField<Type>(ptf), - uniformValue_(ptf.uniformValue_, false) + uniformValue_(ptf.uniformValue_.clone()) {} @@ -107,7 +107,7 @@ uniformFixedValuePointPatchField ) : fixedValuePointPatchField<Type>(ptf, iF), - uniformValue_(ptf.uniformValue_, false) + uniformValue_(ptf.uniformValue_.clone()) { // For safety re-evaluate const scalar t = this->db().time().timeOutputValue(); diff --git a/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C b/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C index a21c334ff56a30efd8ffedbff7fd13456da3b9b8..3da0f018a0a1c5bb3d0fa54a5ba58cdd1cc0d8ca 100644 --- a/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C +++ b/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C @@ -74,7 +74,7 @@ Foam::fileMonitor& Foam::fileOperation::monitor() const ) ); } - return monitorPtr_(); + return *monitorPtr_; } @@ -597,7 +597,8 @@ const Foam::fileOperation& Foam::fileHandler() fileOperation::fileHandlerPtr_ = fileOperation::New(handler, true); } - return fileOperation::fileHandlerPtr_(); + + return *fileOperation::fileHandlerPtr_; } @@ -618,7 +619,7 @@ void Foam::fileHandler(autoPtr<fileOperation>& newHandlerPtr) if (newHandlerPtr.valid()) { - fileOperation::fileHandlerPtr_ = newHandlerPtr; + fileOperation::fileHandlerPtr_ = std::move(newHandlerPtr); } } diff --git a/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H b/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H index 7f99e76a9f2f5424bf0e70a280caae2d46744b19..4026e203bdff866d97ef26be25b058c29e48bafb 100644 --- a/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H +++ b/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H @@ -93,7 +93,7 @@ public: autoPtr<procLduInterface> clone() { NotImplemented; - return autoPtr<procLduInterface>(nullptr); + return autoPtr<procLduInterface>(); } static autoPtr<procLduInterface> New(Istream& is) diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C index 2d85cca0ae013ed04aca1f77c4ffabfe4e717e98..4fd508c6bfccaf4f8138407e7472d294f130e61d 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C @@ -139,7 +139,7 @@ Foam::lduMatrix::preconditioner::New "no diagonal or off-diagonal coefficient" << exit(FatalIOError); - return autoPtr<lduMatrix::preconditioner>(nullptr); + return autoPtr<lduMatrix::preconditioner>(); } } diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C index 0edeea6a9cbb285bd411f395c8cd4a42212d8b3f..71c9475d396b9ab4e59a67fdf13bbe8a66a88a60 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C @@ -143,7 +143,7 @@ Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New "no diagonal or off-diagonal coefficient" << exit(FatalIOError); - return autoPtr<lduMatrix::smoother>(nullptr); + return autoPtr<lduMatrix::smoother>(); } } diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C index 0bcd04bf4ee71dc1316a569f7b83a6d31248638f..38e10b12e52962171f4870be59eef5b14bc9ac83 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C @@ -123,7 +123,7 @@ Foam::autoPtr<Foam::lduMatrix::solver> Foam::lduMatrix::solver::New "no diagonal or off-diagonal coefficient" << exit(FatalIOError); - return autoPtr<lduMatrix::solver>(nullptr); + return autoPtr<lduMatrix::solver>(); } } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C index ee20d9b461ba4e1397c45232e9517e3904641b3e..d3b63e7b9d7c0f60537a9b39667db9f7316fe055 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C @@ -252,7 +252,7 @@ Foam::GAMGAgglomeration::GAMGAgglomeration *this, controlDict ) - : autoPtr<GAMGProcAgglomeration>(nullptr) + : autoPtr<GAMGProcAgglomeration>() ), nCells_(maxLevels_), diff --git a/src/OpenFOAM/memory/autoPtr/autoPtr.H b/src/OpenFOAM/memory/autoPtr/autoPtr.H index 78c8651d4820f0fd80dc7a2e384c0453573bcd57..a46ba0d0d1d0aba0120994526d7666dae4f39efb 100644 --- a/src/OpenFOAM/memory/autoPtr/autoPtr.H +++ b/src/OpenFOAM/memory/autoPtr/autoPtr.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -25,8 +25,15 @@ Class Foam::autoPtr Description - An auto-pointer similar to the STL auto_ptr but with automatic casting - to a reference to the type and with pointer allocation checking on access. + Pointer management similar to std::unique_ptr, with some additional + methods and type checking. + +Note + Parts of the interface now mirror std::unique_ptr, but since it pre-dates + both C++11 and std::unique_ptr, it has some additional idiosyncrasies. + The const-reference constructors and assignment operators + actually use move semantics to allow their participation in + default constructible, default assignable classes. SourceFiles autoPtrI.H @@ -36,6 +43,13 @@ SourceFiles #ifndef autoPtr_H #define autoPtr_H +// Transitional features/misfeatures: +#define Foam_autoPtr_copyConstruct +#define Foam_autoPtr_copyAssign +#define Foam_autoPtr_castOperator + +#include <utility> + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -48,114 +62,217 @@ namespace Foam template<class T> class autoPtr { - // Public data - - //- Pointer to object - mutable T* ptr_; + //- Pointer to managed object + T* ptr_; public: - typedef T Type; + // STL type definitions + + //- Type of object being managed + typedef T element_type; + + //- Pointer to type of object being managed + typedef T* pointer; + + + // Factory Methods + + //- Construct autoPtr of T with forwarding arguments + // \param args list of arguments with which an instance of T + // will be constructed. + // + // \note Similar to std::make_unique, but the overload for + // array types is not disabled. + template<class... Args> + inline static autoPtr<T> New(Args&&... args); + + //- Construct autoPtr from derived type with forwarding arguments + // \param args list of arguments with which an instance of U + // will be constructed. + // + // \note Similar to New but for derived types. + // In the future check for is_convertible on the pointer types + template<class U, class... Args> + inline static autoPtr<T> NewFrom(Args&&... args); // Constructors - //- Construct null with nullptr - inline explicit autoPtr(); + //- Construct with no managed object. + inline constexpr autoPtr() noexcept; + + //- Construct with no managed object (literal nullptr). + inline constexpr autoPtr(std::nullptr_t) noexcept; + + //- Construct, taking ownership of the pointer. + inline explicit autoPtr(T* p) noexcept; - //- Store object pointer - inline explicit autoPtr(T* p); + //- Move construct, transferring ownership. + inline autoPtr(autoPtr<T>&& ap) noexcept; - //- Construct as copy by transferring pointer to this autoPtr and - //- setting the arguments pointer to nullptr - inline autoPtr(const autoPtr<T>& ap); + //- 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); - //- Construct either by transferring pointer or cloning. - // Should only be called with type that supports cloning - inline autoPtr(const autoPtr<T>& ap, const bool reuse); + //- A move construct disguised as a copy construct (transfers ownership) + // \remark This is a non-standard definition, and should ideally be + // marked as deleted - pending cleanup of code currently relying + // on this behaviour. + #ifdef Foam_autoPtr_copyConstruct + inline autoPtr(const autoPtr<T>& ap) noexcept; + #else + autoPtr(const autoPtr<T>& ap) = delete; + #endif - //- Destructor, delete object if pointer is not nullptr - inline ~autoPtr(); + //- Destructs the managed object if such is present + inline ~autoPtr() noexcept; // Member Functions - // Check + // Check + + //- True if the managed pointer is null + inline bool empty() const noexcept; + + //- True if the managed pointer is non-null + inline bool valid() const noexcept; + - //- Return true if the autoPtr is empty (ie, no pointer set) - inline bool empty() const; + // Access - //- Return true if the autoPtr valid (ie, the pointer is set) - inline bool valid() const; + //- Return pointer to managed object without nullptr checking. + // Pointer remains under autoPtr management. + inline T* get() noexcept; + //- Return const pointer to managed object without nullptr checking. + // Pointer remains under autoPtr management. + inline const T* get() const noexcept; - // Edit + //- Return reference to the managed object without nullptr checking. + // When get() == nullptr, additional guards may be required to avoid + // inadvertent access to a nullptr. + inline T& ref(); - //- Release ownership of the object pointer and return the pointer - inline T* ptr(); - //- Set pointer to that given. - // If object pointer already set issue a FatalError - inline void set(T* p); + // Edit - //- If object pointer already set, delete object and set to given - //- pointer - inline void reset(T* p = nullptr); + //- Return pointer to the managed object and release ownership. + inline T* release() noexcept; - //- Delete object (if the pointer is valid) - //- and set pointer to nullptr - inline void clear(); + //- Return pointer to the managed object and release ownership. + //- Identical behaviour to release(). + // \note Provided for method naming consistent with Foam::tmp + inline T* ptr() noexcept; + //- Delete managed object and set pointer to nullptr + inline void clear() noexcept; - // Access + //- Delete managed object and set to new given pointer + inline void reset(T* p = nullptr) noexcept; - //- Return the pointer, without nullptr checking. - // Pointer remains under autoPtr management. - inline T* rawPtr(); + //- 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; - //- Const access to the pointer, without nullptr checking. - // Pointer remains under autoPtr management. - inline const T* rawPtr() const; + //- 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; - //- Return the reference, without nullptr checking. - inline T& rawRef(); + //- Swaps the managed object with other autoPtr. + inline void swap(autoPtr<T>& other) noexcept; - //- Return the const reference, without nullptr checking. - inline const T& rawRef() const; + // Other - // Member operators + //- Construct copy by invoking clone on underlying managed object + // \param args list of arguments for clone + template<class... Args> + inline autoPtr<T> clone(Args&&... args) const; - //- Return reference to the object data. - // Fatal if no pointer is allocated. - inline T& operator()(); - //- Return const reference to the object data - // Fatal if no pointer is allocated. - inline const T& operator()() const; + // Member Operators - //- Const cast to the underlying type reference - // Fatal if no pointer is allocated. - inline operator const T&() const; + //- Return reference to the managed object. + // Fatal error if no pointer is managed + inline T& operator*(); - //- Dereferences (non-const) pointer to the managed object - // Fatal if no pointer is allocated. - inline T* operator->(); + //- Return const reference to the object. + // Fatal error if no pointer is managed + inline const T& operator*() const; - //- Dereferences (const) pointer to the managed object - // Fatal if no pointer is allocated. - inline const T* operator->() const; + //- Dereferences (non-const) pointer to the managed object + // Fatal error if no pointer is managed + inline T* operator->(); - //- Take over the object pointer from parameter - inline void operator=(T* p); + //- Dereferences (const) pointer to the managed object + // Fatal error if no pointer is managed + inline const T* operator->() const; - //- Take over the object pointer from parameter - inline void operator=(const autoPtr<T>& ap); + //- 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 diff --git a/src/OpenFOAM/memory/autoPtr/autoPtrI.H b/src/OpenFOAM/memory/autoPtr/autoPtrI.H index a09209caa9ce28d05fcc969aa0cdaeffe46a2ff0..128fabe5abda13938fbd5ff922617682ae07700c 100644 --- a/src/OpenFOAM/memory/autoPtr/autoPtrI.H +++ b/src/OpenFOAM/memory/autoPtr/autoPtrI.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -26,180 +26,203 @@ License #include "error.H" #include <typeinfo> +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +template<class T> +template<class... Args> +inline Foam::autoPtr<T> Foam::autoPtr<T>::New(Args&&... args) +{ + return autoPtr<T>(new T(std::forward<Args>(args)...)); +} + + +template<class T> +template<class U, class... Args> +inline Foam::autoPtr<T> Foam::autoPtr<T>::NewFrom(Args&&... args) +{ + return autoPtr<T>(new U(std::forward<Args>(args)...)); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class T> -inline Foam::autoPtr<T>::autoPtr() +inline constexpr Foam::autoPtr<T>::autoPtr() noexcept +: + ptr_(nullptr) +{} + + +template<class T> +inline constexpr Foam::autoPtr<T>::autoPtr(std::nullptr_t) noexcept : ptr_(nullptr) {} template<class T> -inline Foam::autoPtr<T>::autoPtr(T* p) +inline Foam::autoPtr<T>::autoPtr(T* p) noexcept : ptr_(p) {} template<class T> -inline Foam::autoPtr<T>::autoPtr(const autoPtr<T>& ap) +inline Foam::autoPtr<T>::autoPtr(autoPtr<T>&& ap) noexcept : - ptr_(ap.ptr_) -{ - ap.ptr_ = nullptr; -} + ptr_(ap.release()) +{} template<class T> -inline Foam::autoPtr<T>::autoPtr(const autoPtr<T>& ap, const bool reuse) -{ - if (reuse) - { - ptr_ = ap.ptr_; - ap.ptr_ = nullptr; - } - else if (ap.valid()) - { - ptr_ = ap().clone().ptr(); - } - else - { - ptr_ = nullptr; - } -} +template<class U> +inline Foam::autoPtr<T>::autoPtr(autoPtr<U>&& ap) +: + ptr_(ap.release()) +{} + + +#ifdef Foam_autoPtr_copyConstruct +template<class T> +inline Foam::autoPtr<T>::autoPtr(const autoPtr<T>& ap) noexcept +: + ptr_(const_cast<autoPtr<T>&>(ap).release()) +{} +#endif +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + template<class T> -inline Foam::autoPtr<T>::~autoPtr() +inline Foam::autoPtr<T>::~autoPtr() noexcept { - clear(); + reset(nullptr); } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class T> -inline bool Foam::autoPtr<T>::empty() const +inline bool Foam::autoPtr<T>::empty() const noexcept { return !ptr_; } template<class T> -inline bool Foam::autoPtr<T>::valid() const +inline bool Foam::autoPtr<T>::valid() const noexcept { return ptr_; } template<class T> -inline T* Foam::autoPtr<T>::ptr() +inline T* Foam::autoPtr<T>::get() noexcept { - T* p = ptr_; - ptr_ = nullptr; - return p; + return ptr_; } template<class T> -inline void Foam::autoPtr<T>::set(T* p) +inline const T* Foam::autoPtr<T>::get() const noexcept { - if (ptr_) - { - FatalErrorInFunction - << "object of type " << typeid(T).name() - << " already allocated" - << abort(FatalError); - } + return ptr_; +} - ptr_ = p; + +template<class T> +inline T& Foam::autoPtr<T>::ref() +{ + return *ptr_; } template<class T> -inline void Foam::autoPtr<T>::reset(T* p) +inline T* Foam::autoPtr<T>::release() noexcept { - if (ptr_) - { - delete ptr_; - } + T* p = ptr_; + ptr_ = nullptr; + return p; +} - ptr_ = p; + +template<class T> +inline T* Foam::autoPtr<T>::ptr() noexcept +{ + return release(); } template<class T> -inline void Foam::autoPtr<T>::clear() +inline void Foam::autoPtr<T>::clear() noexcept { reset(nullptr); } template<class T> -inline T* Foam::autoPtr<T>::rawPtr() +inline void Foam::autoPtr<T>::reset(T* p) noexcept { - return ptr_; + if (ptr_) delete ptr_; + ptr_ = p; } template<class T> -inline const T* Foam::autoPtr<T>::rawPtr() const +inline void Foam::autoPtr<T>::reset(autoPtr<T>&& ap) noexcept { - return ptr_; + reset(ap.release()); } template<class T> -inline T& Foam::autoPtr<T>::rawRef() +inline void Foam::autoPtr<T>::set(T* p) noexcept { - return *ptr_; + reset(p); } template<class T> -inline const T& Foam::autoPtr<T>::rawRef() const +inline void Foam::autoPtr<T>::swap(autoPtr<T>& other) noexcept { - return *ptr_; + T* p = ptr_; + ptr_ = other.ptr_; + other.ptr_ = p; } -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - template<class T> -inline T& Foam::autoPtr<T>::operator()() +template<class... Args> +inline Foam::autoPtr<T> Foam::autoPtr<T>::clone(Args&&... args) const { - if (!ptr_) + if (ptr_) { - FatalErrorInFunction - << "object of type " << typeid(T).name() - << " is not allocated" - << abort(FatalError); + return autoPtr<T>(ptr_->clone(std::forward<Args>(args)...).ptr()); } - return *ptr_; + return autoPtr<T>(); } +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + template<class T> -inline const T& Foam::autoPtr<T>::operator()() const +inline T& Foam::autoPtr<T>::operator*() { if (!ptr_) { FatalErrorInFunction - << "object of type " << typeid(T).name() - << " is not allocated" + << "object of type " << typeid(T).name() << " is unallocated" << abort(FatalError); } - return *ptr_; } template<class T> -inline Foam::autoPtr<T>::operator const T&() const +inline const T& Foam::autoPtr<T>::operator*() const { - return operator()(); + return const_cast<autoPtr<T>*>(this)->operator*(); } @@ -209,11 +232,9 @@ inline T* Foam::autoPtr<T>::operator->() if (!ptr_) { FatalErrorInFunction - << "object of type " << typeid(T).name() - << " is not allocated" + << "object of type " << typeid(T).name() << " is unallocated" << abort(FatalError); } - return ptr_; } @@ -221,25 +242,59 @@ inline T* Foam::autoPtr<T>::operator->() template<class T> inline const T* Foam::autoPtr<T>::operator->() const { - return const_cast<autoPtr<T>&>(*this).operator->(); + return const_cast<autoPtr<T>*>(this)->operator->(); } template<class T> -inline void Foam::autoPtr<T>::operator=(T* p) +inline T& Foam::autoPtr<T>::operator()() { - reset(p); + return operator*(); +} + + +template<class T> +inline const T& Foam::autoPtr<T>::operator()() const +{ + return operator*(); } template<class T> -inline void Foam::autoPtr<T>::operator=(const autoPtr<T>& ap) +inline void Foam::autoPtr<T>::operator=(autoPtr<T>&& ap) noexcept { if (this != &ap) { - reset(const_cast<autoPtr<T>&>(ap).ptr()); + reset(ap.release()); } } +template<class T> +template<class U> +inline void Foam::autoPtr<T>::operator=(autoPtr<U>&& ap) noexcept +{ + if (this != &ap) + { + reset(ap.release()); + } +} + + +#ifdef Foam_autoPtr_copyAssign +template<class T> +inline void Foam::autoPtr<T>::operator=(const autoPtr<T>& ap) noexcept +{ + operator=(std::move(const_cast<autoPtr<T>&>(ap))); +} +#endif + + +template<class T> +inline void Foam::autoPtr<T>::operator=(std::nullptr_t) noexcept +{ + reset(); +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index 3492a115b702fbed03424e10607313eb7146c228..6a57e0a0d051124a54ba76716389f6a2b9fecd4b 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -1888,7 +1888,8 @@ const Foam::labelList& Foam::globalMeshData::sharedPointGlobalLabels() const sharedPointGlobalLabels = -1; } } - return sharedPointGlobalLabelsPtr_(); + + return *sharedPointGlobalLabelsPtr_; } @@ -2025,7 +2026,7 @@ const Foam::labelList& Foam::globalMeshData::sharedPointLabels() const { calcSharedPoints(); } - return sharedPointLabelsPtr_(); + return *sharedPointLabelsPtr_; } @@ -2035,7 +2036,7 @@ const Foam::labelList& Foam::globalMeshData::sharedPointAddr() const { calcSharedPoints(); } - return sharedPointAddrPtr_(); + return *sharedPointAddrPtr_; } @@ -2055,7 +2056,7 @@ const Foam::labelList& Foam::globalMeshData::sharedEdgeLabels() const { calcSharedEdges(); } - return sharedEdgeLabelsPtr_(); + return *sharedEdgeLabelsPtr_; } @@ -2065,7 +2066,7 @@ const Foam::labelList& Foam::globalMeshData::sharedEdgeAddr() const { calcSharedEdges(); } - return sharedEdgeAddrPtr_(); + return *sharedEdgeAddrPtr_; } @@ -2126,7 +2127,7 @@ const Foam::indirectPrimitivePatch& Foam::globalMeshData::coupledPatch() const << endl; } } - return coupledPatchPtr_(); + return *coupledPatchPtr_; } @@ -2146,7 +2147,7 @@ const Foam::labelList& Foam::globalMeshData::coupledPatchMeshEdges() const ) ); } - return coupledPatchMeshEdgesPtr_(); + return *coupledPatchMeshEdgesPtr_; } @@ -2165,7 +2166,7 @@ const em.insert(me[i], i); } } - return coupledPatchMeshEdgeMapPtr_(); + return *coupledPatchMeshEdgeMapPtr_; } @@ -2178,7 +2179,7 @@ const Foam::globalIndex& Foam::globalMeshData::globalPointNumbering() const new globalIndex(coupledPatch().nPoints()) ); } - return globalPointNumberingPtr_(); + return *globalPointNumberingPtr_; } @@ -2189,7 +2190,7 @@ Foam::globalMeshData::globalTransforms() const { globalTransformsPtr_.reset(new globalIndexAndTransform(mesh_)); } - return globalTransformsPtr_(); + return *globalTransformsPtr_; } @@ -2199,7 +2200,7 @@ const Foam::labelListList& Foam::globalMeshData::globalPointSlaves() const { calcGlobalPointSlaves(); } - return globalPointSlavesPtr_(); + return *globalPointSlavesPtr_; } @@ -2210,7 +2211,7 @@ const { calcGlobalPointSlaves(); } - return globalPointTransformedSlavesPtr_(); + return *globalPointTransformedSlavesPtr_; } @@ -2220,7 +2221,7 @@ const Foam::mapDistribute& Foam::globalMeshData::globalPointSlavesMap() const { calcGlobalPointSlaves(); } - return globalPointSlavesMapPtr_(); + return *globalPointSlavesMapPtr_; } @@ -2233,7 +2234,7 @@ const Foam::globalIndex& Foam::globalMeshData::globalEdgeNumbering() const new globalIndex(coupledPatch().nEdges()) ); } - return globalEdgeNumberingPtr_(); + return *globalEdgeNumberingPtr_; } @@ -2243,7 +2244,7 @@ const Foam::labelListList& Foam::globalMeshData::globalEdgeSlaves() const { calcGlobalEdgeSlaves(); } - return globalEdgeSlavesPtr_(); + return *globalEdgeSlavesPtr_; } @@ -2254,7 +2255,7 @@ const { calcGlobalEdgeSlaves(); } - return globalEdgeTransformedSlavesPtr_(); + return *globalEdgeTransformedSlavesPtr_; } @@ -2264,7 +2265,7 @@ const Foam::PackedBoolList& Foam::globalMeshData::globalEdgeOrientation() const { calcGlobalEdgeOrientation(); } - return globalEdgeOrientationPtr_(); + return *globalEdgeOrientationPtr_; } @@ -2274,7 +2275,7 @@ const Foam::mapDistribute& Foam::globalMeshData::globalEdgeSlavesMap() const { calcGlobalEdgeSlaves(); } - return globalEdgeSlavesMapPtr_(); + return *globalEdgeSlavesMapPtr_; } @@ -2285,7 +2286,7 @@ const { calcGlobalPointBoundaryFaces(); } - return globalBoundaryFaceNumberingPtr_(); + return *globalBoundaryFaceNumberingPtr_; } @@ -2296,7 +2297,7 @@ const { calcGlobalPointBoundaryFaces(); } - return globalPointBoundaryFacesPtr_(); + return *globalPointBoundaryFacesPtr_; } @@ -2307,7 +2308,7 @@ Foam::globalMeshData::globalPointTransformedBoundaryFaces() const { calcGlobalPointBoundaryFaces(); } - return globalPointTransformedBoundaryFacesPtr_(); + return *globalPointTransformedBoundaryFacesPtr_; } @@ -2318,7 +2319,7 @@ const { calcGlobalPointBoundaryFaces(); } - return globalPointBoundaryFacesMapPtr_(); + return *globalPointBoundaryFacesMapPtr_; } @@ -2328,7 +2329,7 @@ const Foam::labelList& Foam::globalMeshData::boundaryCells() const { calcGlobalPointBoundaryCells(); } - return boundaryCellsPtr_(); + return *boundaryCellsPtr_; } @@ -2339,7 +2340,7 @@ const { calcGlobalPointBoundaryCells(); } - return globalBoundaryCellNumberingPtr_(); + return *globalBoundaryCellNumberingPtr_; } @@ -2350,7 +2351,7 @@ const { calcGlobalPointBoundaryCells(); } - return globalPointBoundaryCellsPtr_(); + return *globalPointBoundaryCellsPtr_; } @@ -2361,7 +2362,7 @@ Foam::globalMeshData::globalPointTransformedBoundaryCells() const { calcGlobalPointBoundaryCells(); } - return globalPointTransformedBoundaryCellsPtr_(); + return *globalPointTransformedBoundaryCellsPtr_; } @@ -2372,7 +2373,7 @@ const { calcGlobalPointBoundaryCells(); } - return globalPointBoundaryCellsMapPtr_(); + return *globalPointBoundaryCellsMapPtr_; } @@ -2382,7 +2383,7 @@ const Foam::labelListList& Foam::globalMeshData::globalCoPointSlaves() const { calcGlobalCoPointSlaves(); } - return globalCoPointSlavesPtr_(); + return *globalCoPointSlavesPtr_; } @@ -2392,7 +2393,7 @@ const Foam::mapDistribute& Foam::globalMeshData::globalCoPointSlavesMap() const { calcGlobalCoPointSlaves(); } - return globalCoPointSlavesMapPtr_(); + return *globalCoPointSlavesMapPtr_; } diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H index 20dbd3bc1c66ffbd40b6627fb663f93e59b0c307..cfb4f53eea7ccac9e42e9291b955f122db3301cc 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H @@ -347,13 +347,13 @@ public: //- Corresponding map const mapDistribute& map() const { - return map_(); + return *map_; } //- Corresponding map mapDistribute& map() { - return map_(); + return *map_; } //- From (mesh or patch) point to index in procPoints diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.C index 67c436c4b89a0c704c9eba26453d9794923430ab..9968377c5406375d02fdcc50b8d5a3089ef22e84 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.C @@ -183,7 +183,7 @@ const Foam::List<Foam::labelPair>& Foam::mapDistributeBase::schedule() const ) ); } - return schedulePtr_(); + return *schedulePtr_; } diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.C index 45a156334289bbdd7d50a672c3c4c6b7d7f9c1c2..a8dcb1886f5d0434f18ca92ca846fc7264f06f68 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.C @@ -174,8 +174,18 @@ Foam::mapPolyMesh::mapPolyMesh oldPatchSizes_(oldPatchStarts.size()), oldPatchStarts_(oldPatchStarts, reuse), oldPatchNMeshPoints_(oldPatchNMeshPoints, reuse), - oldCellVolumesPtr_(oldCellVolumesPtr, reuse) + oldCellVolumesPtr_() { + // Reuse old content or clone + if (reuse) + { + oldCellVolumesPtr_ = std::move(oldCellVolumesPtr); + } + else + { + oldCellVolumesPtr_ = oldCellVolumesPtr.clone(); + } + if (oldPatchStarts_.size() > 0) { // Calculate old patch sizes diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.H index 03f1c8a55d32c49b050f9bdc8abc305dd46b8a51..5fd06739848eb5a9f036f7bc0789ebc66010369f 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.H @@ -645,7 +645,7 @@ public: const scalarField& oldCellVolumes() const { - return oldCellVolumesPtr_(); + return *oldCellVolumesPtr_; } }; diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index 6b36461924db11281e9244d9de700e530c04e5a0..3f75be93e5d15f36862d402314107ab2f9b5d0c9 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -365,7 +365,7 @@ Foam::polyBoundaryMesh::neighbourEdges() const } } - return neighbourEdgesPtr_(); + return *neighbourEdgesPtr_; } @@ -394,7 +394,8 @@ const Foam::labelList& Foam::polyBoundaryMesh::patchID() const } } } - return patchIDPtr_(); + + return *patchIDPtr_; } @@ -446,7 +447,7 @@ Foam::polyBoundaryMesh::groupPatchIDs() const } } - return groupPatchIDsPtr_(); + return *groupPatchIDsPtr_; } diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index de8d164ef75e2047a484746b4c9e908a5e7fc8d7..b840b7d8d8f83e5cd8390429daf979417189d4d8 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -151,10 +151,8 @@ Foam::autoPtr<Foam::labelIOList> Foam::polyMesh::readTetBasePtIs() const { return autoPtr<labelIOList>(new labelIOList(io)); } - else - { - return autoPtr<labelIOList>(nullptr); - } + + return autoPtr<labelIOList>(); } @@ -873,7 +871,7 @@ const Foam::labelIOList& Foam::polyMesh::tetBasePtIs() const ); } - return tetBasePtIsPtr_(); + return *tetBasePtIsPtr_; } @@ -1078,7 +1076,7 @@ const Foam::pointField& Foam::polyMesh::oldPoints() const curMotionTimeIndex_ = time().timeIndex(); } - return oldPointsPtr_(); + return *oldPointsPtr_; } @@ -1231,7 +1229,7 @@ const Foam::globalMeshData& Foam::polyMesh::globalData() const globalMeshDataPtr_.reset(new globalMeshData(*this)); } - return globalMeshDataPtr_(); + return *globalMeshDataPtr_; } diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C b/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C index e290c689f968c7fdb7445fa7798dbdce0539526b..a88f5b12f3059217c82ba8fe40c2923e826b8e13 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C @@ -452,7 +452,7 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate() autoPtr<labelIOList> newTetBasePtIsPtr = readTetBasePtIs(); if (newTetBasePtIsPtr.valid()) { - tetBasePtIsPtr_ = newTetBasePtIsPtr; + tetBasePtIsPtr_ = std::move(newTetBasePtIsPtr); } // Calculate the geometry for the patches (transformation tensors etc.) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C index 0c5b72846590123370748dae59c8b23701fcdf07..201b3cddbeaf559017cf11ff3f41499767463b0b 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C @@ -511,7 +511,7 @@ const Foam::labelList& Foam::processorPolyPatch::neighbPoints() const << "No extended addressing calculated for patch " << name() << abort(FatalError); } - return neighbPointsPtr_(); + return *neighbPointsPtr_; } @@ -523,7 +523,7 @@ const Foam::labelList& Foam::processorPolyPatch::neighbEdges() const << "No extended addressing calculated for patch " << name() << abort(FatalError); } - return neighbEdgesPtr_(); + return *neighbEdgesPtr_; } diff --git a/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.C b/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.C index c952a6f6c84f46d2af4ed074439cb4b8ee066d20..54a004699694cfc0bd26bb1a2d1c5fa737afb014 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.C +++ b/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.C @@ -52,8 +52,8 @@ template<class Type> Foam::Function1Types::Scale<Type>::Scale(const Scale<Type>& se) : Function1<Type>(se), - scale_(se.scale_, false), - value_(se.value_, false) + scale_(se.scale_.clone()), + value_(se.value_.clone()) {} diff --git a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C index 7fa813c79d6de4ee900417953ed241d985d6f728..732f329147af8d9e0aaeec82a94b940b40e18f4c 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C +++ b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C @@ -56,10 +56,10 @@ Foam::Function1Types::Sine<Type>::Sine(const Sine<Type>& se) : Function1<Type>(se), t0_(se.t0_), - amplitude_(se.amplitude_, false), - frequency_(se.frequency_, false), - scale_(se.scale_, false), - level_(se.level_, false) + amplitude_(se.amplitude_.clone()), + frequency_(se.frequency_.clone()), + scale_(se.scale_.clone()), + level_(se.level_.clone()) {} diff --git a/src/OpenFOAM/primitives/functions/Function1/Square/Square.C b/src/OpenFOAM/primitives/functions/Function1/Square/Square.C index e18ed2da7c5d62964600d6e1c2195c89aa63277f..d9f06f5bc50f376d7dd734a8874abf917a9b599e 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Square/Square.C +++ b/src/OpenFOAM/primitives/functions/Function1/Square/Square.C @@ -58,10 +58,10 @@ Foam::Function1Types::Square<Type>::Square(const Square<Type>& se) Function1<Type>(se), t0_(se.t0_), markSpace_(se.markSpace_), - amplitude_(se.amplitude_, false), - frequency_(se.frequency_, false), - scale_(se.scale_, false), - level_(se.level_, false) + amplitude_(se.amplitude_.clone()), + frequency_(se.frequency_.clone()), + scale_(se.scale_.clone()), + level_(se.level_.clone()) {} diff --git a/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.C b/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.C index 5a6e5104114f3b7fd61eca3672d2ab9f170172cc..c068e240c275d97df2c6d436c59da8701bdcd8be 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.C +++ b/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.C @@ -49,7 +49,7 @@ Foam::Function1Types::TableBase<Type>::interpolator() const ); } - return interpolatorPtr_(); + return *interpolatorPtr_; } diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C index dbd129117204d0de9d7e81368fd210348d9a69b5..5fb7fffe5063e77ae599ead2fc1efd79fdddd9c2 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C @@ -177,7 +177,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField Q_(ptf.Q_), q_(ptf.q_, mapper), h_(ptf.h_, mapper), - Ta_(ptf.Ta_, false), + Ta_(ptf.Ta_.clone()), relaxation_(ptf.relaxation_), emissivity_(ptf.emissivity_), qrPrevious_(ptf.qrPrevious_, mapper), @@ -225,7 +225,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField Q_(ewhftpsf.Q_), q_(ewhftpsf.q_), h_(ewhftpsf.h_), - Ta_(ewhftpsf.Ta_, false), + Ta_(ewhftpsf.Ta_.clone()), relaxation_(ewhftpsf.relaxation_), emissivity_(ewhftpsf.emissivity_), qrPrevious_(ewhftpsf.qrPrevious_), @@ -249,7 +249,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField Q_(ewhftpsf.Q_), q_(ewhftpsf.q_), h_(ewhftpsf.h_), - Ta_(ewhftpsf.Ta_, false), + Ta_(ewhftpsf.Ta_.clone()), relaxation_(ewhftpsf.relaxation_), emissivity_(ewhftpsf.emissivity_), qrPrevious_(ewhftpsf.qrPrevious_), diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C index 00883665e82ff2c972af04498e7c2b5720562570..1ebdbcf59d439c72d571ccbced3ac182fc309970 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C @@ -204,7 +204,7 @@ const solidType& thermalBaffle1DFvPatchScalarField<solidType>::solid() const { solidPtr_.reset(new solidType(solidDict_)); } - return solidPtr_(); + return *solidPtr_; } else { diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.H b/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.H index 297e86b3d3002ec4e06d4a47a5f0583b93480d65..b3a57319aa86abca94c46a7ca4cca3782bcbae94 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.H +++ b/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.H @@ -201,7 +201,7 @@ public: //- Access function to filter width inline const volScalarField& delta() const { - return delta_(); + return *delta_; } diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.H b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.H index 82acfff3a62628ceab9bf8b4b391a55a1d95d704..7b9769a948fa75de3013f488cce8589939bec3a9 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.H +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.H @@ -104,7 +104,7 @@ public: //- Return the hmax delta field const volScalarField& hmax() const { - return hmaxPtr_(); + return *hmaxPtr_; } // Correct values diff --git a/src/TurbulenceModels/turbulenceModels/RAS/kOmegaSSTSAS/kOmegaSSTSAS.H b/src/TurbulenceModels/turbulenceModels/RAS/kOmegaSSTSAS/kOmegaSSTSAS.H index 0840a264502d5f12c349139bbc6b51327076a3c2..19b9db63c72d46467935ebd781a91c0a376265c2 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/kOmegaSSTSAS/kOmegaSSTSAS.H +++ b/src/TurbulenceModels/turbulenceModels/RAS/kOmegaSSTSAS/kOmegaSSTSAS.H @@ -177,7 +177,7 @@ public: //- Access function to filter width inline const volScalarField& delta() const { - return delta_(); + return *delta_; } }; diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C index 486581871a9de273f3f67b89897d4a648cf26e50..be957dcaac1bb38a8d6de90b815c1a0fb70609e3 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C @@ -59,7 +59,7 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField D_(Function1<scalar>::New("D", dict)), I_(Function1<scalar>::New("I", dict)), length_(readScalar(dict.lookup("length"))), - uniformJump_(dict.lookupOrDefault<bool>("uniformJump", false)) + uniformJump_(dict.lookupOrDefault("uniformJump", false)) { fvPatchField<scalar>::operator= ( @@ -79,8 +79,8 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField fixedJumpFvPatchField<scalar>(ptf, p, iF, mapper), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_), - D_(ptf.D_, false), - I_(ptf.I_, false), + D_(ptf.D_.clone()), + I_(ptf.I_.clone()), length_(ptf.length_), uniformJump_(ptf.uniformJump_) {} @@ -95,8 +95,8 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField fixedJumpFvPatchField<scalar>(ptf), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_), - D_(ptf.D_, false), - I_(ptf.I_, false), + D_(ptf.D_.clone()), + I_(ptf.I_.clone()), length_(ptf.length_), uniformJump_(ptf.uniformJump_) {} @@ -111,8 +111,8 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField fixedJumpFvPatchField<scalar>(ptf, iF), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_), - D_(ptf.D_, false), - I_(ptf.I_, false), + D_(ptf.D_.clone()), + I_(ptf.I_.clone()), length_(ptf.length_), uniformJump_(ptf.uniformJump_) {} diff --git a/src/combustionModels/psiCombustionModel/psiThermoCombustion/psiThermoCombustion.C b/src/combustionModels/psiCombustionModel/psiThermoCombustion/psiThermoCombustion.C index e2b2440b5a4176cab0a1767fd3895f05e93c5991..72171d8a91f2885477e0e88029742def6290ee32 100644 --- a/src/combustionModels/psiCombustionModel/psiThermoCombustion/psiThermoCombustion.C +++ b/src/combustionModels/psiCombustionModel/psiThermoCombustion/psiThermoCombustion.C @@ -50,14 +50,14 @@ Foam::combustionModels::psiThermoCombustion::~psiThermoCombustion() Foam::psiReactionThermo& Foam::combustionModels::psiThermoCombustion::thermo() { - return thermoPtr_(); + return *thermoPtr_; } const Foam::psiReactionThermo& Foam::combustionModels::psiThermoCombustion::thermo() const { - return thermoPtr_(); + return *thermoPtr_; } diff --git a/src/combustionModels/rhoCombustionModel/rhoThermoCombustion/rhoThermoCombustion.C b/src/combustionModels/rhoCombustionModel/rhoThermoCombustion/rhoThermoCombustion.C index a4a5be12c5a1100ad94e6e3efacafd9a310ea059..e9b0e301c764690eac2df16deabee5149cc2279c 100644 --- a/src/combustionModels/rhoCombustionModel/rhoThermoCombustion/rhoThermoCombustion.C +++ b/src/combustionModels/rhoCombustionModel/rhoThermoCombustion/rhoThermoCombustion.C @@ -50,14 +50,14 @@ Foam::combustionModels::rhoThermoCombustion::~rhoThermoCombustion() Foam::rhoReactionThermo& Foam::combustionModels::rhoThermoCombustion::thermo() { - return thermoPtr_(); + return *thermoPtr_; } const Foam::rhoReactionThermo& Foam::combustionModels::rhoThermoCombustion::thermo() const { - return thermoPtr_(); + return *thermoPtr_; } diff --git a/src/conversion/common/reader/meshReader.C b/src/conversion/common/reader/meshReader.C index dd3650db67aa923571ba6fc87b41b8c8eaf1f5ab..deb60d8b524509b7d5d4976aaa9a54bd38ea1752 100644 --- a/src/conversion/common/reader/meshReader.C +++ b/src/conversion/common/reader/meshReader.C @@ -91,7 +91,7 @@ Foam::autoPtr<Foam::polyMesh> Foam::meshReader::mesh createPolyBoundary(); clearExtraStorage(); - autoPtr<polyMesh> mesh + autoPtr<polyMesh> meshPtr ( new polyMesh ( @@ -106,16 +106,17 @@ Foam::autoPtr<Foam::polyMesh> Foam::meshReader::mesh xferMove(cellPolys_) ) ); + polyMesh& mesh = meshPtr(); - // adding patches also checks the mesh - mesh().addPatches(polyBoundaryPatches(mesh)); + // Adding patches also checks the mesh + mesh.addPatches(polyBoundaryPatches(mesh)); - warnDuplicates("boundaries", mesh().boundaryMesh().names()); + warnDuplicates("boundaries", mesh.boundaryMesh().names()); - addCellZones(mesh()); - addFaceZones(mesh()); + addCellZones(mesh); + addFaceZones(mesh); - return mesh; + return meshPtr; } diff --git a/src/conversion/ensight/mesh/ensightMeshI.H b/src/conversion/ensight/mesh/ensightMeshI.H index 8213182e274d4ffe1a534257349c9344c08a6fb5..7b7fd206d2640e5110c4ced3133561164ba33093 100644 --- a/src/conversion/ensight/mesh/ensightMeshI.H +++ b/src/conversion/ensight/mesh/ensightMeshI.H @@ -77,7 +77,7 @@ Foam::ensightMesh::faceZoneFaces() const inline void Foam::ensightMesh::write(autoPtr<ensightGeoFile>& os) const { - write(os.rawRef()); + write(os.ref()); } diff --git a/src/conversion/ensight/mesh/ensightMeshOptions.C b/src/conversion/ensight/mesh/ensightMeshOptions.C index 573ddeee7183cba1287ec10ffb2c0d46998dd09c..7dbafafab2e3c792a03eb29b3df4c0142620f0f6 100644 --- a/src/conversion/ensight/mesh/ensightMeshOptions.C +++ b/src/conversion/ensight/mesh/ensightMeshOptions.C @@ -136,7 +136,7 @@ const Foam::wordRes& Foam::ensightMesh::options::patchSelection() const { if (usePatchSelection()) { - return patchPatterns_(); + return *patchPatterns_; } return wordRes::null(); @@ -147,7 +147,7 @@ const Foam::wordRes& Foam::ensightMesh::options::faceZoneSelection() const { if (faceZonePatterns_.valid()) { - return faceZonePatterns_(); + return *faceZonePatterns_; } return wordRes::null(); diff --git a/src/conversion/ensight/output/ensightOutput.H b/src/conversion/ensight/output/ensightOutput.H index bdead411f4f1a99efa947a6a5251e29cef8c4d90..168b11d5e0b44cc2256917c9e7e36e08a222abb7 100644 --- a/src/conversion/ensight/output/ensightOutput.H +++ b/src/conversion/ensight/output/ensightOutput.H @@ -143,7 +143,7 @@ public: const bool nodeValues = false ) { - return writeField(vf, ensMesh, output.rawRef(), nodeValues); + return writeField(vf, ensMesh, output.ref(), nodeValues); } }; diff --git a/src/conversion/ensight/output/ensightSerialOutput.H b/src/conversion/ensight/output/ensightSerialOutput.H index 823c7ba5bf3b42333d5ffd796916d5394e7df1f7..22c47bf3be57a1d01bac3716cf8f89a1aed003a3 100644 --- a/src/conversion/ensight/output/ensightSerialOutput.H +++ b/src/conversion/ensight/output/ensightSerialOutput.H @@ -112,7 +112,7 @@ public: autoPtr<ensightFile>& output ) { - return writeField(vf, part, output.rawRef()); + return writeField(vf, part, output.ref()); } @@ -125,7 +125,7 @@ public: autoPtr<ensightFile>& output ) { - return writeField(vf, list, output.rawRef()); + return writeField(vf, list, output.ref()); } }; diff --git a/src/conversion/vtk/output/foamVtkInternalWriter.H b/src/conversion/vtk/output/foamVtkInternalWriter.H index 7fd4aa4f5dafbcc2625254d4b253157474830940..f793adab1f6cddcd35ac4e055402c3716f7296e6 100644 --- a/src/conversion/vtk/output/foamVtkInternalWriter.H +++ b/src/conversion/vtk/output/foamVtkInternalWriter.H @@ -127,7 +127,7 @@ public: inline vtk::formatter& format() { - return format_(); + return *format_; } diff --git a/src/conversion/vtk/output/foamVtkPatchWriter.H b/src/conversion/vtk/output/foamVtkPatchWriter.H index 627b84788210de52f8f06eca2580a9332bf52349..e7bcd15dbe6991561d0aee355bccb788da921bf4 100644 --- a/src/conversion/vtk/output/foamVtkPatchWriter.H +++ b/src/conversion/vtk/output/foamVtkPatchWriter.H @@ -133,7 +133,7 @@ public: inline vtk::formatter& format() { - return format_(); + return *format_; } inline label nPoints() const diff --git a/src/conversion/vtk/output/foamVtkSurfaceMeshWriter.H b/src/conversion/vtk/output/foamVtkSurfaceMeshWriter.H index ea463c41c2cf716f11411cfc39f742fceb084542..feb241f134fb9bfed12fa4d2a18662510990be0c 100644 --- a/src/conversion/vtk/output/foamVtkSurfaceMeshWriter.H +++ b/src/conversion/vtk/output/foamVtkSurfaceMeshWriter.H @@ -122,7 +122,7 @@ public: inline vtk::formatter& format() { - return format_(); + return *format_; } //- Open write for CellData of count fields. diff --git a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C index 307c32488adad1af8cef671454c246cc7520a3d3..e46a3b95e81d26b9aef3ad11f0c735b6db049f48 100644 --- a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C +++ b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C @@ -61,7 +61,7 @@ Foam::dynamicMotionSolverFvMesh::~dynamicMotionSolverFvMesh() const Foam::motionSolver& Foam::dynamicMotionSolverFvMesh::motion() const { - return motionPtr_(); + return *motionPtr_; } diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C index 409f533269757bbd2a73d3cb93f25c978020ee01..12d6f45d53a36ab8d94402500b74129d56c69b14 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C @@ -223,11 +223,11 @@ Foam::dynamicRefineFvMesh::refine meshCutter_.setRefinement(cellsToRefine, meshMod); // Create mesh (with inflation), return map from old to new mesh. - //autoPtr<mapPolyMesh> map = meshMod.changeMesh(*this, true); - autoPtr<mapPolyMesh> map = meshMod.changeMesh(*this, false); + autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(*this, false); + mapPolyMesh& map = *mapPtr; Info<< "Refined from " - << returnReduce(map().nOldCells(), sumOp<label>()) + << returnReduce(map.nOldCells(), sumOp<label>()) << " to " << globalData().nTotalCells() << " cells." << endl; if (debug) @@ -235,7 +235,7 @@ Foam::dynamicRefineFvMesh::refine // Check map. for (label facei = 0; facei < nInternalFaces(); facei++) { - label oldFacei = map().faceMap()[facei]; + label oldFacei = map.faceMap()[facei]; if (oldFacei >= nInternalFaces()) { @@ -256,26 +256,11 @@ Foam::dynamicRefineFvMesh::refine // Update fields updateMesh(map); - - // Move mesh - /* - pointField newPoints; - if (map().hasMotionPoints()) - { - newPoints = map().preMotionPoints(); - } - else - { - newPoints = points(); - } - movePoints(newPoints); - */ - // Correct the flux for modified/added faces. All the faces which only // have been renumbered will already have been handled by the mapping. { - const labelList& faceMap = map().faceMap(); - const labelList& reverseFaceMap = map().reverseFaceMap(); + const labelList& faceMap = map.faceMap(); + const labelList& reverseFaceMap = map.reverseFaceMap(); // Storage for any master faces. These will be the original faces // on the coarse cell that get split into four (or rather the @@ -437,7 +422,6 @@ Foam::dynamicRefineFvMesh::refine } - // Update numbering of cells/vertices. meshCutter_.updateMesh(map); @@ -448,7 +432,7 @@ Foam::dynamicRefineFvMesh::refine forAll(newProtectedCell, celli) { - label oldCelli = map().cellMap()[celli]; + const label oldCelli = map.cellMap()[celli]; newProtectedCell.set(celli, protectedCell_.get(oldCelli)); } protectedCell_.transfer(newProtectedCell); @@ -457,7 +441,7 @@ Foam::dynamicRefineFvMesh::refine // Debug: Check refinement levels (across faces only) meshCutter_.checkRefinementLevels(-1, labelList(0)); - return map; + return mapPtr; } @@ -504,36 +488,21 @@ Foam::dynamicRefineFvMesh::unrefine // Change mesh and generate map. - //autoPtr<mapPolyMesh> map = meshMod.changeMesh(*this, true); - autoPtr<mapPolyMesh> map = meshMod.changeMesh(*this, false); + autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(*this, false); + mapPolyMesh& map = *mapPtr; Info<< "Unrefined from " - << returnReduce(map().nOldCells(), sumOp<label>()) + << returnReduce(map.nOldCells(), sumOp<label>()) << " to " << globalData().nTotalCells() << " cells." << endl; // Update fields updateMesh(map); - - // Move mesh - /* - pointField newPoints; - if (map().hasMotionPoints()) - { - newPoints = map().preMotionPoints(); - } - else - { - newPoints = points(); - } - movePoints(newPoints); - */ - // Correct the flux for modified faces. { - const labelList& reversePointMap = map().reversePointMap(); - const labelList& reverseFaceMap = map().reverseFaceMap(); + const labelList& reversePointMap = map.reversePointMap(); + const labelList& reverseFaceMap = map.reverseFaceMap(); HashTable<surfaceScalarField*> fluxes ( @@ -626,7 +595,7 @@ Foam::dynamicRefineFvMesh::unrefine forAll(newProtectedCell, celli) { - label oldCelli = map().cellMap()[celli]; + label oldCelli = map.cellMap()[celli]; if (oldCelli >= 0) { newProtectedCell.set(celli, protectedCell_.get(oldCelli)); @@ -638,7 +607,7 @@ Foam::dynamicRefineFvMesh::unrefine // Debug: Check refinement levels (across faces only) meshCutter_.checkRefinementLevels(-1, labelList(0)); - return map; + return mapPtr; } diff --git a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C index 7873504aa8bf246af2883302fc0b5ac3e42d3d2e..3f03825504d08e5a5a783c5dcb0e18f979a2834a 100644 --- a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C +++ b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C @@ -145,7 +145,6 @@ extrudePatchMesh::extrudePatchMesh } extrudeMesh(regionPatches); - } @@ -341,7 +340,7 @@ void extrudePatchMesh::extrudeMesh(const List<polyPatch*>& regionPatches) ); // Update numbering on extruder. - extruder.updateMesh(map); + extruder.updateMesh(map()); this->setInstance(this->thisDb().time().constant()); this->write(); @@ -349,15 +348,6 @@ void extrudePatchMesh::extrudeMesh(const List<polyPatch*>& regionPatches) } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -extrudePatchMesh::~extrudePatchMesh() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.H b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.H index 2a6a719afc485e82b2803e8250912ccf4c9f2436..6ff5933f39d5af40615b899568f1b71c1a1b6b69 100644 --- a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.H +++ b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.H @@ -148,7 +148,7 @@ public: //- Destructor - virtual ~extrudePatchMesh(); + virtual ~extrudePatchMesh() = default; // Member functions diff --git a/src/dynamicMesh/fvMeshAdder/fvMeshAdder.C b/src/dynamicMesh/fvMeshAdder/fvMeshAdder.C index 0dac84ea7e3526a22aedd0a9ea1c1570fc75471a..b3aa15ff3f268d5e6f53cf6afc274f94a1b8f6e1 100644 --- a/src/dynamicMesh/fvMeshAdder/fvMeshAdder.C +++ b/src/dynamicMesh/fvMeshAdder/fvMeshAdder.C @@ -87,6 +87,7 @@ Foam::autoPtr<Foam::mapAddedPolyMesh> Foam::fvMeshAdder::add validBoundary ) ); + mapAddedPolyMesh& map = *mapPtr; // Adjust the fvMesh part. const polyBoundaryMesh& patches = mesh0.boundaryMesh(); @@ -100,23 +101,23 @@ Foam::autoPtr<Foam::mapAddedPolyMesh> Foam::fvMeshAdder::add // Do the mapping of the stored fields // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - fvMeshAdder::MapVolFields<scalar>(mapPtr, mesh0, mesh1); - fvMeshAdder::MapVolFields<vector>(mapPtr, mesh0, mesh1); - fvMeshAdder::MapVolFields<sphericalTensor>(mapPtr, mesh0, mesh1); - fvMeshAdder::MapVolFields<symmTensor>(mapPtr, mesh0, mesh1); - fvMeshAdder::MapVolFields<tensor>(mapPtr, mesh0, mesh1); - - fvMeshAdder::MapSurfaceFields<scalar>(mapPtr, mesh0, mesh1); - fvMeshAdder::MapSurfaceFields<vector>(mapPtr, mesh0, mesh1); - fvMeshAdder::MapSurfaceFields<sphericalTensor>(mapPtr, mesh0, mesh1); - fvMeshAdder::MapSurfaceFields<symmTensor>(mapPtr, mesh0, mesh1); - fvMeshAdder::MapSurfaceFields<tensor>(mapPtr, mesh0, mesh1); - - fvMeshAdder::MapDimFields<scalar>(mapPtr, mesh0, mesh1); - fvMeshAdder::MapDimFields<vector>(mapPtr, mesh0, mesh1); - fvMeshAdder::MapDimFields<sphericalTensor>(mapPtr, mesh0, mesh1); - fvMeshAdder::MapDimFields<symmTensor>(mapPtr, mesh0, mesh1); - fvMeshAdder::MapDimFields<tensor>(mapPtr, mesh0, mesh1); + fvMeshAdder::MapVolFields<scalar>(map, mesh0, mesh1); + fvMeshAdder::MapVolFields<vector>(map, mesh0, mesh1); + fvMeshAdder::MapVolFields<sphericalTensor>(map, mesh0, mesh1); + fvMeshAdder::MapVolFields<symmTensor>(map, mesh0, mesh1); + fvMeshAdder::MapVolFields<tensor>(map, mesh0, mesh1); + + fvMeshAdder::MapSurfaceFields<scalar>(map, mesh0, mesh1); + fvMeshAdder::MapSurfaceFields<vector>(map, mesh0, mesh1); + fvMeshAdder::MapSurfaceFields<sphericalTensor>(map, mesh0, mesh1); + fvMeshAdder::MapSurfaceFields<symmTensor>(map, mesh0, mesh1); + fvMeshAdder::MapSurfaceFields<tensor>(map, mesh0, mesh1); + + fvMeshAdder::MapDimFields<scalar>(map, mesh0, mesh1); + fvMeshAdder::MapDimFields<vector>(map, mesh0, mesh1); + fvMeshAdder::MapDimFields<sphericalTensor>(map, mesh0, mesh1); + fvMeshAdder::MapDimFields<symmTensor>(map, mesh0, mesh1); + fvMeshAdder::MapDimFields<tensor>(map, mesh0, mesh1); return mapPtr; } diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C index 355c8333494b7807ead94cdc0396656cba842af9..beb3af4346c028a5d03a7909a14b2ebd4348580a 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C @@ -632,7 +632,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::repatch // shared points (see mergeSharedPoints below). So temporarily points // and edges do not match! - autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true); + autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false, true); + mapPolyMesh& map = *mapPtr; // Update fields. No inflation, parallel sync. mesh_.updateMesh(map); @@ -647,16 +648,16 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::repatch // Move mesh (since morphing does not do this) - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - mesh_.movePoints(map().preMotionPoints()); + mesh_.movePoints(map.preMotionPoints()); } // Adapt constructMaps. if (debug) { - label index = map().reverseFaceMap().find(-1); + label index = map.reverseFaceMap().find(-1); if (index != -1) { @@ -672,14 +673,14 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::repatch { inplaceRenumberWithFlip ( - map().reverseFaceMap(), + map.reverseFaceMap(), false, true, constructFaceMap[proci] ); } - return map; + return mapPtr; } @@ -706,7 +707,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::mergeSharedPoints if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0) { - return autoPtr<mapPolyMesh>(nullptr); + return autoPtr<mapPolyMesh>(); } polyTopoChange meshMod(mesh_); @@ -714,7 +715,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::mergeSharedPoints fvMeshAdder::mergePoints(mesh_, pointToMaster, meshMod); // Change the mesh (no inflation). Note: parallel comms allowed. - autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true); + autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false, true); + mapPolyMesh& map = *mapPtr; // Update fields. No inflation, parallel sync. mesh_.updateMesh(map); @@ -728,7 +730,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::mergeSharedPoints { label oldPointi = constructMap[i]; - label newPointi = map().reversePointMap()[oldPointi]; + label newPointi = map.reversePointMap()[oldPointi]; if (newPointi < -1) { @@ -746,7 +748,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::mergeSharedPoints } } } - return map; + + return mapPtr; } @@ -1124,7 +1127,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::doRemoveCells autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, false); // Update fields - mesh_.updateMesh(map); + mesh_.updateMesh(map()); // Any exposed faces in a surfaceField will not be mapped. Map the value diff --git a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C index dfb166aeb974d18a79de78dd7027f507e17437a6..5e83a25098e8c8d46cf64efd61f81b7f186e80f1 100644 --- a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C +++ b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C @@ -1488,7 +1488,7 @@ const fvMesh& Foam::fvMeshSubset::subMesh() const { checkCellSubset(); - return fvMeshSubsetPtr_(); + return *fvMeshSubsetPtr_; } @@ -1496,7 +1496,7 @@ fvMesh& Foam::fvMeshSubset::subMesh() { checkCellSubset(); - return fvMeshSubsetPtr_(); + return *fvMeshSubsetPtr_; } @@ -1550,7 +1550,7 @@ const labelList& Foam::fvMeshSubset::faceFlipMap() const } } - return faceFlipMapPtr_(); + return *faceFlipMapPtr_; } diff --git a/src/dynamicMesh/meshCut/cellCuts/cellCuts.H b/src/dynamicMesh/meshCut/cellCuts/cellCuts.H index 90dbd212ff816f6af6e3085f4bb7ecfb5c432407..a59db7a54d019c75fcadd2e00bbf8ea68534dfda 100644 --- a/src/dynamicMesh/meshCut/cellCuts/cellCuts.H +++ b/src/dynamicMesh/meshCut/cellCuts/cellCuts.H @@ -575,7 +575,7 @@ public: { calcFaceCuts(); } - return faceCutsPtr_(); + return *faceCutsPtr_; } //- Gives for split face the two cuts that split the face into two. diff --git a/src/dynamicMesh/meshCut/cellLooper/cellLooper.H b/src/dynamicMesh/meshCut/cellLooper/cellLooper.H index 065edef71f921a52ceb2ee3516e8a160b8096e01..02ade8a4383e965d7a0d842075fc62191964d2b0 100644 --- a/src/dynamicMesh/meshCut/cellLooper/cellLooper.H +++ b/src/dynamicMesh/meshCut/cellLooper/cellLooper.H @@ -145,7 +145,7 @@ public: autoPtr<cellLooper> clone() const { NotImplemented; - return autoPtr<cellLooper>(nullptr); + return autoPtr<cellLooper>(); } diff --git a/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.C b/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.C index 83fdea84102302d9418f47d0badd4257266e2960..0b4c3c904341953d318fc4c404ee25e55193c701 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.C +++ b/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.C @@ -452,7 +452,7 @@ void Foam::multiDirRefinement::refineFromDict // How to walk cell circumference. Switch pureGeomCut(dict.lookup("geometricCut")); - autoPtr<cellLooper> cellWalker(nullptr); + autoPtr<cellLooper> cellWalker; if (pureGeomCut) { cellWalker.reset(new geomCellLooper(mesh)); diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/pointPatchFields/derived/solidBodyMotionDisplacement/solidBodyMotionDisplacementPointPatchVectorField.C b/src/dynamicMesh/motionSolvers/displacement/solidBody/pointPatchFields/derived/solidBodyMotionDisplacement/solidBodyMotionDisplacementPointPatchVectorField.C index 86043002269e6a71521fa9f7ca7fc468a1c98073..e7460ee9dd553689f2f64c9ffb8106944a53eaa8 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/pointPatchFields/derived/solidBodyMotionDisplacement/solidBodyMotionDisplacementPointPatchVectorField.C +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/pointPatchFields/derived/solidBodyMotionDisplacement/solidBodyMotionDisplacementPointPatchVectorField.C @@ -146,7 +146,7 @@ solidBodyMotionDisplacementPointPatchVectorField::localPoints0() const localPoints0Ptr_.reset(new pointField(points0, patch().meshPoints())); } - return localPoints0Ptr_(); + return *localPoints0Ptr_; } diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/pointPatchFields/derived/solidBodyMotionDisplacement/solidBodyMotionDisplacementPointPatchVectorField.H b/src/dynamicMesh/motionSolvers/displacement/solidBody/pointPatchFields/derived/solidBodyMotionDisplacement/solidBodyMotionDisplacementPointPatchVectorField.H index 070907249140652b893f7453a99ff83b3b2c0863..c8f349a6aa245689550f02d695bb413daf7a9309 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/pointPatchFields/derived/solidBodyMotionDisplacement/solidBodyMotionDisplacementPointPatchVectorField.H +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/pointPatchFields/derived/solidBodyMotionDisplacement/solidBodyMotionDisplacementPointPatchVectorField.H @@ -142,7 +142,7 @@ public: //- Return the fluctuation scale const solidBodyMotionFunction& motion() const { - return SBMFPtr_(); + return *SBMFPtr_; } const pointField& localPoints0() const; diff --git a/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C b/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C index 6e5decf0355c5ebe0e3a0f55d1acb786a41abf1a..7efaf9cd5b8aabb9c2d6596d59df2165e347986e 100644 --- a/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C +++ b/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C @@ -92,7 +92,7 @@ Foam::motionSolver::motionSolver Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::clone() const { NotImplemented; - return autoPtr<motionSolver>(nullptr); + return autoPtr<motionSolver>(); } diff --git a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.H b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.H index b5d7b1fe28f9c514131824023771326bf103f627..e406bb852f8fe749ef86b722572f794c34a4c753 100644 --- a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.H +++ b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.H @@ -441,19 +441,19 @@ public: //- Addressing engine for coupled faces on mesh0 const indirectPrimitivePatch& masterPatch() const { - return masterPatchPtr_(); + return *masterPatchPtr_; } //- Addressing engine for coupled faces on mesh1 const indirectPrimitivePatch& slavePatch() const { - return slavePatchPtr_(); + return *slavePatchPtr_; } //- Addressing engine for combined set of faces. const primitiveFacePatch& cutFaces() const { - return cutFacesPtr_(); + return *cutFacesPtr_; } //- Points for combined set of faces. diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C index 1f87a21ef11d55f2ac7f3d2398dda245c7c51ddd..863d7dfeb9c6bc9bc4fa89b6f4642fbda4f756f9 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C @@ -5110,7 +5110,7 @@ const Foam::cellShapeList& Foam::hexRef8::cellShapes() const << endl; } } - return cellShapesPtr_(); + return *cellShapesPtr_; } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C b/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C index ee40ecc48a9ce4fb465b610a9f48d98be435bb18..2d9f9ecf55708f8d3d3d382b29881660f1bcd78c 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C @@ -286,7 +286,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChanger::changeMesh else { mesh_.topoChanging(false); - return autoPtr<mapPolyMesh>(nullptr); + return autoPtr<mapPolyMesh>(); } } diff --git a/src/dynamicMesh/polyTopoChange/repatchPolyTopoChanger/repatchPolyTopoChanger.C b/src/dynamicMesh/polyTopoChange/repatchPolyTopoChanger/repatchPolyTopoChanger.C index 2de1c3619a03098c25c13b0c9076b6fe2e6a5594..2ccb4da9cae4fab136dd8ebb3c187c72776eb755 100644 --- a/src/dynamicMesh/polyTopoChange/repatchPolyTopoChanger/repatchPolyTopoChanger.C +++ b/src/dynamicMesh/polyTopoChange/repatchPolyTopoChanger/repatchPolyTopoChanger.C @@ -43,7 +43,7 @@ Foam::polyTopoChange& Foam::repatchPolyTopoChanger::meshMod() { meshModPtr_.reset(new polyTopoChange(mesh_)); } - return meshModPtr_(); + return *meshModPtr_; } diff --git a/src/engine/enginePiston/enginePiston.H b/src/engine/enginePiston/enginePiston.H index 5904ce36f3b8b1cf81c178b5255ada851b32390a..1cf9c5bde7df8161bdf8732247d07bc003a7b103 100644 --- a/src/engine/enginePiston/enginePiston.H +++ b/src/engine/enginePiston/enginePiston.H @@ -120,7 +120,7 @@ public: //- Return coordinate system const coordinateSystem& cs() const { - return csPtr_(); + return *csPtr_; } //- Return ID of piston patch diff --git a/src/engine/engineValve/engineValve.H b/src/engine/engineValve/engineValve.H index 069257badbe5c0b4b2f2813401de7ca2fd61e090..be702aa9e88dedd08277124ab54d772006468b0e 100644 --- a/src/engine/engineValve/engineValve.H +++ b/src/engine/engineValve/engineValve.H @@ -197,7 +197,7 @@ public: //- Return coordinate system const coordinateSystem& cs() const { - return csPtr_(); + return *csPtr_; } //- Return lift profile diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H index cc18a818b4bee865712a1410dfda01bf9957ddb5..236bef78370381e89ad3f8a062ed6e9eaa9cf60f 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H @@ -174,7 +174,7 @@ public: autoPtr<MRFZone> clone() const { NotImplemented; - return autoPtr<MRFZone>(nullptr); + return autoPtr<MRFZone>(); } diff --git a/src/finiteVolume/cfdTools/general/fvOptions/fvOption.H b/src/finiteVolume/cfdTools/general/fvOptions/fvOption.H index cab111236859da53856dd0f6b222b3eb04d5a66f..45be00daa8d058ae7d6423a3094c1c10120d10bf 100644 --- a/src/finiteVolume/cfdTools/general/fvOptions/fvOption.H +++ b/src/finiteVolume/cfdTools/general/fvOptions/fvOption.H @@ -133,7 +133,7 @@ public: autoPtr<option> clone() const { NotImplemented; - return autoPtr<option>(nullptr); + return autoPtr<option>(); } //- Return pointer to new fvOption object created diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C index 4ca403cdf07b49893ad3aa2cff7617ff0f288305..d2d430537637d3419697823bac593d5cbd4b5e80 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C @@ -101,7 +101,7 @@ Foam::porosityModel::porosityModel active_(true), zoneName_(cellZoneName), cellZoneIDs_(), - coordSys_(coordinateSystem::New(mesh, coeffs_)) + coordSys_(*(coordinateSystem::New(mesh, coeffs_))) { if (zoneName_ == word::null) { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C index 513056ab6b4b6bd152fa5f6615f5b9fb30cf2fbf..95c50f56aaac4ebd46a98cbb4158aa7034ba47f7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C @@ -283,7 +283,7 @@ Foam::codedFixedValueFvPatchField<Type>::redirectPatchField() const ).ptr() ); } - return redirectPatchFieldPtr_(); + return *redirectPatchFieldPtr_; } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C index d122e90f892ceceadbfb3775975879d60bb368d2..f03e966e152fb9d646c6ca03d55cff1f43f2a142 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C @@ -291,7 +291,7 @@ Foam::codedMixedFvPatchField<Type>::redirectPatchField() const ) ); } - return redirectPatchFieldPtr_(); + return *redirectPatchFieldPtr_; } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C index 31a67024a518c0203657eece4eca3ce002decea1..6e053a21e25de9a30f8de333099fd5d5a8d1ce95 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C @@ -60,9 +60,9 @@ cylindricalInletVelocityFvPatchVectorField fixedValueFvPatchField<vector>(ptf, p, iF, mapper), centre_(ptf.centre_), axis_(ptf.axis_), - axialVelocity_(ptf.axialVelocity_, false), - radialVelocity_(ptf.radialVelocity_, false), - rpm_(ptf.rpm_, false) + axialVelocity_(ptf.axialVelocity_.clone()), + radialVelocity_(ptf.radialVelocity_.clone()), + rpm_(ptf.rpm_.clone()) {} @@ -92,9 +92,9 @@ cylindricalInletVelocityFvPatchVectorField fixedValueFvPatchField<vector>(ptf), centre_(ptf.centre_), axis_(ptf.axis_), - axialVelocity_(ptf.axialVelocity_, false), - radialVelocity_(ptf.radialVelocity_, false), - rpm_(ptf.rpm_, false) + axialVelocity_(ptf.axialVelocity_.clone()), + radialVelocity_(ptf.radialVelocity_.clone()), + rpm_(ptf.rpm_.clone()) {} @@ -108,9 +108,9 @@ cylindricalInletVelocityFvPatchVectorField fixedValueFvPatchField<vector>(ptf, iF), centre_(ptf.centre_), axis_(ptf.axis_), - axialVelocity_(ptf.axialVelocity_, false), - radialVelocity_(ptf.radialVelocity_, false), - rpm_(ptf.rpm_, false) + axialVelocity_(ptf.axialVelocity_.clone()), + radialVelocity_(ptf.radialVelocity_.clone()), + rpm_(ptf.rpm_.clone()) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedMean/fixedMeanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedMean/fixedMeanFvPatchField.C index 648b7169666471adb79f25d88cb3aa263984e867..7ff37d287e8f531df9c3b8b198972a91db9e01d9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedMean/fixedMeanFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedMean/fixedMeanFvPatchField.C @@ -65,7 +65,7 @@ Foam::fixedMeanFvPatchField<Type>::fixedMeanFvPatchField ) : fixedValueFvPatchField<Type>(ptf, p, iF, mapper), - meanValue_(ptf.meanValue_, false) + meanValue_(ptf.meanValue_.clone()) {} @@ -76,7 +76,7 @@ Foam::fixedMeanFvPatchField<Type>::fixedMeanFvPatchField ) : fixedValueFvPatchField<Type>(ptf), - meanValue_(ptf.meanValue_, false) + meanValue_(ptf.meanValue_.clone()) {} @@ -88,7 +88,7 @@ Foam::fixedMeanFvPatchField<Type>::fixedMeanFvPatchField ) : fixedValueFvPatchField<Type>(ptf, iF), - meanValue_(ptf.meanValue_, false) + meanValue_(ptf.meanValue_.clone()) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedProfile/fixedProfileFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedProfile/fixedProfileFvPatchField.C index 1deba5890f7824ffbf344ede020aa7aa93829e1c..0d97a44926bff6563cd0120d07232dfe71a3a845 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedProfile/fixedProfileFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedProfile/fixedProfileFvPatchField.C @@ -94,7 +94,7 @@ Foam::fixedProfileFvPatchField<Type>::fixedProfileFvPatchField ) : fixedValueFvPatchField<Type>(p, iF), // Don't map - profile_(ptf.profile_, false), + profile_(ptf.profile_.clone()), dir_(ptf.dir_), origin_(ptf.origin_) { @@ -110,7 +110,7 @@ Foam::fixedProfileFvPatchField<Type>::fixedProfileFvPatchField ) : fixedValueFvPatchField<Type>(ptf), - profile_(ptf.profile_, false), + profile_(ptf.profile_.clone()), dir_(ptf.dir_), origin_(ptf.origin_) {} @@ -124,7 +124,7 @@ Foam::fixedProfileFvPatchField<Type>::fixedProfileFvPatchField ) : fixedValueFvPatchField<Type>(ptf, iF), - profile_(ptf.profile_, false), + profile_(ptf.profile_.clone()), dir_(ptf.dir_), origin_(ptf.origin_) { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C index f40f399ad344ba7f9d8394a7c5ff4f418edf20bf..5f4122b704df9f5bc6c50751c34dc6d79ad94279 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C @@ -107,7 +107,7 @@ flowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(ptf, p, iF, mapper), - flowRate_(ptf.flowRate_, false), + flowRate_(ptf.flowRate_.clone()), volumetric_(ptf.volumetric_), rhoName_(ptf.rhoName_), rhoInlet_(ptf.rhoInlet_), @@ -122,7 +122,7 @@ flowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(ptf), - flowRate_(ptf.flowRate_, false), + flowRate_(ptf.flowRate_.clone()), volumetric_(ptf.volumetric_), rhoName_(ptf.rhoName_), rhoInlet_(ptf.rhoInlet_), @@ -138,7 +138,7 @@ flowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(ptf, iF), - flowRate_(ptf.flowRate_, false), + flowRate_(ptf.flowRate_.clone()), volumetric_(ptf.volumetric_), rhoName_(ptf.rhoName_), rhoInlet_(ptf.rhoInlet_), diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateOutletVelocity/flowRateOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/flowRateOutletVelocity/flowRateOutletVelocityFvPatchVectorField.C index ed9d095a2a1353753201fcd6f14a5fc48fff57a9..88e9c9848c1511369f9acb778366ffff58f2a5e0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateOutletVelocity/flowRateOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateOutletVelocity/flowRateOutletVelocityFvPatchVectorField.C @@ -102,7 +102,7 @@ flowRateOutletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(ptf, p, iF, mapper), - flowRate_(ptf.flowRate_, false), + flowRate_(ptf.flowRate_.clone()), volumetric_(ptf.volumetric_), rhoName_(ptf.rhoName_), rhoOutlet_(ptf.rhoOutlet_) @@ -116,7 +116,7 @@ flowRateOutletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(ptf), - flowRate_(ptf.flowRate_, false), + flowRate_(ptf.flowRate_.clone()), volumetric_(ptf.volumetric_), rhoName_(ptf.rhoName_), rhoOutlet_(ptf.rhoOutlet_) @@ -131,7 +131,7 @@ flowRateOutletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(ptf, iF), - flowRate_(ptf.flowRate_, false), + flowRate_(ptf.flowRate_.clone()), volumetric_(ptf.volumetric_), rhoName_(ptf.rhoName_), rhoOutlet_(ptf.rhoOutlet_) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C index edaca467e2ee6e39d14f237185f718f3ab53de0e..39532ed2f07fe54d51ee31c612485e95063dcaee 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C @@ -71,7 +71,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField ) : pressureInletOutletVelocityFvPatchVectorField(ptf, p, iF, mapper), - omega_(ptf.omega_, false) + omega_(ptf.omega_.clone()) { calcTangentialVelocity(); } @@ -100,7 +100,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField ) : pressureInletOutletVelocityFvPatchVectorField(rppvf), - omega_(rppvf.omega_, false) + omega_(rppvf.omega_.clone()) { calcTangentialVelocity(); } @@ -114,7 +114,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField ) : pressureInletOutletVelocityFvPatchVectorField(rppvf, iF), - omega_(rppvf.omega_, false) + omega_(rppvf.omega_.clone()) { calcTangentialVelocity(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H index ddb6cc5df4e01ee21f0f650b82b4ef07e1d385ee..c46d3b6edb62eba22a16c6d84c681a3d7bbed156 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H @@ -38,7 +38,7 @@ Usage Property | Description | Required | Default value phi | flux field name | no | phi tangentialVelocity | tangential velocity field | no | - omega | angular velocty of the frame [rad/s] | yes | + omega | angular velocity of the frame [rad/s] | yes | \endtable Example of the boundary condition specification: diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C index 5d1df66c792aa999803d775752b2069a265e756f..c5fdd7863978cb04e6a4efd7e033324819889d2b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C @@ -53,7 +53,7 @@ rotatingTotalPressureFvPatchScalarField ) : totalPressureFvPatchScalarField(ptf, p, iF, mapper), - omega_(ptf.omega_, false) + omega_(ptf.omega_.clone()) {} @@ -77,7 +77,7 @@ rotatingTotalPressureFvPatchScalarField ) : totalPressureFvPatchScalarField(rtppsf), - omega_(rtppsf.omega_, false) + omega_(rtppsf.omega_.clone()) {} @@ -89,7 +89,7 @@ rotatingTotalPressureFvPatchScalarField ) : totalPressureFvPatchScalarField(rtppsf, iF), - omega_(rtppsf.omega_, false) + omega_(rtppsf.omega_.clone()) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C index d322862f4a6bb647b2fa3c01044d5be716c01a40..c35b7a3c3ff71592fc5399b5e8fb6b4070ea6a2d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C @@ -40,7 +40,7 @@ rotatingWallVelocityFvPatchVectorField fixedValueFvPatchField<vector>(p, iF), origin_(), axis_(Zero), - omega_(0) + omega_(nullptr) {} @@ -84,7 +84,7 @@ rotatingWallVelocityFvPatchVectorField fixedValueFvPatchField<vector>(ptf, p, iF, mapper), origin_(ptf.origin_), axis_(ptf.axis_), - omega_(ptf.omega_, false) + omega_(ptf.omega_.clone()) {} @@ -97,7 +97,7 @@ rotatingWallVelocityFvPatchVectorField fixedValueFvPatchField<vector>(rwvpvf), origin_(rwvpvf.origin_), axis_(rwvpvf.axis_), - omega_(rwvpvf.omega_, false) + omega_(rwvpvf.omega_.clone()) {} @@ -111,7 +111,7 @@ rotatingWallVelocityFvPatchVectorField fixedValueFvPatchField<vector>(rwvpvf, iF), origin_(rwvpvf.origin_), axis_(rwvpvf.axis_), - omega_(rwvpvf.omega_, false) + omega_(rwvpvf.omega_.clone()) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C index cba888cc6b9bf1c49ae2d4fa6852d704b9a80deb..ebe4ebdd58a4ba90db0ba11e609bb918683008c7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C @@ -99,8 +99,8 @@ swirlFlowRateInletVelocityFvPatchVectorField rhoName_(ptf.rhoName_), origin_(ptf.origin_), axis_(ptf.axis_), - flowRate_(ptf.flowRate_, false), - rpm_(ptf.rpm_, false) + flowRate_(ptf.flowRate_.clone()), + rpm_(ptf.rpm_.clone()) {} @@ -115,8 +115,8 @@ swirlFlowRateInletVelocityFvPatchVectorField rhoName_(ptf.rhoName_), origin_(ptf.origin_), axis_(ptf.axis_), - flowRate_(ptf.flowRate_, false), - rpm_(ptf.rpm_, false) + flowRate_(ptf.flowRate_.clone()), + rpm_(ptf.rpm_.clone()) {} @@ -132,8 +132,8 @@ swirlFlowRateInletVelocityFvPatchVectorField rhoName_(ptf.rhoName_), origin_(ptf.origin_), axis_(ptf.axis_), - flowRate_(ptf.flowRate_, false), - rpm_(ptf.rpm_, false) + flowRate_(ptf.flowRate_.clone()), + rpm_(ptf.rpm_.clone()) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/swirlInletVelocity/swirlInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/swirlInletVelocity/swirlInletVelocityFvPatchVectorField.C index 4b76142d9f68069b6564969c4375e5e021d5d3c6..21c42908ddc8b4dfeb075bab956b8400ecb6df34 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/swirlInletVelocity/swirlInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/swirlInletVelocity/swirlInletVelocityFvPatchVectorField.C @@ -56,9 +56,9 @@ swirlInletVelocityFvPatchVectorField fixedValueFvPatchField<vector>(ptf, p, iF, mapper), origin_(ptf.origin_), axis_(ptf.axis_), - axialVelocity_(ptf.axialVelocity_, false), - radialVelocity_(ptf.radialVelocity_, false), - tangentialVelocity_(ptf.tangentialVelocity_, false) + axialVelocity_(ptf.axialVelocity_.clone()), + radialVelocity_(ptf.radialVelocity_.clone()), + tangentialVelocity_(ptf.tangentialVelocity_.clone()) {} @@ -88,9 +88,9 @@ swirlInletVelocityFvPatchVectorField fixedValueFvPatchField<vector>(ptf), origin_(ptf.origin_), axis_(ptf.axis_), - axialVelocity_(ptf.axialVelocity_, false), - radialVelocity_(ptf.radialVelocity_, false), - tangentialVelocity_(ptf.tangentialVelocity_, false) + axialVelocity_(ptf.axialVelocity_.clone()), + radialVelocity_(ptf.radialVelocity_.clone()), + tangentialVelocity_(ptf.tangentialVelocity_.clone()) {} @@ -104,9 +104,9 @@ swirlInletVelocityFvPatchVectorField fixedValueFvPatchField<vector>(ptf, iF), origin_(ptf.origin_), axis_(ptf.axis_), - axialVelocity_(ptf.axialVelocity_, false), - radialVelocity_(ptf.radialVelocity_, false), - tangentialVelocity_(ptf.tangentialVelocity_, false) + axialVelocity_(ptf.axialVelocity_.clone()), + radialVelocity_(ptf.radialVelocity_.clone()), + tangentialVelocity_(ptf.tangentialVelocity_.clone()) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index af626c2c5e4642414009513abed8e5188e73ccf8..0d0e4e0a219c18457fca69f6e0dd4177417cad3a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -141,7 +141,7 @@ timeVaryingMappedFixedValueFvPatchField endSampleTime_(-1), endSampledValues_(0), endAverage_(Zero), - offset_(ptf.offset_, false) + offset_(ptf.offset_.clone()) {} @@ -165,7 +165,7 @@ timeVaryingMappedFixedValueFvPatchField endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), endAverage_(ptf.endAverage_), - offset_(ptf.offset_, false) + offset_(ptf.offset_.clone()) {} @@ -190,7 +190,7 @@ timeVaryingMappedFixedValueFvPatchField endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), endAverage_(ptf.endAverage_), - offset_(ptf.offset_, false) + offset_(ptf.offset_.clone()) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C index d41a42470174efcf903a7810906f9a2ae809c6b6..b9cb8fa6a564df6129050a4b35087c8193ad999c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C @@ -37,7 +37,7 @@ translatingWallVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(p, iF), - U_(0) + U_(nullptr) {} @@ -67,7 +67,7 @@ translatingWallVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(ptf, p, iF, mapper), - U_(ptf.U_, false) + U_(ptf.U_.clone()) {} @@ -78,7 +78,7 @@ translatingWallVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(twvpvf), - U_(twvpvf.U_, false) + U_(twvpvf.U_.clone()) {} @@ -90,7 +90,7 @@ translatingWallVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(twvpvf, iF), - U_(twvpvf.U_, false) + U_(twvpvf.U_.clone()) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C index 22cd511d186e90d7356156b3ac28cd4fb2ebbbf0..a23ffef19fb5249f64fc04dab7cfff05c2683616 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C @@ -235,7 +235,7 @@ Foam::turbulentDFSEMInletFvPatchVectorField::patchMapper() const ); } - return mapperPtr_(); + return *mapperPtr_; } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C index 1bf1f7b08149313784c638f039c848fd5fff5e00..c08fd07f3de60b6f6e5f17a03e4758cf4192190f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C @@ -78,7 +78,7 @@ Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField ) : fixedGradientFvPatchField<Type>(ptf, p, iF, mapper), - uniformGradient_(ptf.uniformGradient_, false) + uniformGradient_(ptf.uniformGradient_.clone()) {} @@ -89,7 +89,7 @@ Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField ) : fixedGradientFvPatchField<Type>(ptf), - uniformGradient_(ptf.uniformGradient_, false) + uniformGradient_(ptf.uniformGradient_.clone()) {} @@ -101,7 +101,7 @@ Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField ) : fixedGradientFvPatchField<Type>(ptf, iF), - uniformGradient_(ptf.uniformGradient_, false) + uniformGradient_(ptf.uniformGradient_.clone()) { // Evaluate the profile if defined if (ptf.uniformGradient_.valid()) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C index e79df9bec06d2dbccd0c3c7541ccb5ca0159ddfa..dc4d7c8a932eb16b7927a1d9267c436136624f7e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C @@ -77,7 +77,7 @@ Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(p, iF), // Don't map - uniformValue_(ptf.uniformValue_, false) + uniformValue_(ptf.uniformValue_.clone()) { // Evaluate since value not mapped this->evaluate(); @@ -91,7 +91,7 @@ Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(ptf), - uniformValue_(ptf.uniformValue_, false) + uniformValue_(ptf.uniformValue_.clone()) {} @@ -103,7 +103,7 @@ Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(ptf, iF), - uniformValue_(ptf.uniformValue_, false) + uniformValue_(ptf.uniformValue_.clone()) { // Evaluate the profile if defined if (ptf.uniformValue_.valid()) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C index 647398f4b054836e001c3e5b0158807e3739aa02..28f623544dff49092b34eae720e59d188b933cb1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C @@ -87,7 +87,7 @@ Foam::uniformInletOutletFvPatchField<Type>::uniformInletOutletFvPatchField : mixedFvPatchField<Type>(p, iF), // Don't map phiName_(ptf.phiName_), - uniformInletValue_(ptf.uniformInletValue_, false) + uniformInletValue_(ptf.uniformInletValue_.clone()) { this->patchType() = ptf.patchType(); @@ -113,7 +113,7 @@ Foam::uniformInletOutletFvPatchField<Type>::uniformInletOutletFvPatchField : mixedFvPatchField<Type>(ptf), phiName_(ptf.phiName_), - uniformInletValue_(ptf.uniformInletValue_, false) + uniformInletValue_(ptf.uniformInletValue_.clone()) {} @@ -126,7 +126,7 @@ Foam::uniformInletOutletFvPatchField<Type>::uniformInletOutletFvPatchField : mixedFvPatchField<Type>(ptf, iF), phiName_(ptf.phiName_), - uniformInletValue_(ptf.uniformInletValue_, false) + uniformInletValue_(ptf.uniformInletValue_.clone()) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C index 31350e62301236aa4cda42a68a58df73b712c4e2..67e199cf4243b27cedac2c383a364ddc0c65d943 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C @@ -49,7 +49,7 @@ Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField ) : fixedJumpFvPatchField<Type>(ptf, p, iF, mapper), - jumpTable_(ptf.jumpTable_, false) + jumpTable_(ptf.jumpTable_.clone()) {} @@ -90,7 +90,7 @@ Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField ) : fixedJumpFvPatchField<Type>(ptf), - jumpTable_(ptf.jumpTable_, false) + jumpTable_(ptf.jumpTable_.clone()) {} @@ -102,7 +102,7 @@ Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField ) : fixedJumpFvPatchField<Type>(ptf, iF), - jumpTable_(ptf.jumpTable_, false) + jumpTable_(ptf.jumpTable_.clone()) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C index 033afb572af634f69585d0778d629d8c2888d594..acf0f8358d91ff0afdff517a7ac76d4e45e7855b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C @@ -49,7 +49,7 @@ Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField ) : fixedJumpAMIFvPatchField<Type>(ptf, p, iF, mapper), - jumpTable_(ptf.jumpTable_, false) + jumpTable_(ptf.jumpTable_.clone()) {} @@ -87,7 +87,7 @@ Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField ) : fixedJumpAMIFvPatchField<Type>(ptf), - jumpTable_(ptf.jumpTable_, false) + jumpTable_(ptf.jumpTable_.clone()) {} @@ -99,7 +99,7 @@ Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField ) : fixedJumpAMIFvPatchField<Type>(ptf, iF), - jumpTable_(ptf.jumpTable_, false) + jumpTable_(ptf.jumpTable_.clone()) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C index ea3c1705c6cf6e668d4494d3d857af0b21028f48..eee8af784c13d2e5ad4321f93b6c842fcad456cb 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C @@ -94,7 +94,7 @@ uniformTotalPressureFvPatchScalarField rhoName_(ptf.rhoName_), psiName_(ptf.psiName_), gamma_(ptf.gamma_), - p0_(ptf.p0_, false) + p0_(ptf.p0_.clone()) { patchType() = ptf.patchType(); @@ -117,7 +117,7 @@ uniformTotalPressureFvPatchScalarField rhoName_(ptf.rhoName_), psiName_(ptf.psiName_), gamma_(ptf.gamma_), - p0_(ptf.p0_, false) + p0_(ptf.p0_.clone()) {} @@ -134,7 +134,7 @@ uniformTotalPressureFvPatchScalarField rhoName_(ptf.rhoName_), psiName_(ptf.psiName_), gamma_(ptf.gamma_), - p0_(ptf.p0_, false) + p0_(ptf.p0_.clone()) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C index 40a7ce65d96c5284a1bef6cdc92ba6697d148c23..56f99f5067f0633877e29bf2ac04ed556a351ebd 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C @@ -66,7 +66,7 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(ptf, p, iF, mapper), - flowRate_(ptf.flowRate_, false), + flowRate_(ptf.flowRate_.clone()), alphaName_(ptf.alphaName_) {} @@ -78,7 +78,7 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(ptf), - flowRate_(ptf.flowRate_, false), + flowRate_(ptf.flowRate_.clone()), alphaName_(ptf.alphaName_) {} @@ -91,7 +91,7 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(ptf, iF), - flowRate_(ptf.flowRate_, false), + flowRate_(ptf.flowRate_.clone()), alphaName_(ptf.alphaName_) {} diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C index a8632062e45bf9a4bb596afc5207635070c7ad91..f6e4482031f3131e073946c1582e6cdc19dd3abc 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C @@ -320,10 +320,9 @@ CrankNicolsonDdtScheme<Type>::CrankNicolsonDdtScheme << exit(FatalIOError); } - ocCoeff_ = new Function1Types::Constant<scalar> + ocCoeff_.reset ( - "ocCoeff", - ocCoeff + new Function1Types::Constant<scalar>("ocCoeff", ocCoeff) ); } else diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCentredCellToCellStencil.H b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCentredCellToCellStencil.H index b38e53594124858158fbd6f904b2224f29c6629f..68a0256bf51a157bb458d0089f6289e57602dfd6 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCentredCellToCellStencil.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCentredCellToCellStencil.H @@ -86,7 +86,7 @@ public: //- Return reference to the parallel distribution map const mapDistribute& map() const { - return mapPtr_(); + return *mapPtr_; } //- Return reference to the stencil diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCentredCellToFaceStencil.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCentredCellToFaceStencil.H index f1a7ce9ebac375fb6bb8f6096fee379557d48b05..5db34ecacfd157dbb39a50dd4a1f619b0092014a 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCentredCellToFaceStencil.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCentredCellToFaceStencil.H @@ -85,7 +85,7 @@ public: //- Return reference to the parallel distribution map const mapDistribute& map() const { - return mapPtr_(); + return *mapPtr_; } //- Return reference to the stencil diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedUpwindCellToFaceStencil.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedUpwindCellToFaceStencil.H index 1ce6ca120975b6a1acaabdf97062945072efdc7d..67824801c31ca5c2e361a92e7629a64dee5358e9 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedUpwindCellToFaceStencil.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedUpwindCellToFaceStencil.H @@ -152,13 +152,13 @@ public: //- Return reference to the parallel distribution map const mapDistribute& ownMap() const { - return ownMapPtr_(); + return *ownMapPtr_; } //- Return reference to the parallel distribution map const mapDistribute& neiMap() const { - return neiMapPtr_(); + return *neiMapPtr_; } //- Return reference to the stencil diff --git a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/extendedCentredFaceToCellStencil.H b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/extendedCentredFaceToCellStencil.H index 3e3f01f50e204b86ab0c55bf3c546f75651d0a17..0c6d6beb01d2143a3aaa417dfc55a0d411e018b5 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/extendedCentredFaceToCellStencil.H +++ b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/extendedCentredFaceToCellStencil.H @@ -85,7 +85,7 @@ public: //- Return reference to the parallel distribution map const mapDistribute& map() const { - return mapPtr_(); + return *mapPtr_; } //- Return reference to the stencil diff --git a/src/functionObjects/field/streamLine/streamLineBase.C b/src/functionObjects/field/streamLine/streamLineBase.C index d6a49bcce5b7746aa32ca2aa7d8566ef30c5e929..d5730ec1ba457bb35c9803d35e0d7316392d8e0d 100644 --- a/src/functionObjects/field/streamLine/streamLineBase.C +++ b/src/functionObjects/field/streamLine/streamLineBase.C @@ -75,7 +75,7 @@ Foam::functionObjects::streamLineBase::sampledSetPoints() const sampledSetAxis_ = sampledSetPtr_->axis(); } - return sampledSetPtr_(); + return *sampledSetPtr_; } diff --git a/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C b/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C index 51917aa5549376e5b061dc8bf62f33c2d67c5ebd..8e2c1c1ffb02321f885f4f29ca9108b7fdb82b5e 100644 --- a/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C +++ b/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C @@ -162,7 +162,7 @@ Foam::functionObjects::codedFunctionObject::redirectFunctionObject() const constructDict ); } - return redirectFunctionObjectPtr_(); + return *redirectFunctionObjectPtr_; } diff --git a/src/functionObjects/utilities/ensightWrite/ensightWrite.H b/src/functionObjects/utilities/ensightWrite/ensightWrite.H index 0386625fb6acf300bd3b1875a3bdce39a8f091db..0d61f4dfab2bd680ded1a4a25bb787968ceded7c 100644 --- a/src/functionObjects/utilities/ensightWrite/ensightWrite.H +++ b/src/functionObjects/utilities/ensightWrite/ensightWrite.H @@ -140,13 +140,13 @@ class ensightWrite //- Ensight case handler ensightCase& ensCase() { - return ensCase_(); + return *ensCase_; } //- Ensight mesh handler ensightMesh& ensMesh() { - return ensMesh_(); + return *ensMesh_; } diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H index bb03b88838632b1042ce8aa94f0da874d8f693d4..7bd9737556f93393d1b5f861268e94d846ae535e 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H @@ -130,7 +130,7 @@ public: //- Return diffusivity motionDiffusivity& diffusivity() { - return diffusivityPtr_(); + return *diffusivityPtr_; } //- Return point location obtained from the current motion field diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C index 96d035e68ae4b648a11fe6be8c86ba6d301b35aa..b656a355735be9a076b34be79cea85f41bdf9595 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C @@ -253,7 +253,8 @@ Foam::displacementLaplacianFvMotionSolver::diffusivity() coeffDict().lookup("diffusivity") ); } - return diffusivityPtr_(); + + return *diffusivityPtr_; } diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/solidBodyDisplacementLaplacian/solidBodyDisplacementLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/solidBodyDisplacementLaplacian/solidBodyDisplacementLaplacianFvMotionSolver.C index 277593506b1f4d84c12a088b6aca4a230cdafec5..cd6fb4caf715c243223a5aef604f7adced152e02 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/solidBodyDisplacementLaplacian/solidBodyDisplacementLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/solidBodyDisplacementLaplacian/solidBodyDisplacementLaplacianFvMotionSolver.C @@ -258,7 +258,8 @@ Foam::solidBodyDisplacementLaplacianFvMotionSolver::diffusivity() coeffDict().lookup("diffusivity") ); } - return diffusivityPtr_(); + + return *diffusivityPtr_; } diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C index 5e2053ef99081e9d34c078a67be271039b84154f..3d0f31a4462de7647c56572718414025ca793adb 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C @@ -411,7 +411,8 @@ Foam::surfaceDisplacementPointPatchVectorField::surfaces() const ) ); } - return surfacesPtr_(); + + return *surfacesPtr_; } diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C index 469cebfb79b848160b298624d9cb40477d4347fc..2f3de5ce6a8cf5732e7ec75109bef52cbc11bcff 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C @@ -397,7 +397,8 @@ Foam::surfaceSlipDisplacementPointPatchVectorField::surfaces() const ) ); } - return surfacesPtr_(); + + return *surfacesPtr_; } diff --git a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C index 1fbcb49f96bdd8ec7d14f2152bb2ced6cbe09c62..93025bfbd1eaff9aeeab867c7cc4219a6e4d0db7 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C @@ -146,7 +146,7 @@ timeVaryingMappedFixedValuePointPatchField endSampleTime_(-1), endSampledValues_(0), endAverage_(Zero), - offset_(ptf.offset_, false) + offset_(ptf.offset_.clone()) {} @@ -170,7 +170,7 @@ timeVaryingMappedFixedValuePointPatchField endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), endAverage_(ptf.endAverage_), - offset_(ptf.offset_, false) + offset_(ptf.offset_.clone()) {} @@ -195,7 +195,7 @@ timeVaryingMappedFixedValuePointPatchField endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), endAverage_(ptf.endAverage_), - offset_(ptf.offset_, false) + offset_(ptf.offset_.clone()) {} diff --git a/src/fvOptions/interRegionOption/interRegionOptionI.H b/src/fvOptions/interRegionOption/interRegionOptionI.H index 738b6993469bf570f3d756a74223e9f5346df568..55d0aa941c060c16572a4e32a68b77d16cb337e9 100644 --- a/src/fvOptions/interRegionOption/interRegionOptionI.H +++ b/src/fvOptions/interRegionOption/interRegionOptionI.H @@ -42,7 +42,7 @@ Foam::fv::interRegionOption::meshInterp() const << abort(FatalError); } - return meshInterpPtr_(); + return *meshInterpPtr_; } diff --git a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C b/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C index 7a7a8ccde7db991d1bea27b65168f93b0cf3db3c..963c0c72fee55f3c59aaeadf09629f995d9b8846 100644 --- a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C +++ b/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C @@ -63,7 +63,7 @@ const Foam::coordinateSystem& Foam::fv::jouleHeatingSource::coordSys() const << abort(FatalError); } - return coordSysPtr_(); + return *coordSysPtr_; } diff --git a/src/fvOptions/sources/general/codedSource/CodedSource.C b/src/fvOptions/sources/general/codedSource/CodedSource.C index 2ea05cf09a8962292ae5bf4ed59330523c817629..567e7d666eb9209b2ac90b125af5c0baa6974252 100644 --- a/src/fvOptions/sources/general/codedSource/CodedSource.C +++ b/src/fvOptions/sources/general/codedSource/CodedSource.C @@ -143,7 +143,7 @@ Foam::fv::option& Foam::fv::CodedSource<Type>::redirectFvOption() const mesh_ ); } - return redirectFvOptionPtr_(); + return *redirectFvOptionPtr_; } diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModelI.H b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModelI.H index c9a57a05d1a46b5e5388be44c178a434af6ef3a4..4fd5ded0fbb97ffa59aa111c4c4dbfffbdf97721 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModelI.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModelI.H @@ -42,14 +42,14 @@ Foam::fv::interRegionHeatTransferModel::meshInterp() const << abort(FatalError); } - return meshInterpPtr_(); + return *meshInterpPtr_; } inline const Foam::volScalarField& Foam::fv::interRegionHeatTransferModel::htc() const { - return htc_; + return htc_; } diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.C b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.C index 86de071e8f9e07a5d2bddc16797320885e807c34..4362a4065a6992d329ef4b6c1a7ea0da416fced8 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.C +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.C @@ -53,7 +53,7 @@ Foam::fv::tabulatedHeatTransfer::hTable() hTable_.reset(new interpolation2DTable<scalar>(coeffs_)); } - return hTable_(); + return *hTable_; } @@ -78,7 +78,7 @@ const Foam::volScalarField& Foam::fv::tabulatedHeatTransfer::AoV() ); } - return AoV_(); + return *AoV_; } diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.C b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.C index 2ba95833c194451975de5066e4a67606344e64bd..7bb32e152b3dd0f7973b1088821c82e9de72f970 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.C +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.C @@ -64,7 +64,7 @@ Foam::fv::tabulatedNTUHeatTransfer::ntuTable() ntuTable_.reset(new interpolation2DTable<scalar>(coeffs_)); } - return ntuTable_(); + return *ntuTable_; } diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.C b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.C index 7fe1bc1a30c3ecda09edb1e90b0a6da723076049..d1d674417423ef9ff1f47d69e025223beda5f8f7 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.C +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.C @@ -89,12 +89,6 @@ Foam::fv::variableHeatTransfer::variableHeatTransfer } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::fv::variableHeatTransfer::~variableHeatTransfer() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::fv::variableHeatTransfer::calculateHtc() @@ -122,7 +116,7 @@ void Foam::fv::variableHeatTransfer::calculateHtc() const scalarField htcNbrMapped(interpolate(htcNbr)); - htc_.primitiveFieldRef() = htcNbrMapped*AoV_; + htc_.primitiveFieldRef() = htcNbrMapped * AoV_(); } diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.H b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.H index e639fc0792868c3bbe7fda736634eedf6c9db7fa..e580cdae201b93d11ac3b76f50d8d412dbe5d74b 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.H @@ -105,7 +105,7 @@ public: //- Destructor - virtual ~variableHeatTransfer(); + virtual ~variableHeatTransfer() = default; // Public Functions @@ -113,11 +113,8 @@ public: //- Calculate the heat transfer coefficient virtual void calculateHtc(); - - // IO - - //- Read dictionary - virtual bool read(const dictionary& dict) ; + //- Read dictionary + virtual bool read(const dictionary& dict); }; diff --git a/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloudI.H b/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloudI.H index 38c9fd3a3904c2f5b4994695f4100cd29be0489f..5d4d63f2796eb442f7c34b66ec6fe62356aca308 100644 --- a/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloudI.H +++ b/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloudI.H @@ -216,7 +216,7 @@ template<class ParcelType> inline Foam::BinaryCollisionModel<Foam::DSMCCloud<ParcelType>>& Foam::DSMCCloud<ParcelType>::binaryCollision() { - return binaryCollisionModel_(); + return *binaryCollisionModel_; } @@ -224,7 +224,7 @@ template<class ParcelType> inline const Foam::WallInteractionModel<Foam::DSMCCloud<ParcelType>>& Foam::DSMCCloud<ParcelType>::wallInteraction() const { - return wallInteractionModel_; + return *wallInteractionModel_; } @@ -232,7 +232,7 @@ template<class ParcelType> inline Foam::WallInteractionModel<Foam::DSMCCloud<ParcelType>>& Foam::DSMCCloud<ParcelType>::wallInteraction() { - return wallInteractionModel_(); + return *wallInteractionModel_; } @@ -240,7 +240,7 @@ template<class ParcelType> inline const Foam::InflowBoundaryModel<Foam::DSMCCloud<ParcelType>>& Foam::DSMCCloud<ParcelType>::inflowBoundary() const { - return inflowBoundaryModel_; + return *inflowBoundaryModel_; } @@ -248,7 +248,7 @@ template<class ParcelType> inline Foam::InflowBoundaryModel<Foam::DSMCCloud<ParcelType>>& Foam::DSMCCloud<ParcelType>::inflowBoundary() { - return inflowBoundaryModel_(); + return *inflowBoundaryModel_; } diff --git a/src/lagrangian/basic/InteractionLists/InteractionListsI.H b/src/lagrangian/basic/InteractionLists/InteractionListsI.H index 979367cd377b8079b25c22ccde3e87cdce3d7c67..6882cc9d8025c33b65d33a1ffb6b143850aba4bd 100644 --- a/src/lagrangian/basic/InteractionLists/InteractionListsI.H +++ b/src/lagrangian/basic/InteractionLists/InteractionListsI.H @@ -38,7 +38,7 @@ template<class ParticleType> const Foam::mapDistribute& Foam::InteractionLists<ParticleType>::cellMap() const { - return cellMapPtr_(); + return *cellMapPtr_; } @@ -46,7 +46,7 @@ template<class ParticleType> const Foam::mapDistribute& Foam::InteractionLists<ParticleType>::wallFaceMap() const { - return wallFaceMapPtr_(); + return *wallFaceMapPtr_; } diff --git a/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloudI.H b/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloudI.H index cb4ec402a1d648323c1cdabdf0fade100ed93422..d5320d44fe96149eb8e79df2517e6ebd662729bf 100644 --- a/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloudI.H @@ -29,7 +29,7 @@ template<class CloudType> inline const Foam::CollidingCloud<CloudType>& Foam::CollidingCloud<CloudType>::cloudCopy() const { - return cloudCopyPtr_(); + return *cloudCopyPtr_; } @@ -45,7 +45,7 @@ template<class CloudType> inline const Foam::CollisionModel<Foam::CollidingCloud<CloudType>>& Foam::CollidingCloud<CloudType>::collision() const { - return collisionModel_(); + return *collisionModel_; } @@ -53,7 +53,7 @@ template<class CloudType> inline Foam::CollisionModel<Foam::CollidingCloud<CloudType>>& Foam::CollidingCloud<CloudType>::collision() { - return collisionModel_(); + return *collisionModel_; } diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index 3e229fa1e65a3cd8f321ed4a9f970fce25819ae5..84c7b8531524dcaafa44d5b4f30d3bf6e37202d9 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -539,13 +539,6 @@ Foam::KinematicCloud<CloudType>::KinematicCloud {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class CloudType> -Foam::KinematicCloud<CloudType>::~KinematicCloud() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index 4b93cd33292bc3cccfe4ee904ac6408525e14f50..fdfb60c087041d944d334dfffe0d779381a1333b 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -325,7 +325,7 @@ public: //- Destructor - virtual ~KinematicCloud(); + virtual ~KinematicCloud() = default; // Member Functions diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index f5ac343730d0ce00b0aa08396af6fc3fd70ed33f..bdb245e6e5d9d04c846de1e496326137fd23a1ae 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -32,7 +32,7 @@ template<class CloudType> inline const Foam::KinematicCloud<CloudType>& Foam::KinematicCloud<CloudType>::cloudCopy() const { - return cloudCopyPtr_(); + return *cloudCopyPtr_; } @@ -192,7 +192,7 @@ template<class CloudType> inline const Foam::DispersionModel<Foam::KinematicCloud<CloudType>>& Foam::KinematicCloud<CloudType>::dispersion() const { - return dispersionModel_; + return *dispersionModel_; } @@ -200,7 +200,7 @@ template<class CloudType> inline Foam::DispersionModel<Foam::KinematicCloud<CloudType>>& Foam::KinematicCloud<CloudType>::dispersion() { - return dispersionModel_(); + return *dispersionModel_; } @@ -208,7 +208,7 @@ template<class CloudType> inline const Foam::PatchInteractionModel<Foam::KinematicCloud<CloudType>>& Foam::KinematicCloud<CloudType>::patchInteraction() const { - return patchInteractionModel_; + return *patchInteractionModel_; } @@ -216,7 +216,7 @@ template<class CloudType> inline Foam::PatchInteractionModel<Foam::KinematicCloud<CloudType>>& Foam::KinematicCloud<CloudType>::patchInteraction() { - return patchInteractionModel_(); + return *patchInteractionModel_; } @@ -224,7 +224,7 @@ template<class CloudType> inline const Foam::StochasticCollisionModel<Foam::KinematicCloud<CloudType>>& Foam::KinematicCloud<CloudType>::stochasticCollision() const { - return stochasticCollisionModel_(); + return *stochasticCollisionModel_; } @@ -232,7 +232,7 @@ template<class CloudType> inline Foam::StochasticCollisionModel<Foam::KinematicCloud<CloudType>>& Foam::KinematicCloud<CloudType>::stochasticCollision() { - return stochasticCollisionModel_(); + return *stochasticCollisionModel_; } @@ -240,7 +240,7 @@ template<class CloudType> inline const Foam::SurfaceFilmModel<Foam::KinematicCloud<CloudType>>& Foam::KinematicCloud<CloudType>::surfaceFilm() const { - return surfaceFilmModel_(); + return *surfaceFilmModel_; } @@ -248,7 +248,7 @@ template<class CloudType> inline Foam::SurfaceFilmModel<Foam::KinematicCloud<CloudType>>& Foam::KinematicCloud<CloudType>::surfaceFilm() { - return surfaceFilmModel_(); + return *surfaceFilmModel_; } @@ -256,7 +256,7 @@ template<class CloudType> inline const Foam::vectorIntegrationScheme& Foam::KinematicCloud<CloudType>::UIntegrator() const { - return UIntegrator_; + return *UIntegrator_; } @@ -371,7 +371,7 @@ Foam::KinematicCloud<CloudType>::cellOccupancy() buildCellOccupancy(); } - return cellOccupancyPtr_(); + return *cellOccupancyPtr_; } @@ -387,7 +387,7 @@ template<class CloudType> inline Foam::DimensionedField<Foam::vector, Foam::volMesh>& Foam::KinematicCloud<CloudType>::UTrans() { - return UTrans_(); + return *UTrans_; } @@ -395,7 +395,7 @@ template<class CloudType> inline const Foam::DimensionedField<Foam::vector, Foam::volMesh>& Foam::KinematicCloud<CloudType>::UTrans() const { - return UTrans_(); + return *UTrans_; } @@ -403,7 +403,7 @@ template<class CloudType> inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>& Foam::KinematicCloud<CloudType>::UCoeff() { - return UCoeff_(); + return *UCoeff_; } @@ -411,7 +411,7 @@ template<class CloudType> inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>& Foam::KinematicCloud<CloudType>::UCoeff() const { - return UCoeff_(); + return *UCoeff_; } diff --git a/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloudI.H b/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloudI.H index 7d8dee80b9709097632f48d44a21d3acc738201c..ee65971bf9de40d61c9a0cd0599ae5105a3ad9c0 100644 --- a/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloudI.H @@ -29,7 +29,7 @@ template<class CloudType> inline const Foam::MPPICCloud<CloudType>& Foam::MPPICCloud<CloudType>::cloudCopy() const { - return cloudCopyPtr_(); + return *cloudCopyPtr_; } @@ -37,7 +37,7 @@ template<class CloudType> inline const Foam::PackingModel<Foam::MPPICCloud<CloudType>>& Foam::MPPICCloud<CloudType>::packingModel() const { - return packingModel_(); + return *packingModel_; } @@ -45,7 +45,7 @@ template<class CloudType> inline Foam::PackingModel<Foam::MPPICCloud<CloudType>>& Foam::MPPICCloud<CloudType>::packingModel() { - return packingModel_(); + return *packingModel_; } @@ -53,7 +53,7 @@ template<class CloudType> inline const Foam::DampingModel<Foam::MPPICCloud<CloudType>>& Foam::MPPICCloud<CloudType>::dampingModel() const { - return dampingModel_(); + return *dampingModel_; } @@ -61,7 +61,7 @@ template<class CloudType> inline Foam::DampingModel<Foam::MPPICCloud<CloudType>>& Foam::MPPICCloud<CloudType>::dampingModel() { - return dampingModel_(); + return *dampingModel_; } @@ -69,7 +69,7 @@ template<class CloudType> inline const Foam::IsotropyModel<Foam::MPPICCloud<CloudType>>& Foam::MPPICCloud<CloudType>::isotropyModel() const { - return isotropyModel_(); + return *isotropyModel_; } @@ -77,7 +77,7 @@ template<class CloudType> inline Foam::IsotropyModel<Foam::MPPICCloud<CloudType>>& Foam::MPPICCloud<CloudType>::isotropyModel() { - return isotropyModel_(); + return *isotropyModel_; } diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C index fc52c1abaf9957cbd00b0b5cd01786bad9b9372a..ffb70989bcdb9baa6bc9cfb76c00c221e172f742 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -203,13 +203,6 @@ Foam::ReactingCloud<CloudType>::ReactingCloud {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class CloudType> -Foam::ReactingCloud<CloudType>::~ReactingCloud() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H index bfb0952677bb37eeb70d2ec701dfcd9ca5e5d456..22ab3b5b38c83fd18463e8af4726910f273f7578 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H @@ -195,7 +195,7 @@ public: //- Destructor - virtual ~ReactingCloud(); + virtual ~ReactingCloud() = default; // Member Functions diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H index 667cff55fdd5ce29abcec7bc2b2f07c1823316d4..7aa240ba2ae053c992e98273871d5ece2862415e 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H @@ -29,7 +29,7 @@ template<class CloudType> inline const Foam::ReactingCloud<CloudType>& Foam::ReactingCloud<CloudType>::cloudCopy() const { - return cloudCopyPtr_(); + return *cloudCopyPtr_; } @@ -53,7 +53,7 @@ template<class CloudType> inline const Foam::CompositionModel<Foam::ReactingCloud<CloudType>>& Foam::ReactingCloud<CloudType>::composition() const { - return compositionModel_; + return *compositionModel_; } @@ -61,7 +61,7 @@ template<class CloudType> inline const Foam::PhaseChangeModel<Foam::ReactingCloud<CloudType>>& Foam::ReactingCloud<CloudType>::phaseChange() const { - return phaseChangeModel_; + return *phaseChangeModel_; } @@ -69,7 +69,7 @@ template<class CloudType> inline Foam::PhaseChangeModel<Foam::ReactingCloud<CloudType>>& Foam::ReactingCloud<CloudType>::phaseChange() { - return phaseChangeModel_(); + return *phaseChangeModel_; } diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloudI.H index c7aa0e4aaffa252f119824f4bf73fb983a949e55..20816c1f195b16bf62458da19e18d23c55a61d65 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloudI.H @@ -29,7 +29,7 @@ template<class CloudType> inline const Foam::ReactingMultiphaseCloud<CloudType>& Foam::ReactingMultiphaseCloud<CloudType>::cloudCopy() const { - return cloudCopyPtr_(); + return *cloudCopyPtr_; } @@ -67,7 +67,7 @@ inline Foam::DevolatilisationModel >& Foam::ReactingMultiphaseCloud<CloudType>::devolatilisation() { - return devolatilisationModel_(); + return *devolatilisationModel_; } @@ -89,7 +89,7 @@ inline Foam::SurfaceReactionModel >& Foam::ReactingMultiphaseCloud<CloudType>::surfaceReaction() { - return surfaceReactionModel_(); + return *surfaceReactionModel_; } diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C index 2f1248ae2f28c024ae4cf141d0fb0092a2f8dc06..85e26f49dbe9a6367d5be2f2425583f040c60c85 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C @@ -346,13 +346,6 @@ Foam::ThermoCloud<CloudType>::ThermoCloud {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class CloudType> -Foam::ThermoCloud<CloudType>::~ThermoCloud() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H index fa99a67d86a7f2fa39afe7d93173be6e08c410f3..c2111c4617bc252c4b66d99bf6381e45c16e205f 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H @@ -214,7 +214,7 @@ public: //- Destructor - virtual ~ThermoCloud(); + virtual ~ThermoCloud() = default; // Member Functions diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H index e61c2e990129347882163c7cffbbd9f500235cc3..d36a15421b6ad2a72e50594d1ad90e8951da7d9f 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H @@ -33,7 +33,7 @@ template<class CloudType> inline const Foam::ThermoCloud<CloudType>& Foam::ThermoCloud<CloudType>::cloudCopy() const { - return cloudCopyPtr_(); + return *cloudCopyPtr_; } @@ -78,7 +78,7 @@ template<class CloudType> inline const Foam::HeatTransferModel<Foam::ThermoCloud<CloudType>>& Foam::ThermoCloud<CloudType>::heatTransfer() const { - return heatTransferModel_; + return *heatTransferModel_; } @@ -86,7 +86,7 @@ template<class CloudType> inline const Foam::scalarIntegrationScheme& Foam::ThermoCloud<CloudType>::TIntegrator() const { - return TIntegrator_; + return *TIntegrator_; } @@ -108,7 +108,7 @@ Foam::ThermoCloud<CloudType>::radAreaP() << abort(FatalError); } - return radAreaP_(); + return *radAreaP_; } @@ -123,7 +123,7 @@ Foam::ThermoCloud<CloudType>::radAreaP() const << abort(FatalError); } - return radAreaP_(); + return *radAreaP_; } @@ -138,7 +138,7 @@ Foam::ThermoCloud<CloudType>::radT4() << abort(FatalError); } - return radT4_(); + return *radT4_; } @@ -153,7 +153,7 @@ Foam::ThermoCloud<CloudType>::radT4() const << abort(FatalError); } - return radT4_(); + return *radT4_; } @@ -168,7 +168,7 @@ Foam::ThermoCloud<CloudType>::radAreaPT4() << abort(FatalError); } - return radAreaPT4_(); + return *radAreaPT4_; } @@ -183,7 +183,7 @@ Foam::ThermoCloud<CloudType>::radAreaPT4() const << abort(FatalError); } - return radAreaPT4_(); + return *radAreaPT4_; } @@ -191,7 +191,7 @@ template<class CloudType> inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>& Foam::ThermoCloud<CloudType>::hsTrans() { - return hsTrans_(); + return *hsTrans_; } @@ -199,7 +199,7 @@ template<class CloudType> inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>& Foam::ThermoCloud<CloudType>::hsTrans() const { - return hsTrans_(); + return *hsTrans_; } @@ -207,7 +207,7 @@ template<class CloudType> inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>& Foam::ThermoCloud<CloudType>::hsCoeff() { - return hsCoeff_(); + return *hsCoeff_; } @@ -215,7 +215,7 @@ template<class CloudType> inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>& Foam::ThermoCloud<CloudType>::hsCoeff() const { - return hsCoeff_(); + return *hsCoeff_; } @@ -388,10 +388,8 @@ inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmax() const { return T; } - else - { - return 0.0; - } + + return 0.0; } @@ -414,10 +412,8 @@ inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmin() const { return T; } - else - { - return 0.0; - } + + return 0.0; } diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelTrackingDataI.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelTrackingDataI.H index 72806a9fe39df8c3b695218fd0d50efa0e858644..84f26210093a83cfc80c79ed79876b49f3b06348 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelTrackingDataI.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelTrackingDataI.H @@ -68,7 +68,7 @@ template<class ParcelType> inline const Foam::interpolation<Foam::scalar>& Foam::KinematicParcel<ParcelType>::trackingData::rhoInterp() const { - return rhoInterp_(); + return *rhoInterp_; } @@ -76,7 +76,7 @@ template<class ParcelType> inline const Foam::interpolation<Foam::vector>& Foam::KinematicParcel<ParcelType>::trackingData::UInterp() const { - return UInterp_(); + return *UInterp_; } @@ -84,7 +84,7 @@ template<class ParcelType> inline const Foam::interpolation<Foam::scalar>& Foam::KinematicParcel<ParcelType>::trackingData::muInterp() const { - return muInterp_(); + return *muInterp_; } diff --git a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelTrackingDataI.H b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelTrackingDataI.H index 532f22ea7a20c45cefedc50d0d3dad0fc2bb7f39..b6bf5cd4521894d787e90310650f30d113f3da21 100644 --- a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelTrackingDataI.H +++ b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelTrackingDataI.H @@ -186,8 +186,8 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages } volumeAverage_->average(); massAverage_->average(); - rhoAverage_->average(massAverage_); - uAverage_->average(massAverage_); + rhoAverage_->average(*massAverage_); + uAverage_->average(*massAverage_); // squared velocity deviation forAllConstIter(typename TrackCloudType, cloud, iter) @@ -204,7 +204,7 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages p.nParticle()*p.mass()*magSqr(p.U() - u) ); } - uSqrAverage_->average(massAverage_); + uSqrAverage_->average(*massAverage_); // sauter mean radius radiusAverage_() = volumeAverage_(); diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelTrackingDataI.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelTrackingDataI.H index 80bccae5d3bc2e4d9aa6ea59b202c74e87d5f8d8..964a7f358161f39a04640c55e00b752bc0ddc62b 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelTrackingDataI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelTrackingDataI.H @@ -48,7 +48,7 @@ template<class ParcelType> inline const Foam::interpolation<Foam::scalar>& Foam::ReactingParcel<ParcelType>::trackingData::pInterp() const { - return pInterp_(); + return *pInterp_; } diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelTrackingDataI.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelTrackingDataI.H index 5ea8189bce95f0bde9fb9df3b4311142da617422..0b1c008c5e511193ab6b856f7f67ff534abee1c4 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelTrackingDataI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelTrackingDataI.H @@ -97,7 +97,7 @@ template<class ParcelType> inline const Foam::interpolation<Foam::scalar>& Foam::ThermoParcel<ParcelType>::trackingData::TInterp() const { - return TInterp_(); + return *TInterp_; } @@ -105,7 +105,7 @@ template<class ParcelType> inline const Foam::interpolation<Foam::scalar>& Foam::ThermoParcel<ParcelType>::trackingData::CpInterp() const { - return CpInterp_(); + return *CpInterp_; } @@ -113,7 +113,7 @@ template<class ParcelType> inline const Foam::interpolation<Foam::scalar>& Foam::ThermoParcel<ParcelType>::trackingData::kappaInterp() const { - return kappaInterp_(); + return *kappaInterp_; } @@ -128,7 +128,7 @@ Foam::ThermoParcel<ParcelType>::trackingData::GInterp() const << abort(FatalError); } - return GInterp_(); + return *GInterp_; } diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracksI.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracksI.H index 8e64611fbf6fe2ca05b196e9f30385b7cfbfc12d..c2fc46322217b8756c580ca8a9c9094298653126 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracksI.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracksI.H @@ -60,7 +60,7 @@ template<class CloudType> inline const Foam::Cloud<typename CloudType::parcelType>& Foam::ParticleTracks<CloudType>::cloud() const { - return cloudPtr_(); + return *cloudPtr_; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C index 1e39c9050ac72531a637ecb9b813367d74d87515..4c38895e323d85b00a9c7f400b77d24291573c9f 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C @@ -204,7 +204,7 @@ Foam::CellZoneInjection<CloudType>::CellZoneInjection injectorTetPts_(im.injectorTetPts_), diameters_(im.diameters_), U0_(im.U0_), - sizeDistribution_(im.sizeDistribution_, false) + sizeDistribution_(im.sizeDistribution_.clone()) {} diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C index 6651a9573feeb71b6e68a2dfa9b00265961328c1..d141ce77fecf3d955b341ed8aabc2d87b28267d8 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C @@ -147,7 +147,7 @@ Foam::ConeInjection<CloudType>::ConeInjection Umag_(im.Umag_), thetaInner_(im.thetaInner_), thetaOuter_(im.thetaOuter_), - sizeDistribution_(im.sizeDistribution_, false), + sizeDistribution_(im.sizeDistribution_.clone()), nInjected_(im.nInjected_), tanVec1_(im.tanVec1_), tanVec2_(im.tanVec2_) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C index 6ac062ee574c727af5a45f1e1dd5efc91084c7af..4e9e3b3002dc073a2e8a8d0095b29d611dc7869d 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C @@ -223,7 +223,7 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection flowRateProfile_(im.flowRateProfile_), thetaInner_(im.thetaInner_), thetaOuter_(im.thetaOuter_), - sizeDistribution_(im.sizeDistribution_, false), + sizeDistribution_(im.sizeDistribution_.clone()), tanVec1_(im.tanVec1_), tanVec2_(im.tanVec2_), normal_(im.normal_), diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C index 70daf04625d11a17cafd6210a0004dcced85b84d..0c457d1ad8ae19392a4abf5a9992f40857f76893 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C @@ -119,7 +119,7 @@ Foam::FieldActivatedInjection<CloudType>::FieldActivatedInjection nParcelsInjected_(im.nParcelsInjected_), U0_(im.U0_), diameters_(im.diameters_), - sizeDistribution_(im.sizeDistribution_, false) + sizeDistribution_(im.sizeDistribution_.clone()) {} diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C index 98bd08e71da9cb73263525053cd2d0ca4446ae41..aa978877f9781a1241031233b68674525cb544f8 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C @@ -140,7 +140,7 @@ Foam::InflationInjection<CloudType>::InflationInjection fraction_(im.fraction_), selfSeed_(im.selfSeed_), dSeed_(im.dSeed_), - sizeDistribution_(im.sizeDistribution_, false) + sizeDistribution_(im.sizeDistribution_.clone()) {} diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C index 4898bc12da568e1cda7c95f57a8bd707d544dd13..8a15f16d574d0d5c3363c3604faac07d32edc874 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C @@ -97,7 +97,7 @@ Foam::ManualInjection<CloudType>::ManualInjection injectorTetFaces_(im.injectorTetFaces_), injectorTetPts_(im.injectorTetPts_), U0_(im.U0_), - sizeDistribution_(im.sizeDistribution_, false), + sizeDistribution_(im.sizeDistribution_.clone()), ignoreOutOfBounds_(im.ignoreOutOfBounds_) {} diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchFlowRateInjection/PatchFlowRateInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchFlowRateInjection/PatchFlowRateInjection.C index a7ad2372dd4beb2817d5117dd6e5742bbbb8b379..a9527d01901a7cdfa00029c72d045f391745cc23 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchFlowRateInjection/PatchFlowRateInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchFlowRateInjection/PatchFlowRateInjection.C @@ -90,7 +90,7 @@ Foam::PatchFlowRateInjection<CloudType>::PatchFlowRateInjection duration_(im.duration_), concentration_(im.concentration_), parcelConcentration_(im.parcelConcentration_), - sizeDistribution_(im.sizeDistribution_, false) + sizeDistribution_(im.sizeDistribution_.clone()) {} diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C index a56d81e3cef4bed340f6bbcf9585842d22c07272..1c9524078e5b237cb492b2636f6a7ab4cf75f1d6 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C @@ -84,7 +84,7 @@ Foam::PatchInjection<CloudType>::PatchInjection parcelsPerSecond_(im.parcelsPerSecond_), U0_(im.U0_), flowRateProfile_(im.flowRateProfile_), - sizeDistribution_(im.sizeDistribution_, false) + sizeDistribution_(im.sizeDistribution_.clone()) {} diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Lift/LiftForce/LiftForceI.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Lift/LiftForce/LiftForceI.H index 6c4aeab5968e9e72586ab00d5a4fb1a30d3281a8..dac24d0004cd0894a91c62e361521667bfa0d51a 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Lift/LiftForce/LiftForceI.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Lift/LiftForce/LiftForceI.H @@ -36,7 +36,7 @@ Foam::LiftForce<CloudType>::curlUcInterp() const << abort(FatalError); } - return curlUcInterpPtr_(); + return *curlUcInterpPtr_; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H index c9813d8ee02f5b141931a54d38f3fbef40accb1e..d13c6be47a33cf84dc0f849cc041b633131c3219 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H @@ -36,7 +36,7 @@ Foam::PressureGradientForce<CloudType>::DUcDtInterp() const << abort(FatalError); } - return DUcDtInterpPtr_(); + return *DUcDtInterpPtr_; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C index 946564c1b88b94b816c8d9b8358b5e42a8b1e40a..7d6af59b41f463955d028814f8e8d50594735f2a 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C @@ -152,7 +152,7 @@ Foam::volScalarField& Foam::LocalInteraction<CloudType>::massEscape() ); } - return massEscapePtr_(); + return *massEscapePtr_; } @@ -181,7 +181,7 @@ Foam::volScalarField& Foam::LocalInteraction<CloudType>::massStick() ); } - return massStickPtr_(); + return *massStickPtr_; } diff --git a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/AveragingMethod/AveragingMethod.C b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/AveragingMethod/AveragingMethod.C index c7c18285a36c67c95949e68cb37ea3a16adb050e..906c89be7ce4bb25bc53f0564c446e750b92bbce 100644 --- a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/AveragingMethod/AveragingMethod.C +++ b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/AveragingMethod/AveragingMethod.C @@ -105,13 +105,6 @@ Foam::AveragingMethod<Type>::New } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::AveragingMethod<Type>::~AveragingMethod() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> diff --git a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/AveragingMethod/AveragingMethod.H b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/AveragingMethod/AveragingMethod.H index 39e084c9e2a0a5aacb5de4f5b94f1da1069ff0d9..550479e5685aba411415cfac6fdedc2aa1d832a9 100644 --- a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/AveragingMethod/AveragingMethod.H +++ b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/AveragingMethod/AveragingMethod.H @@ -130,7 +130,7 @@ public: //- Destructor - virtual ~AveragingMethod(); + virtual ~AveragingMethod() = default; //- Member Functions diff --git a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.C b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.C index bbc44a98b8a591dc3aa7d4ea74ab8d24e5a8d898..f7be290024ba0b8f0ff9e88b67156eb7a24526b2 100644 --- a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.C +++ b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.C @@ -29,15 +29,12 @@ License // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // template<class Type> -Foam::autoPtr<Foam::labelList> Foam::AveragingMethods::Dual<Type>::size -( - const fvMesh& mesh -) +Foam::labelList Foam::AveragingMethods::Dual<Type>::sizing(const fvMesh& mesh) { - autoPtr<labelList> s(new labelList(2)); - s()[0] = mesh.nCells(); - s()[1] = mesh.nPoints(); - return s; + labelList sizes(2); + sizes[0] = mesh.nCells(); + sizes[1] = mesh.nPoints(); + return sizes; } @@ -51,9 +48,9 @@ Foam::AveragingMethods::Dual<Type>::Dual const fvMesh& mesh ) : - AveragingMethod<Type>(io, dict, mesh, size(mesh)), + AveragingMethod<Type>(io, dict, mesh, sizing(mesh)), volumeCell_(mesh.V()), - volumeDual_(mesh.nPoints(), 0.0), + volumeDual_(mesh.nPoints(), Zero), dataCell_(FieldField<Field, Type>::operator[](0)), dataDual_(FieldField<Field, Type>::operator[](1)) { @@ -95,13 +92,6 @@ Foam::AveragingMethods::Dual<Type>::Dual {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::AveragingMethods::Dual<Type>::~Dual() -{} - - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template<class Type> @@ -132,7 +122,7 @@ void Foam::AveragingMethods::Dual<Type>::add coordinates[0]*value / (0.25*volumeCell_[tetIs.cell()]); - for(label i = 0; i < 3; i ++) + for (label i = 0; i < 3; ++i) { dataDual_[triIs[i]] += coordinates[i+1]*value diff --git a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.H b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.H index 1850b0d9baa87e436328cf4f582c96a56367e52d..b8837f85342f2ded5e219174ba0d039764c2847b 100644 --- a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.H +++ b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.H @@ -94,14 +94,12 @@ private: Field<Type>& dataDual_; - //- Private static member functions + //- Private Member Functions - //- Return the size of the FieldField parts - static autoPtr<labelList> size(const fvMesh &mesh); + //- The sizing for the FieldField parts + static labelList sizing(const fvMesh& mesh); - //- Private member functions - //- Sync point data over processor boundaries void syncDualData(); @@ -119,7 +117,7 @@ public: ( const IOobject& io, const dictionary& dict, - const fvMesh &mesh + const fvMesh& mesh ); //- Construct a copy @@ -136,7 +134,7 @@ public: //- Destructor - virtual ~Dual(); + virtual ~Dual() = default; //- Member Functions diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialListI.H b/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialListI.H index 04fb468871fa3623fead83680590a8e7db33059a..10e31dfd42896b5d41d2cc49b7e80a2e7657f28e 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialListI.H +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialListI.H @@ -37,7 +37,6 @@ inline Foam::label Foam::pairPotentialList::pairPotentialIndex { index = a*(2*nIds_ - a - 1)/2 + b; } - else { index = b*(2*nIds_ - b - 1)/2 + a; @@ -72,7 +71,7 @@ inline Foam::scalar Foam::pairPotentialList::rCutMaxSqr() const inline const Foam::pairPotential& Foam::pairPotentialList::electrostatic() const { - return electrostaticPotential_; + return *electrostaticPotential_; } diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H index 8ff701eea8d45beaa62cb92f3201ccb2422203cb..077e50bf9d4419ad87664258b1c72af2cee5f6a5 100644 --- a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H @@ -29,7 +29,7 @@ template<class CloudType> inline const Foam::SprayCloud<CloudType>& Foam::SprayCloud<CloudType>::cloudCopy() const { - return cloudCopyPtr_(); + return *cloudCopyPtr_; } @@ -45,7 +45,7 @@ template<class CloudType> inline Foam::AtomizationModel<Foam::SprayCloud<CloudType>>& Foam::SprayCloud<CloudType>::atomization() { - return atomizationModel_(); + return *atomizationModel_; } @@ -61,7 +61,7 @@ template<class CloudType> inline Foam::BreakupModel<Foam::SprayCloud<CloudType>>& Foam::SprayCloud<CloudType>::breakup() { - return breakupModel_(); + return *breakupModel_; } diff --git a/src/lumpedPointMotion/lumpedPointMovement.C b/src/lumpedPointMotion/lumpedPointMovement.C index 21cd34dc33f28f218a5d9082dee7a615a5d05acb..a1df8e61b46f3ee27a14bd6f642d6e860b6dd8be 100644 --- a/src/lumpedPointMotion/lumpedPointMovement.C +++ b/src/lumpedPointMotion/lumpedPointMovement.C @@ -787,7 +787,7 @@ Foam::lumpedPointMovement::interpolator() const ); } - return interpolatorPtr_(); + return *interpolatorPtr_; } diff --git a/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.C b/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.C index 04ea707fa81a7effa281fe6290fe8c1af6c51a20..1d48424208a78185b031eaa4ce7353b202999e3d 100644 --- a/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.C +++ b/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.C @@ -67,7 +67,7 @@ Foam::blockEdge::blockEdge Foam::autoPtr<Foam::blockEdge> Foam::blockEdge::clone() const { NotImplemented; - return autoPtr<blockEdge>(nullptr); + return autoPtr<blockEdge>(); } diff --git a/src/mesh/blockMesh/blockFaces/blockFace/blockFace.C b/src/mesh/blockMesh/blockFaces/blockFace/blockFace.C index dd194b52c405508f039352731c0c1de5148a3b71..812fb52fb31e8ba773743e46a952c92b216ddc77 100644 --- a/src/mesh/blockMesh/blockFaces/blockFace/blockFace.C +++ b/src/mesh/blockMesh/blockFaces/blockFace/blockFace.C @@ -65,7 +65,7 @@ Foam::blockFace::blockFace Foam::autoPtr<Foam::blockFace> Foam::blockFace::clone() const { NotImplemented; - return autoPtr<blockFace>(nullptr); + return autoPtr<blockFace>(); } diff --git a/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.C b/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.C index e40ff63751e2647b744d58f3b0774b6491066c69..9dcf58c9b07af48170a11d5d57bc6ec62a45da61 100644 --- a/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.C +++ b/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.C @@ -45,7 +45,7 @@ Foam::blockVertex::blockVertex() Foam::autoPtr<Foam::blockVertex> Foam::blockVertex::clone() const { NotImplemented; - return autoPtr<blockVertex>(nullptr); + return autoPtr<blockVertex>(); } @@ -99,7 +99,7 @@ Foam::autoPtr<Foam::blockVertex> Foam::blockVertex::New << firstToken.info() << exit(FatalIOError); - return autoPtr<blockVertex>(nullptr); + return autoPtr<blockVertex>(); } } diff --git a/src/mesh/blockMesh/blocks/block/block.H b/src/mesh/blockMesh/blocks/block/block.H index fb3012016d55d8b9ee1f5ad9789158c0ea4d4069..b0941d3462e25ae9eef90d35506dc0c43b58e275 100644 --- a/src/mesh/blockMesh/blocks/block/block.H +++ b/src/mesh/blockMesh/blocks/block/block.H @@ -134,7 +134,7 @@ public: autoPtr<block> clone() const { NotImplemented; - return autoPtr<block>(nullptr); + return autoPtr<block>(); } //- New function which constructs and returns pointer to a block diff --git a/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C b/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C index 267ba41c122cc7afcce2d44923533924a4e7245f..7e40b1e95f55e88a115b0b5fcb40b5591280607e 100644 --- a/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C +++ b/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C @@ -79,7 +79,7 @@ Foam::displacementMeshMoverMotionSolver::meshMover() const pointDisplacement_ ); } - return meshMoverPtr_(); + return *meshMoverPtr_; } diff --git a/src/mesh/snappyHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C b/src/mesh/snappyHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C index f68aa1d09af67ccb47d3ee1006291df47c984266..d018e5703ee4b12d84e172653988934c2ff30212 100644 --- a/src/mesh/snappyHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C +++ b/src/mesh/snappyHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C @@ -1291,7 +1291,7 @@ void Foam::medialAxisMeshMover::calculateDisplacement { Info<< typeName << " : Smoothing using Medial Axis ..." << endl; - const indirectPrimitivePatch& pp = adaptPatchPtr_; + const indirectPrimitivePatch& pp = *adaptPatchPtr_; const labelList& meshPoints = pp.meshPoints(); @@ -1336,7 +1336,7 @@ void Foam::medialAxisMeshMover::calculateDisplacement ); //- Use strict extrusionIsland detection - const Switch detectExtrusionIsland = coeffDict.lookupOrDefault<Switch> + const bool detectExtrusionIsland = coeffDict.lookupOrDefault ( "detectExtrusionIsland", false diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C index 5c9528786f709bea7b50fac68d0441b7a1b6e345..84c895a95a84bb53ec965465382d5b6be84babb6 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C @@ -672,15 +672,16 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRemoveCells ); // Change the mesh (no inflation) - autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true); + autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false, true); + mapPolyMesh& map = *mapPtr; // Update fields mesh_.updateMesh(map); // Move mesh (since morphing might not do this) - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - mesh_.movePoints(map().preMotionPoints()); + mesh_.movePoints(map.preMotionPoints()); } else { @@ -698,7 +699,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRemoveCells // Update intersections. Recalculate intersections for exposed faces. labelList newExposedFaces = renumber ( - map().reverseFaceMap(), + map.reverseFaceMap(), exposedFaces ); @@ -707,7 +708,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRemoveCells updateMesh(map, newExposedFaces); - return map; + return mapPtr; } @@ -863,15 +864,16 @@ Foam::label Foam::meshRefinement::splitFacesUndo doSplitFaces(splitFaces, splits, meshMod); // Change the mesh (no inflation) - autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true); + autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false, true); + mapPolyMesh& map = *mapPtr; // Update fields mesh_.updateMesh(map); // Move mesh (since morphing might not do this) - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - mesh_.movePoints(map().preMotionPoints()); + mesh_.movePoints(map.preMotionPoints()); } // Reset the instance for if in overwrite mode @@ -884,7 +886,7 @@ Foam::label Foam::meshRefinement::splitFacesUndo forAll(originalFaces, i) { - inplaceRenumber(map().reversePointMap(), originalFaces[i]); + inplaceRenumber(map.reversePointMap(), originalFaces[i]); } { @@ -894,9 +896,9 @@ Foam::label Foam::meshRefinement::splitFacesUndo splitFaceToIndex.insert(splitFaces[i], i); } - forAll(map().faceMap(), facei) + forAll(map.faceMap(), facei) { - label oldFacei = map().faceMap()[facei]; + label oldFacei = map.faceMap()[facei]; Map<label>::iterator oldFaceFnd = splitFaceToIndex.find ( oldFacei @@ -930,13 +932,13 @@ Foam::label Foam::meshRefinement::splitFacesUndo { meshRefinement::updateList ( - map().faceMap(), + map.faceMap(), label(-1), duplicateFace ); } - const labelList& oldToNewFaces = map().reverseFaceMap(); + const labelList& oldToNewFaces = map.reverseFaceMap(); forAll(baffles, i) { labelPair& baffle = baffles[i]; @@ -1090,15 +1092,16 @@ Foam::label Foam::meshRefinement::splitFacesUndo // Change the mesh (no inflation) - autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true); + autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false, true); + mapPolyMesh& map = *mapPtr; // Update fields mesh_.updateMesh(map); // Move mesh (since morphing might not do this) - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - mesh_.movePoints(map().preMotionPoints()); + mesh_.movePoints(map.preMotionPoints()); } // Reset the instance for if in overwrite mode @@ -1110,8 +1113,8 @@ Foam::label Foam::meshRefinement::splitFacesUndo // ~~~~~~~~~~~~~~~~~~~~~~ { - const labelList& oldToNewFaces = map().reverseFaceMap(); - const labelList& oldToNewPoints = map().reversePointMap(); + const labelList& oldToNewFaces = map.reverseFaceMap(); + const labelList& oldToNewPoints = map.reversePointMap(); // Compact out merged faces DynamicList<label> changedFaces(mergedIndices.size()); @@ -1171,13 +1174,13 @@ Foam::label Foam::meshRefinement::splitFacesUndo { meshRefinement::updateList ( - map().faceMap(), + map.faceMap(), label(-1), duplicateFace ); } - const labelList& reverseFaceMap = map().reverseFaceMap(); + const labelList& reverseFaceMap = map.reverseFaceMap(); forAll(baffles, i) { labelPair& baffle = baffles[i]; @@ -1478,14 +1481,13 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance map = distributor.distribute(distribution); // Update numbering of meshRefiner - distribute(map); + distribute(map()); // Set correct instance (for if overwrite) mesh_.setInstance(timeName()); setInstance(mesh_.facesInstance()); - if (debug && keepZoneFaces) { const faceZoneMesh& fZones = mesh_.faceZones(); diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C index 0d7a72c24f487a251dbbb04807ee315078f160ff..b0e31ebe7d803182614581af1b7081de4bb142ad 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C @@ -584,19 +584,20 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createBaffles } - autoPtr<mapPolyMesh> map; + autoPtr<mapPolyMesh> mapPtr; if (returnReduce(nBaffles, sumOp<label>())) { // Change the mesh (no inflation, parallel sync) - map = meshMod.changeMesh(mesh_, false, true); + mapPtr = meshMod.changeMesh(mesh_, false, true); + mapPolyMesh& map = *mapPtr; // Update fields mesh_.updateMesh(map); // Move mesh if in inflation mode - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - mesh_.movePoints(map().preMotionPoints()); + mesh_.movePoints(map.preMotionPoints()); } else { @@ -612,8 +613,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createBaffles // this changes also the cell centre positions. faceSet baffledFacesSet(mesh_, "baffledFacesSet", 2*nBaffles); - const labelList& reverseFaceMap = map().reverseFaceMap(); - const labelList& faceMap = map().faceMap(); + const labelList& reverseFaceMap = map.reverseFaceMap(); + const labelList& faceMap = map.faceMap(); // Pick up owner side of baffle forAll(ownPatch, oldFaceI) @@ -650,7 +651,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createBaffles updateMesh(map, baffledFacesSet.toc()); } - return map; + return mapPtr; } @@ -1154,7 +1155,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeBaffles const Map<label>& faceToPatch ) { - autoPtr<mapPolyMesh> map; + autoPtr<mapPolyMesh> mapPtr; if (returnReduce(couples.size()+faceToPatch.size(), sumOp<label>())) { @@ -1280,15 +1281,16 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeBaffles // Change the mesh (no inflation) - map = meshMod.changeMesh(mesh_, false, true); + mapPtr = meshMod.changeMesh(mesh_, false, true); + mapPolyMesh& map = *mapPtr; // Update fields mesh_.updateMesh(map); // Move mesh (since morphing does not do this) - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - mesh_.movePoints(map().preMotionPoints()); + mesh_.movePoints(map.preMotionPoints()); } else { @@ -1307,13 +1309,13 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeBaffles forAll(couples, i) { - label newFace0 = map().reverseFaceMap()[couples[i].first()]; + const label newFace0 = map.reverseFaceMap()[couples[i].first()]; if (newFace0 != -1) { newExposedFaces[newI++] = newFace0; } - label newFace1 = map().reverseFaceMap()[couples[i].second()]; + const label newFace1 = map.reverseFaceMap()[couples[i].second()]; if (newFace1 != -1) { newExposedFaces[newI++] = newFace1; @@ -1323,7 +1325,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeBaffles updateMesh(map, newExposedFaces); } - return map; + return mapPtr; } @@ -4114,7 +4116,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints << ')' << endl; - autoPtr<mapPolyMesh> map; + autoPtr<mapPolyMesh> mapPtr; if (nNonManifPoints) { @@ -4125,15 +4127,16 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints pointDuplicator.setRefinement(regionSide, meshMod); // Change the mesh (no inflation, parallel sync) - map = meshMod.changeMesh(mesh_, false, true); + mapPtr = meshMod.changeMesh(mesh_, false, true); + mapPolyMesh& map = *mapPtr; // Update fields mesh_.updateMesh(map); // Move mesh if in inflation mode - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - mesh_.movePoints(map().preMotionPoints()); + mesh_.movePoints(map.preMotionPoints()); } else { @@ -4146,10 +4149,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints // Update intersections. Is mapping only (no faces created, positions // stay same) so no need to recalculate intersections. - updateMesh(map, labelList(0)); + updateMesh(map, labelList()); } - return map; + return mapPtr; } @@ -4177,7 +4180,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergePoints } } - autoPtr<mapPolyMesh> map; + autoPtr<mapPolyMesh> mapPtr; if (returnReduce(nPointPairs, sumOp<label>())) { @@ -4199,15 +4202,16 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergePoints polyMeshAdder::mergePoints(mesh_, pointToMaster, meshMod); // Change the mesh (no inflation, parallel sync) - map = meshMod.changeMesh(mesh_, false, true); + mapPtr = meshMod.changeMesh(mesh_, false, true); + mapPolyMesh& map = *mapPtr; // Update fields mesh_.updateMesh(map); // Move mesh if in inflation mode - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - mesh_.movePoints(map().preMotionPoints()); + mesh_.movePoints(map.preMotionPoints()); } else { @@ -4220,10 +4224,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergePoints // Update intersections. Is mapping only (no faces created, positions // stay same) so no need to recalculate intersections. - updateMesh(map, labelList(0)); + updateMesh(map, labelList()); } - return map; + return mapPtr; } @@ -4764,7 +4768,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true); // Update fields - mesh_.updateMesh(map); + mesh_.updateMesh(map()); // Move mesh if in inflation mode if (map().hasMotionPoints()) @@ -4807,7 +4811,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify } // None of the faces has changed, only the zones. Still... - updateMesh(map, labelList()); + updateMesh(map(), labelList()); return map; } diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C index 3027ac71f12fbccfd6d0c1b0467800d1c588ed94..aecae5267481de2220f0006e7f7e5aa9f4793513 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C @@ -106,15 +106,16 @@ Foam::label Foam::meshRefinement::mergePatchFaces faceCombiner.setRefinement(mergeSets, meshMod); // Change the mesh (no inflation) - autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true); + autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false, true); + mapPolyMesh& map = *mapPtr; // Update fields mesh_.updateMesh(map); // Move mesh (since morphing does not do this) - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - mesh_.movePoints(map().preMotionPoints()); + mesh_.movePoints(map.preMotionPoints()); } else { @@ -135,7 +136,7 @@ Foam::label Foam::meshRefinement::mergePatchFaces forAll(mergeSets, setI) { label oldMasterI = mergeSets[setI][0]; - retestFaces.insert(map().reverseFaceMap()[oldMasterI]); + retestFaces.insert(map.reverseFaceMap()[oldMasterI]); } updateMesh(map, growFaceCellFace(retestFaces)); } @@ -143,8 +144,7 @@ Foam::label Foam::meshRefinement::mergePatchFaces return nFaceSets; } -// -// + //// Remove points not used by any face or points used by only two faces where //// the edges are in line //Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeEdges @@ -369,7 +369,7 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true); // Update fields - mesh_.updateMesh(map); + mesh_.updateMesh(map()); // Move mesh (since morphing does not do this) if (map().hasMotionPoints()) @@ -385,7 +385,7 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo // Reset the instance for if in overwrite mode mesh_.setInstance(timeName()); - faceCombiner.updateMesh(map); + faceCombiner.updateMesh(map()); // Get the kept faces that need to be recalculated. // Merging two boundary faces might shift the cell centre @@ -397,7 +397,7 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo label oldMasterI = allFaceSets[setI][0]; retestFaces.insert(map().reverseFaceMap()[oldMasterI]); } - updateMesh(map, growFaceCellFace(retestFaces)); + updateMesh(map(), growFaceCellFace(retestFaces)); if (debug&meshRefinement::MESH) { @@ -558,7 +558,7 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true); // Update fields - mesh_.updateMesh(map); + mesh_.updateMesh(map()); // Move mesh (since morphing does not do this) if (map().hasMotionPoints()) @@ -575,7 +575,7 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo // Reset the instance for if in overwrite mode mesh_.setInstance(timeName()); - faceCombiner.updateMesh(map); + faceCombiner.updateMesh(map()); // Renumber restore maps inplaceMapKey(map().reversePointMap(), restoredPoints); @@ -596,7 +596,7 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo // Experimental:restore all points/face/cells in maps updateMesh ( - map, + map(), growFaceCellFace(retestFaces), restoredPoints, restoredFaces, @@ -640,15 +640,16 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRemovePoints pointRemover.setRefinement(pointCanBeDeleted, meshMod); // Change the mesh (no inflation) - autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true); + autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false, true); + mapPolyMesh& map = *mapPtr; // Update fields mesh_.updateMesh(map); // Move mesh (since morphing does not do this) - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - mesh_.movePoints(map().preMotionPoints()); + mesh_.movePoints(map.preMotionPoints()); } else { @@ -681,7 +682,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRemovePoints checkData(); } - return map; + return mapPtr; } @@ -713,15 +714,16 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRestorePoints ); // Change the mesh (no inflation) - autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true); + autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false, true); + mapPolyMesh& map = *mapPtr; // Update fields mesh_.updateMesh(map); // Move mesh (since morphing does not do this) - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - mesh_.movePoints(map().preMotionPoints()); + mesh_.movePoints(map.preMotionPoints()); } else { @@ -737,7 +739,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRestorePoints labelHashSet retestFaces(2*facesToRestore.size()); forAll(facesToRestore, i) { - label faceI = map().reverseFaceMap()[facesToRestore[i]]; + label faceI = map.reverseFaceMap()[facesToRestore[i]]; if (faceI >= 0) { retestFaces.insert(faceI); @@ -753,7 +755,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRestorePoints checkData(); } - return map; + return mapPtr; } diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C index e7f9994f869e5935a7b44a31acd19573edbed5dc..f66627f01edcfb287673998fd27859e2d28fb9c9 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C @@ -2340,15 +2340,16 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::refine meshCutter_.setRefinement(cellsToRefine, meshMod); // Create mesh (no inflation), return map from old to new mesh. - autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false); + autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false); + mapPolyMesh& map = *mapPtr; // Update fields mesh_.updateMesh(map); // Optionally inflate mesh - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - mesh_.movePoints(map().preMotionPoints()); + mesh_.movePoints(map.preMotionPoints()); } else { @@ -2362,7 +2363,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::refine // Update intersection info updateMesh(map, getChangedFaces(map, cellsToRefine)); - return map; + return mapPtr; } diff --git a/src/mesh/snappyHexMesh/refinementFeatures/refinementFeatures.C b/src/mesh/snappyHexMesh/refinementFeatures/refinementFeatures.C index aa05d3b8cba385bfa948df9deb2dd29c023aae30..8665ee4d381531f3cde541169f38c85aaadfae6a 100644 --- a/src/mesh/snappyHexMesh/refinementFeatures/refinementFeatures.C +++ b/src/mesh/snappyHexMesh/refinementFeatures/refinementFeatures.C @@ -423,7 +423,8 @@ Foam::refinementFeatures::regionEdgeTrees() const ); } } - return regionEdgeTreesPtr_(); + + return *regionEdgeTreesPtr_; } diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C index 7b4db14fecaef5375552c4273a25ada4d0ceab0e..41597249d93dcd861c86282a4374edd688f4c423 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C @@ -3361,7 +3361,7 @@ void Foam::snappyLayerDriver::addLayers ( numLayers, // per patch the num layers patchIDs, // patches that are being moved - pp, // indirectpatch for all faces moving + *pp, // indirectpatch for all faces moving patchDisp, patchNLayers, @@ -3373,7 +3373,7 @@ void Foam::snappyLayerDriver::addLayers // of the patchDisp here. syncPatchDisplacement ( - pp, + *pp, scalarField(patchDisp.size(), 0.0), //minThickness, patchDisp, patchNLayers, @@ -3555,7 +3555,7 @@ void Foam::snappyLayerDriver::addLayers ( mesh, globalFaces, - pp + *pp ) ); @@ -3570,7 +3570,7 @@ void Foam::snappyLayerDriver::addLayers ( globalFaces, edgeGlobalFaces, - pp, + *pp, edgePatchID, edgeZoneID, @@ -3605,7 +3605,7 @@ void Foam::snappyLayerDriver::addLayers ( numLayers, // per patch the num layers patchIDs, // patches that are being moved - pp, // indirectpatch for all faces moving + *pp, // indirectpatch for all faces moving patchDisp, patchNLayers, @@ -3622,7 +3622,7 @@ void Foam::snappyLayerDriver::addLayers handleNonStringConnected ( - pp, + *pp, patchDisp, patchNLayers, extrudeStatus @@ -3634,7 +3634,7 @@ void Foam::snappyLayerDriver::addLayers handleNonManifolds ( - pp, + *pp, meshEdges, edgeGlobalFaces, @@ -3648,7 +3648,7 @@ void Foam::snappyLayerDriver::addLayers handleFeatureAngle ( - pp, + *pp, meshEdges, layerParams.featureAngle(), @@ -3670,7 +3670,7 @@ void Foam::snappyLayerDriver::addLayers handleWarpedFaces ( - pp, + *pp, layerParams.maxFaceThicknessRatio(), edge0Len, cellLevel, @@ -3686,7 +3686,7 @@ void Foam::snappyLayerDriver::addLayers // //handleMultiplePatchFaces //( - // pp, + // *pp, // // patchDisp, // patchNLayers, @@ -3700,7 +3700,7 @@ void Foam::snappyLayerDriver::addLayers { growNoExtrusion ( - pp, + *pp, patchDisp, patchNLayers, extrudeStatus @@ -3730,7 +3730,7 @@ void Foam::snappyLayerDriver::addLayers scalarField expansionRatio(pp().nPoints()); calculateLayerThickness ( - pp, + *pp, patchIDs, layerParams, cellLevel, @@ -3754,8 +3754,8 @@ void Foam::snappyLayerDriver::addLayers // Per face wanted overall layer thickness scalarField faceWantedThickness(mesh.nFaces(), 0.0); { - UIndirectList<scalar>(faceWantedThickness, pp().addressing()) = - avgPointData(pp, thickness); + UIndirectList<scalar>(faceWantedThickness, pp->addressing()) = + avgPointData(*pp, thickness); } @@ -3838,7 +3838,7 @@ void Foam::snappyLayerDriver::addLayers // that. syncPatchDisplacement ( - pp, + *pp, minThickness, patchDisp, patchNLayers, @@ -3848,7 +3848,7 @@ void Foam::snappyLayerDriver::addLayers // Displacement acc. to pointnormals getPatchDisplacement ( - pp, + *pp, thickness, minThickness, patchDisp, @@ -3872,7 +3872,7 @@ void Foam::snappyLayerDriver::addLayers motionSmootherAlgo::setDisplacement ( patchIDs, - pp, + *pp, patchDisp, displacement ); @@ -3912,7 +3912,7 @@ void Foam::snappyLayerDriver::addLayers ( globalFaces, edgeGlobalFaces, - pp, + *pp, minThickness, dummySet, patchDisp, @@ -3966,7 +3966,7 @@ void Foam::snappyLayerDriver::addLayers labelList nPatchFaceLayers(pp().size(), -1); setupLayerInfoTruncation ( - pp, + *pp, patchNLayers, extrudeStatus, layerParams.nBufferCellsNoExtrude(), @@ -4027,7 +4027,7 @@ void Foam::snappyLayerDriver::addLayers // undo if neccesary. autoPtr<fvMesh> newMeshPtr; - autoPtr<mapPolyMesh> map = meshMod.makeMesh + autoPtr<mapPolyMesh> mapPtr = meshMod.makeMesh ( newMeshPtr, IOobject @@ -4042,7 +4042,8 @@ void Foam::snappyLayerDriver::addLayers mesh, // original mesh true // parallel sync ); - fvMesh& newMesh = newMeshPtr(); + fvMesh& newMesh = *newMeshPtr; + mapPolyMesh& map = *mapPtr; // Get timing, but more importantly get memory information addProfiling(grow, "snappyHexMesh::layers::updateMesh"); @@ -4067,7 +4068,7 @@ void Foam::snappyLayerDriver::addLayers ( newMesh, addLayer, - avgPointData(pp, mag(patchDisp))(), // current thickness + avgPointData(*pp, mag(patchDisp))(), // current thickness cellNLayers, faceRealThickness @@ -4113,7 +4114,7 @@ void Foam::snappyLayerDriver::addLayers facei++ ) { - label newMeshFacei = map().faceMap()[facei]; + label newMeshFacei = map.faceMap()[facei]; if (newMeshFacei != -1) { meshToNewMesh[newMeshFacei] = facei; @@ -4164,7 +4165,7 @@ void Foam::snappyLayerDriver::addLayers extrudeStatus ); - label nTotExtruded = countExtrusion(pp, extrudeStatus); + label nTotExtruded = countExtrusion(*pp, extrudeStatus); label nTotFaces = returnReduce(pp().size(), sumOp<label>()); label nTotAddedCells = returnReduce(nAddedCells, sumOp<label>()); @@ -4193,7 +4194,7 @@ void Foam::snappyLayerDriver::addLayers { growNoExtrusion ( - pp, + *pp, patchDisp, patchNLayers, extrudeStatus @@ -4211,7 +4212,8 @@ void Foam::snappyLayerDriver::addLayers { // Apply the stored topo changes to the current mesh. - autoPtr<mapPolyMesh> map = savedMeshMod.changeMesh(mesh, false); + autoPtr<mapPolyMesh> mapPtr = savedMeshMod.changeMesh(mesh, false); + mapPolyMesh& map = *mapPtr; // Hack to remove meshPhi - mapped incorrectly. TBD. mesh.clearOut(); @@ -4220,9 +4222,9 @@ void Foam::snappyLayerDriver::addLayers mesh.updateMesh(map); // Move mesh (since morphing does not do this) - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - mesh.movePoints(map().preMotionPoints()); + mesh.movePoints(map.preMotionPoints()); } else { @@ -4238,7 +4240,7 @@ void Foam::snappyLayerDriver::addLayers // Update numbering of faceWantedThickness meshRefinement::updateList ( - map().faceMap(), + map.faceMap(), scalar(0), faceWantedThickness ); @@ -4283,7 +4285,7 @@ void Foam::snappyLayerDriver::addLayers DynamicList<label> candidates(baffles.size()*4); // Mark whether old face was on baffle - PackedBoolList oldBaffleFace(map().nOldFaces()); + PackedBoolList oldBaffleFace(map.nOldFaces()); forAll(baffles, i) { const labelPair& baffle = baffles[i]; @@ -4301,14 +4303,14 @@ void Foam::snappyLayerDriver::addLayers facei++ ) { - label oldFacei = map().faceMap()[facei]; + label oldFacei = map.faceMap()[facei]; if (oldFacei != -1 && oldBaffleFace[oldFacei]) { const face& f = mesh.faces()[facei]; forAll(f, fp) { label pointi = f[fp]; - label oldPointi = map().pointMap()[pointi]; + label oldPointi = map.pointMap()[pointi]; if (pointToMaster[oldPointi] != -1) { diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H index 007085e244cb1e0438d44d1e93a3306878ef2f23..72556d3737f0a27d89632b9498065848d5d6fa68 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H @@ -116,7 +116,7 @@ template<class SourcePatch, class TargetPatch> inline const Foam::mapDistribute& Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcMap() const { - return srcMapPtr_(); + return *srcMapPtr_; } @@ -188,7 +188,7 @@ template<class SourcePatch, class TargetPatch> inline const Foam::mapDistribute& Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtMap() const { - return tgtMapPtr_(); + return *tgtMapPtr_; } diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicACMIGAMGInterface/cyclicACMIGAMGInterface.H b/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicACMIGAMGInterface/cyclicACMIGAMGInterface.H index 08d9b114c1c81406f06708ffc7208de279f7cdfc..b430bf819ce0053690633d95ae7ace3ff1a8c608 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicACMIGAMGInterface/cyclicACMIGAMGInterface.H +++ b/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicACMIGAMGInterface/cyclicACMIGAMGInterface.H @@ -132,7 +132,7 @@ public: virtual const AMIPatchToPatchInterpolation& AMI() const { - return amiPtr_(); + return *amiPtr_; } //- Return face transformation tensor diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.H b/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.H index 6cc7600cac18edb1b9dbe2c0ef9a179cb458d871..1e2d3241e23ce3b2fd4c6bcb8dc69c64db98420d 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.H +++ b/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.H @@ -132,7 +132,7 @@ public: virtual const AMIPatchToPatchInterpolation& AMI() const { - return amiPtr_(); + return *amiPtr_; } //- Return face transformation tensor diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.H b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.H index 2c108b2451ab7f7ebbed6e6dc4f02f30f06d2d6d..935a5411806c833bb4a1f98a7988832c3911edc0 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.H @@ -82,7 +82,7 @@ class cyclicACMIPointPatchField ); } - return ppiPtr_(); + return *ppiPtr_; } //- Neighbour side patch interpolation @@ -99,7 +99,7 @@ class cyclicACMIPointPatchField ); } - return nbrPpiPtr_(); + return *nbrPpiPtr_; } diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H index 64765e52f74194b8ccb5525ebc78814aa83b61b6..e508719bdd6a2bcf401f8b15e83c87cc88db4fe2 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H @@ -82,7 +82,7 @@ class cyclicAMIPointPatchField ); } - return ppiPtr_(); + return *ppiPtr_; } //- Neighbour side patch interpolation @@ -99,7 +99,7 @@ class cyclicAMIPointPatchField ); } - return nbrPpiPtr_(); + return *nbrPpiPtr_; } diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C index 12f9546fcab5b8d44f470364d18b9fafa753dc82..76a80cfefc6f2e31990aab8c595df551f95b2e37 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C @@ -810,7 +810,7 @@ const Foam::AMIPatchToPatchInterpolation& Foam::cyclicAMIPolyPatch::AMI() const resetAMI(AMIMethod_); } - return AMIPtr_(); + return *AMIPtr_; } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C b/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C index 481f15f71bf40ac00b90da5b7a63146fb4f8f8bf..de8b54f4024a904ec21ce00a4fc91dd54df5d16d 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C @@ -94,7 +94,7 @@ void Foam::cylindrical::init Foam::cylindrical::cylindrical(const cylindrical& r) : - Rptr_(r.Rptr_, false), // clone + Rptr_(r.Rptr_.clone()), origin_(r.origin_), e3_(r.e3_) {} @@ -177,15 +177,11 @@ Foam::cylindrical::cylindrical } - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // void Foam::cylindrical::clear() { - if (!Rptr_.empty()) - { - Rptr_.clear(); - } + Rptr_.clear(); } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.H b/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.H index b8502d8aabf99a5048048048625e9cfe80854eeb..bf2c57879b82e2f817936b0076a880676ddcb824 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.H @@ -181,7 +181,7 @@ public: virtual const tensorField& Tr() const { - return Rptr_(); + return *Rptr_; } //- Transform vectorField using transformation tensor field diff --git a/src/meshTools/coordinateSystems/coordinateSystem.C b/src/meshTools/coordinateSystems/coordinateSystem.C index b4a9e7882009046141db1ef497fbcfd16b26acae..cb638dd4530e928c706f5a1323357a4b9bc61867 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.C +++ b/src/meshTools/coordinateSystems/coordinateSystem.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,6 +48,24 @@ Foam::coordinateSystem::coordinateSystem() {} +Foam::coordinateSystem::coordinateSystem(const coordinateSystem& cs) +: + name_(cs.name_), + note_(cs.note_), + origin_(cs.origin_), + R_(cs.R_.clone()) +{} + + +Foam::coordinateSystem::coordinateSystem(coordinateSystem&& cs) +: + name_(std::move(cs.name_)), + note_(std::move(cs.note_)), + origin_(std::move(cs.origin_)), + R_(std::move(cs.R_)) +{} + + Foam::coordinateSystem::coordinateSystem ( const word& name, @@ -55,9 +73,9 @@ Foam::coordinateSystem::coordinateSystem ) : name_(name), - note_(), + note_(cs.note_), origin_(cs.origin_), - R_(cs.R().clone()) + R_(cs.R_.clone()) {} @@ -176,12 +194,6 @@ Foam::coordinateSystem::coordinateSystem(Istream& is) } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::coordinateSystem::~coordinateSystem() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::dictionary Foam::coordinateSystem::dict(bool ignoreType) const @@ -220,10 +232,8 @@ Foam::vector Foam::coordinateSystem::localToGlobal { return (R_->transform(local)) + origin_; } - else - { - return R_->transform(local); - } + + return R_->transform(local); } @@ -237,10 +247,8 @@ Foam::tmp<Foam::vectorField> Foam::coordinateSystem::localToGlobal { return (R_->transform(local)) + origin_; } - else - { - return R_->transform(local); - } + + return R_->transform(local); } @@ -254,10 +262,8 @@ Foam::vector Foam::coordinateSystem::globalToLocal { return R_->invTransform(global - origin_); } - else - { - return R_->invTransform(global); - } + + return R_->invTransform(global); } @@ -271,10 +277,8 @@ Foam::tmp<Foam::vectorField> Foam::coordinateSystem::globalToLocal { return R_->invTransform(global - origin_); } - else - { - return R_->invTransform(global); - } + + return R_->invTransform(global); } @@ -286,6 +290,17 @@ void Foam::coordinateSystem::clear() } +void Foam::coordinateSystem::transfer(coordinateSystem& cs) +{ + name_ = std::move(cs.name_); + note_ = std::move(cs.note_); + origin_ = std::move(cs.origin_); + R_ = std::move(cs.R_); + + cs.clear(); +} + + void Foam::coordinateSystem::write(Ostream& os) const { os << type() << " origin: " << origin() << nl; @@ -304,7 +319,7 @@ void Foam::coordinateSystem::writeDict(Ostream& os, bool subDict) const if (note_.size()) { - // note is optional + // The 'note' is optional os.writeEntry("note", note_); } @@ -320,12 +335,26 @@ void Foam::coordinateSystem::writeDict(Ostream& os, bool subDict) const // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // +void Foam::coordinateSystem::operator=(const coordinateSystem& cs) +{ + name_ = cs.name_; + note_ = cs.note_; + origin_ = cs.origin_; + R_ = cs.R_.clone(); +} + +void Foam::coordinateSystem::operator=(coordinateSystem&& cs) +{ + transfer(cs); +} + + void Foam::coordinateSystem::init(const dictionary& rhs) { rhs.lookup("origin") >> origin_; note_.clear(); rhs.readIfPresent("note", note_); - R_.reset(coordinateRotation::New(rhs.subDict("coordinateRotation")).ptr()); + R_ = coordinateRotation::New(rhs.subDict("coordinateRotation")); } @@ -347,14 +376,11 @@ void Foam::coordinateSystem::init rhs.lookup("origin") >> origin_; - // The note entry is optional + // The 'note' entry is optional note_.clear(); rhs.readIfPresent("note", note_); - R_.reset - ( - coordinateRotation::New(rhs.subDict("coordinateRotation"), obr).ptr() - ); + R_ = coordinateRotation::New(rhs.subDict("coordinateRotation"), obr); } @@ -365,8 +391,8 @@ bool Foam::operator!=(const coordinateSystem& a, const coordinateSystem& b) return ( a.origin() != b.origin() - || a.R().R() != b.R().R() || a.type() != b.type() + || a.R().R() != b.R().R() ); } diff --git a/src/meshTools/coordinateSystems/coordinateSystem.H b/src/meshTools/coordinateSystems/coordinateSystem.H index ee81ee365a84f0217b829af5b35300a1523538fd..4d148b08142b1a9da19623bf45089e68f2fef876 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.H +++ b/src/meshTools/coordinateSystems/coordinateSystem.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -151,11 +151,17 @@ public: //- Construct null. This is equivalent to an identity coordinateSystem coordinateSystem(); - //- Construct copy with a different name + //- Copy construct + coordinateSystem(const coordinateSystem& cs); + + //- Move construct + coordinateSystem(coordinateSystem&& cs); + + //- Copy construct with a different name coordinateSystem ( const word& name, - const coordinateSystem& + const coordinateSystem& cs ); //- Construct from origin and rotation @@ -231,7 +237,7 @@ public: //- Destructor - virtual ~coordinateSystem(); + virtual ~coordinateSystem() = default; // Member Functions @@ -265,13 +271,13 @@ public: //- Return const reference to co-ordinate rotation const coordinateRotation& R() const { - return R_(); + return *R_; } //- Return non const reference to co-ordinate rotation coordinateRotation& R() { - return R_(); + return *R_; } //- Update and return the co-ordinate rotation for a list of cells @@ -282,7 +288,7 @@ public: ) { R_->updateCells(mesh, cells); - return R_(); + return *R_; } //- Return as dictionary of entries @@ -309,6 +315,9 @@ public: // Also resets the note virtual void clear(); + //- Transfer contents from parameter + void transfer(coordinateSystem& cs); + // Write @@ -380,12 +389,19 @@ public: // Member Operators + //- Copy assignment + void operator=(const coordinateSystem& cs); + + //- Move assignment + void operator=(coordinateSystem&& cs); + + // friend Operators friend bool operator!= ( - const coordinateSystem&, - const coordinateSystem& + const coordinateSystem& a, + const coordinateSystem& b ); diff --git a/src/meshTools/edgeMesh/edgeMesh.C b/src/meshTools/edgeMesh/edgeMesh.C index f91f5a1a817f6994a0fe59e2d03d4ce8529ac54e..801e53bb6f54e288a9e8303ec5b7ffe4ab0be7f3 100644 --- a/src/meshTools/edgeMesh/edgeMesh.C +++ b/src/meshTools/edgeMesh/edgeMesh.C @@ -202,7 +202,7 @@ void Foam::edgeMesh::transfer(edgeMesh& mesh) { points_.transfer(mesh.points_); edges_.transfer(mesh.edges_); - pointEdgesPtr_ = mesh.pointEdgesPtr_; + pointEdgesPtr_ = std::move(mesh.pointEdgesPtr_); } diff --git a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C index e27bdbabd461f3f970f0666b1affcbd953af0cfc..114cf26f4cf1600ade85d1ae538b18bcf56155e2 100644 --- a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C +++ b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C @@ -965,7 +965,7 @@ Foam::extendedEdgeMesh::pointTree() const ); } - return pointTree_(); + return *pointTree_; } @@ -1007,7 +1007,7 @@ Foam::extendedEdgeMesh::edgeTree() const ); } - return edgeTree_(); + return *edgeTree_; } @@ -1095,8 +1095,8 @@ void Foam::extendedEdgeMesh::transfer(extendedEdgeMesh& mesh) featurePointNormals_.transfer(mesh.featurePointNormals_); featurePointEdges_.transfer(mesh.featurePointEdges_); regionEdges_.transfer(mesh.regionEdges_); - pointTree_ = mesh.pointTree_; - edgeTree_ = mesh.edgeTree_; + pointTree_ = std::move(mesh.pointTree_); + edgeTree_ = std::move(mesh.edgeTree_); edgeTreesByType_.transfer(mesh.edgeTreesByType_); } diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H index fc392dfaaf2fb390697a34e117c0083417d7a6d2..9a42db9dfa31bd852116344cb2b3852d6156310a 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H @@ -148,7 +148,7 @@ inline const Foam::mapDistribute& Foam::mappedPatchBase::map() const calcMapping(); } - return mapPtr_(); + return *mapPtr_; } @@ -162,7 +162,7 @@ inline const Foam::AMIPatchToPatchInterpolation& Foam::mappedPatchBase::AMI calcAMI(); } - return AMIPtr_(); + return *AMIPtr_; } diff --git a/src/meshTools/meshSearch/meshSearch.C b/src/meshTools/meshSearch/meshSearch.C index c0e4cb2fa885370bb572505bb594a43fd83b4d18..e49b2a76752ea18bcde782d04953ab0f49019a48 100644 --- a/src/meshTools/meshSearch/meshSearch.C +++ b/src/meshTools/meshSearch/meshSearch.C @@ -591,7 +591,7 @@ Foam::meshSearch::boundaryTree() const ); } - return boundaryTreePtr_(); + return *boundaryTreePtr_; } @@ -637,7 +637,7 @@ Foam::meshSearch::cellTree() const ); } - return cellTreePtr_(); + return *cellTreePtr_; } diff --git a/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledBaseGAMGInterface.H b/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledBaseGAMGInterface.H index 4b850c645af404ac8f68755c2a85046c12cc7540..343d5520de66577a8406f78dc7b59c0a4205b61b 100644 --- a/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledBaseGAMGInterface.H +++ b/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledBaseGAMGInterface.H @@ -130,7 +130,7 @@ public: //virtual const AMIPatchToPatchInterpolation& AMI() const //{ - // return amiPtr_(); + // return *amiPtr_; //} virtual const polyMesh& nbrMesh() const diff --git a/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.C b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.C index 9defb4090bdd86dbf044e011836948f6b0f129a3..68260786e063e9b77b44506cdaece1167f7de29c 100644 --- a/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.C +++ b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.C @@ -293,7 +293,7 @@ const Foam::AMIPatchToPatchInterpolation& Foam::regionCoupledBase::AMI() const resetAMI(); } - return AMIPtr_(); + return *AMIPtr_; } diff --git a/src/meshTools/regionSplit/regionSplit.H b/src/meshTools/regionSplit/regionSplit.H index 637a9593ec61f74a52a76fa77f609d18c913de18..e24fe96ed426adef9c7d1b5de7d678f4f22160e5 100644 --- a/src/meshTools/regionSplit/regionSplit.H +++ b/src/meshTools/regionSplit/regionSplit.H @@ -189,7 +189,7 @@ public: //- Return global region numbering const globalIndex& globalNumbering() const { - return globalNumberingPtr_(); + return *globalNumberingPtr_; } //- Return local number of regions diff --git a/src/meshTools/searchableSurfaces/searchableSurface/searchableSurface.H b/src/meshTools/searchableSurfaces/searchableSurface/searchableSurface.H index 8dd26867a0196cb36802b74a72eb4bf25da5f91c..9f67882eb8fd5ee15d06fd7042dfae9ffb391d2c 100644 --- a/src/meshTools/searchableSurfaces/searchableSurface/searchableSurface.H +++ b/src/meshTools/searchableSurfaces/searchableSurface/searchableSurface.H @@ -139,7 +139,7 @@ public: virtual autoPtr<searchableSurface> clone() const { NotImplemented; - return autoPtr<searchableSurface>(nullptr); + return autoPtr<searchableSurface>(); } diff --git a/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.C b/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.C index 496b5c22dda7079975a813e90c8bb68d3306310b..473fc1b9643aa8b58f7d76863a1ae100e7b58992 100644 --- a/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.C +++ b/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.C @@ -613,7 +613,8 @@ Foam::triSurfaceMesh::edgeTree() const indexedOctree<treeDataEdge>::perturbTol() = oldTol; } - return edgeTree_(); + + return *edgeTree_; } diff --git a/src/meshTools/sets/topoSetSource/topoSetSource.H b/src/meshTools/sets/topoSetSource/topoSetSource.H index 0957df277dc87c6e4273cc364d2c478bc3a52e9a..293474c1ccbbb14bfa77ed373e41f9f3a3a0d4fc 100644 --- a/src/meshTools/sets/topoSetSource/topoSetSource.H +++ b/src/meshTools/sets/topoSetSource/topoSetSource.H @@ -243,7 +243,7 @@ public: autoPtr<topoSetSource> clone() const { NotImplemented; - return autoPtr<topoSetSource>(nullptr); + return autoPtr<topoSetSource>(); } diff --git a/src/meshTools/sets/topoSets/topoSet.H b/src/meshTools/sets/topoSets/topoSet.H index adde26e085a56dc374ec6dade7781c6919fefb36..2fde875ceced7b7f5df3549dede49ea083a56ade 100644 --- a/src/meshTools/sets/topoSets/topoSet.H +++ b/src/meshTools/sets/topoSets/topoSet.H @@ -254,7 +254,7 @@ public: autoPtr<topoSet> clone() const { NotImplemented; - return autoPtr<topoSet>(nullptr); + return autoPtr<topoSet>(); } diff --git a/src/meshTools/triSurface/triSurfaceSearch/triSurfaceSearch.C b/src/meshTools/triSurface/triSurfaceSearch/triSurfaceSearch.C index fe6990565473bd13b3833e96afac497523d2b2bd..4ef1974fe50f80f0abf89982b67a7b156f311548 100644 --- a/src/meshTools/triSurface/triSurfaceSearch/triSurfaceSearch.C +++ b/src/meshTools/triSurface/triSurfaceSearch/triSurfaceSearch.C @@ -250,7 +250,7 @@ Foam::triSurfaceSearch::tree() const indexedOctree<treeDataTriSurface>::perturbTol() = oldTol; } - return treePtr_(); + return *treePtr_; } diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C index 526e813b6c62bc8ba5c8695f2cc3bfa8dbad281a..6c7f8574d21bd4e4b440f32cf5e6ae13a19761a5 100644 --- a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C @@ -253,7 +253,7 @@ const Foam::lduAddressing& Foam::dynamicOversetFvMesh::lduAddr() const // Build extended addressing updateAddressing(); } - return lduPtr_(); + return *lduPtr_; } @@ -266,7 +266,7 @@ Foam::dynamicOversetFvMesh::primitiveLduAddr() const << "Extended addressing not allocated" << abort(FatalError); } - return lduPtr_(); + return *lduPtr_; } diff --git a/src/overset/oversetPolyPatch/oversetGAMGInterface.H b/src/overset/oversetPolyPatch/oversetGAMGInterface.H index 3f9105b612ea04e53d4a575f5409a8bea0c7d9f8..477368a2e61a1fe76a82af46b826e8dd2986f1c1 100644 --- a/src/overset/oversetPolyPatch/oversetGAMGInterface.H +++ b/src/overset/oversetPolyPatch/oversetGAMGInterface.H @@ -152,7 +152,7 @@ public: //- Map for obtaining data in stencil order virtual const mapDistribute& cellInterpolationMap() const { - return mapPtr_(); + return *mapPtr_; } //- Weights in stencil order diff --git a/src/parallel/decompose/decompose/decompositionModel.H b/src/parallel/decompose/decompose/decompositionModel.H index 2cbfa4d2496648d11036385815ed70977b2e3455..9503bcf0781508b81885a0d89e3165dea59de9d2 100644 --- a/src/parallel/decompose/decompose/decompositionModel.H +++ b/src/parallel/decompose/decompose/decompositionModel.H @@ -123,7 +123,7 @@ public: this->mesh().name() // Name of mesh region ); } - return decomposerPtr_(); + return *decomposerPtr_; } //- Helper: return IOobject with optionally absolute path provided diff --git a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C index 0206840ef719fcda83e38257c00b8897da9d910d..247082f5ee33656718a4426df451eb24decc0c3a 100644 --- a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C +++ b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C @@ -1473,7 +1473,7 @@ const Foam::globalIndex& Foam::distributedTriSurfaceMesh::globalTris() const { globalTris_.reset(new globalIndex(triSurface::size())); } - return globalTris_; + return *globalTris_; } diff --git a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H index 9f3ee2a289290dfef7cfe7375ec41a1464121fce..daa2938e722b7ed6e1d8ffce99c67f213b73a8f6 100644 --- a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H +++ b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H @@ -156,7 +156,7 @@ public: autoPtr<pyrolysisModel> clone() const { NotImplemented; - return autoPtr<pyrolysisModel>(nullptr); + return autoPtr<pyrolysisModel>(); } diff --git a/src/regionModels/regionModel/regionModel/regionModelI.H b/src/regionModels/regionModel/regionModel/regionModelI.H index 471eb9e376981c3d1ebd5143107a9193897ac3f8..b841f0165f663db94c52af17bd8b243a67752bb2 100644 --- a/src/regionModels/regionModel/regionModel/regionModelI.H +++ b/src/regionModels/regionModel/regionModel/regionModelI.H @@ -70,7 +70,7 @@ inline const Foam::fvMesh& Foam::regionModels::regionModel::regionMesh() const << "Region mesh not available" << abort(FatalError); } - return regionMeshPtr_(); + return *regionMeshPtr_; } @@ -89,7 +89,7 @@ inline Foam::fvMesh& Foam::regionModels::regionModel::regionMesh() << "Region mesh not available" << abort(FatalError); } - return regionMeshPtr_(); + return *regionMeshPtr_; } @@ -116,7 +116,7 @@ Foam::regionModels::regionModel::outputProperties() const << abort(FatalError); } - return outputPropertiesPtr_(); + return *outputPropertiesPtr_; } @@ -130,7 +130,7 @@ Foam::regionModels::regionModel::outputProperties() << abort(FatalError); } - return outputPropertiesPtr_(); + return *outputPropertiesPtr_; } diff --git a/src/regionModels/regionModel/regionModel1D/regionModel1DI.H b/src/regionModels/regionModel/regionModel1D/regionModel1DI.H index fcc918fb64685ed09bd4a4ff04f6212d0cc6fd1e..25b55701b4135437ae3fd7b41a6b0f7f08e25d55 100644 --- a/src/regionModels/regionModel/regionModel1D/regionModel1DI.H +++ b/src/regionModels/regionModel/regionModel1D/regionModel1DI.H @@ -57,7 +57,7 @@ Foam::regionModels::regionModel1D::nMagSf() const << "Face normal areas not available" << abort(FatalError); } - return nMagSfPtr_(); + return *nMagSfPtr_; } diff --git a/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C b/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C index 0c3571ef307b8be2a3f608ac1c00e7759fe09922..1d68751934077f730c4300bdb5daf3d67992621d 100644 --- a/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C +++ b/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C @@ -213,7 +213,7 @@ const Foam::volVectorField& Foam::regionModels::singleLayerRegion::nHat() const << abort(FatalError); } - return nHatPtr_(); + return *nHatPtr_; } @@ -226,7 +226,7 @@ const Foam::volScalarField& Foam::regionModels::singleLayerRegion::magSf() const << abort(FatalError); } - return magSfPtr_(); + return *magSfPtr_; } diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C index c2f1c552a5b99d8c13415d84774cceae456b8474..15512eb9e12a8775efe98706721b63103935ef81 100644 --- a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C @@ -56,9 +56,9 @@ inclinedFilmNusseltHeightFvPatchScalarField : fixedValueFvPatchScalarField(ptf, p, iF, mapper), filmRegionName_(ptf.filmRegionName_), - GammaMean_(ptf.GammaMean_, false), - a_(ptf.a_, false), - omega_(ptf.omega_, false) + GammaMean_(ptf.GammaMean_.clone()), + a_(ptf.a_.clone()), + omega_(ptf.omega_.clone()) {} @@ -89,9 +89,9 @@ inclinedFilmNusseltHeightFvPatchScalarField : fixedValueFvPatchScalarField(wmfrhpsf), filmRegionName_(wmfrhpsf.filmRegionName_), - GammaMean_(wmfrhpsf.GammaMean_, false), - a_(wmfrhpsf.a_, false), - omega_(wmfrhpsf.omega_, false) + GammaMean_(wmfrhpsf.GammaMean_.clone()), + a_(wmfrhpsf.a_.clone()), + omega_(wmfrhpsf.omega_.clone()) {} @@ -104,9 +104,9 @@ inclinedFilmNusseltHeightFvPatchScalarField : fixedValueFvPatchScalarField(wmfrhpsf, iF), filmRegionName_(wmfrhpsf.filmRegionName_), - GammaMean_(wmfrhpsf.GammaMean_, false), - a_(wmfrhpsf.a_, false), - omega_(wmfrhpsf.omega_, false) + GammaMean_(wmfrhpsf.GammaMean_.clone()), + a_(wmfrhpsf.a_.clone()), + omega_(wmfrhpsf.omega_.clone()) {} diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C index 084e4ad6dfd3bd2c8b87c00e08277746f18e28f9..6bbf834e4e941a9b2d24589601db2629a340b0aa 100644 --- a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C @@ -56,9 +56,9 @@ inclinedFilmNusseltInletVelocityFvPatchVectorField : fixedValueFvPatchVectorField(ptf, p, iF, mapper), filmRegionName_(ptf.filmRegionName_), - GammaMean_(ptf.GammaMean_, false), - a_(ptf.a_, false), - omega_(ptf.omega_, false) + GammaMean_(ptf.GammaMean_.clone()), + a_(ptf.a_.clone()), + omega_(ptf.omega_.clone()) {} @@ -89,9 +89,9 @@ inclinedFilmNusseltInletVelocityFvPatchVectorField : fixedValueFvPatchVectorField(fmfrpvf), filmRegionName_(fmfrpvf.filmRegionName_), - GammaMean_(fmfrpvf.GammaMean_, false), - a_(fmfrpvf.a_, false), - omega_(fmfrpvf.omega_, false) + GammaMean_(fmfrpvf.GammaMean_.clone()), + a_(fmfrpvf.a_.clone()), + omega_(fmfrpvf.omega_.clone()) {} @@ -104,9 +104,9 @@ inclinedFilmNusseltInletVelocityFvPatchVectorField : fixedValueFvPatchVectorField(fmfrpvf, iF), filmRegionName_(fmfrpvf.filmRegionName_), - GammaMean_(fmfrpvf.GammaMean_, false), - a_(fmfrpvf.a_, false), - omega_(fmfrpvf.omega_, false) + GammaMean_(fmfrpvf.GammaMean_.clone()), + a_(fmfrpvf.a_.clone()), + omega_(fmfrpvf.omega_.clone()) {} diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H index 2619ccf1c6e2a87968cc2cb8369039b49b543258..2a3983eb55662964b3ad373c3f2d4334faac90c7 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H @@ -172,7 +172,7 @@ inline const volScalarField& kinematicSingleLayer::muPrimary() const inline const filmThermoModel& kinematicSingleLayer::filmThermo() const { - return filmThermo_(); + return *filmThermo_; } @@ -190,7 +190,7 @@ inline transferModelList& kinematicSingleLayer::transfer() inline const filmTurbulenceModel& kinematicSingleLayer::turbulence() const { - return turbulence_(); + return *turbulence_; } diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H index 5597b8718224e39683449906c245801b0a98ffe2..c211c7ed928cdd992b113f80fd894b1708c0ef17 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H @@ -133,25 +133,25 @@ inline const PtrList<volScalarField>& thermoSingleLayer::YPrimary() const inline const heatTransferModel& thermoSingleLayer::htcs() const { - return htcs_(); + return *htcs_; } inline const heatTransferModel& thermoSingleLayer::htcw() const { - return htcw_(); + return *htcw_; } inline const phaseChangeModel& thermoSingleLayer::phaseChange() const { - return phaseChange_(); + return *phaseChange_; } inline const filmRadiationModel& thermoSingleLayer::radiation() const { - return radiation_(); + return *radiation_; } diff --git a/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C index 61475876004f4e38a642830b52d16a1cf10b335f..ec37bb8cf9305d1b35061d0e804902892adf6bee 100644 --- a/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C +++ b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C @@ -348,7 +348,7 @@ const volScalarField& thermalBaffle::T() const const solidThermo& thermalBaffle::thermo() const { - return thermo_; + return *thermo_; } diff --git a/src/rigidBodyDynamics/bodies/compositeBody/compositeBodyI.H b/src/rigidBodyDynamics/bodies/compositeBody/compositeBodyI.H index dee27aec8cd51e283090fc6b373560fa7c8ad8bf..fa9a444d8c221d2dcfc63bfed888c5569d34f71d 100644 --- a/src/rigidBodyDynamics/bodies/compositeBody/compositeBodyI.H +++ b/src/rigidBodyDynamics/bodies/compositeBody/compositeBodyI.H @@ -39,7 +39,7 @@ inline Foam::RBD::compositeBody::compositeBody inline const Foam::RBD::rigidBody& Foam::RBD::compositeBody::body() const { - return body_(); + return *body_; } diff --git a/src/rigidBodyDynamics/bodies/subBody/subBodyI.H b/src/rigidBodyDynamics/bodies/subBody/subBodyI.H index 767ffc96126ef70fae2c1f510b085d4eb3861ae5..103330d58e9070cc2a899e7ef7af98076c3baccf 100644 --- a/src/rigidBodyDynamics/bodies/subBody/subBodyI.H +++ b/src/rigidBodyDynamics/bodies/subBody/subBodyI.H @@ -50,7 +50,7 @@ inline Foam::autoPtr<Foam::RBD::subBody> Foam::RBD::subBody::clone() const inline const Foam::RBD::rigidBody& Foam::RBD::subBody::body() const { - return body_(); + return *body_; } diff --git a/src/rigidBodyDynamics/joints/floating/floatingJoint.C b/src/rigidBodyDynamics/joints/floating/floatingJoint.C index 766e6504f696ba26cad44d6f4f60c094b5fbab3f..909ccde0a12ef2ea0f8e32a90eca75266c348096 100644 --- a/src/rigidBodyDynamics/joints/floating/floatingJoint.C +++ b/src/rigidBodyDynamics/joints/floating/floatingJoint.C @@ -54,8 +54,7 @@ namespace joints // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // -Foam::autoPtr<Foam::RBD::joints::composite> -Foam::RBD::joints::floating::sixDoF() +Foam::RBD::joints::composite Foam::RBD::joints::floating::sixDoF() { PtrList<joint> cj(2); cj.set(0, new joints::Pxyz()); @@ -67,7 +66,7 @@ Foam::RBD::joints::floating::sixDoF() // Alternatively the Euler-angle joint can be used cj.set(1, new joints::Rzyx()); - return autoPtr<composite>(new composite(cj)); + return composite(cj); } @@ -81,7 +80,7 @@ Foam::RBD::joints::floating::floating() Foam::RBD::joints::floating::floating(const dictionary& dict) : - composite(sixDoF()) + floating() {} @@ -91,12 +90,6 @@ Foam::autoPtr<Foam::RBD::joint> Foam::RBD::joints::floating::clone() const } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::RBD::joints::floating::~floating() -{} - - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // void Foam::RBD::joints::floating::write(Ostream& os) const diff --git a/src/rigidBodyDynamics/joints/floating/floatingJoint.H b/src/rigidBodyDynamics/joints/floating/floatingJoint.H index 785077755910b9adaaf0c73f94723e4b6a4d63af..b1a7f745ab15005203a8dae76934b329639096d0 100644 --- a/src/rigidBodyDynamics/joints/floating/floatingJoint.H +++ b/src/rigidBodyDynamics/joints/floating/floatingJoint.H @@ -68,7 +68,7 @@ class floating // Private member functions //- Return a list of joints needed to emulate a floating body - static autoPtr<composite> sixDoF(); + static composite sixDoF(); public: @@ -90,7 +90,7 @@ public: //- Destructor - virtual ~floating(); + virtual ~floating() = default; // Member Functions diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C index e6cb7c9f95ff2a7e82403ae82642ba3a07a803b6..3acf80c9164f5253684ca676eb503a5c9d7096d5 100644 --- a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C +++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C @@ -130,7 +130,7 @@ Foam::rigidBodyMeshMotion::rigidBodyMeshMotion } else { - ramp_ = new Function1Types::OneConstant<scalar>("ramp"); + ramp_.reset(new Function1Types::OneConstant<scalar>("ramp")); } const dictionary& bodiesDict = coeffDict().subDict("bodies"); diff --git a/src/sampling/sampledSet/sampledSet/sampledSet.H b/src/sampling/sampledSet/sampledSet/sampledSet.H index 1f146c9a867cdd63c29eca7abf7f6b7d2d05ccbf..079ee5fe1ac2217a4917e29e44d14c0c12f2a558 100644 --- a/src/sampling/sampledSet/sampledSet/sampledSet.H +++ b/src/sampling/sampledSet/sampledSet/sampledSet.H @@ -217,7 +217,7 @@ public: autoPtr<sampledSet> clone() const { NotImplemented; - return autoPtr<sampledSet>(nullptr); + return autoPtr<sampledSet>(); } diff --git a/src/sampling/sampledSurface/distanceSurface/distanceSurface.H b/src/sampling/sampledSurface/distanceSurface/distanceSurface.H index 8a7a0507d7551f894668d780af149d34c3ac287a..138d9d49d67f459c8536e233716d300a7701c4e7 100644 --- a/src/sampling/sampledSurface/distanceSurface/distanceSurface.H +++ b/src/sampling/sampledSurface/distanceSurface/distanceSurface.H @@ -209,12 +209,10 @@ public: { if (cell_) { - return isoSurfCellPtr_(); - } - else - { - return isoSurfPtr_(); + return *isoSurfCellPtr_; } + + return *isoSurfPtr_; } diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H index 1f7c2cb1bdc733473be53de99e1b05590c3c30be..97a2d5eb39b395c0e5e1bb62eee2642e97a6b86f 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H @@ -157,7 +157,7 @@ public: const isoSurface& surface() const { - return surfPtr_(); + return *surfPtr_; } //- Does the surface need an update? diff --git a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H index 756ee7ba9da72836c8a240868f56b4c5a5300963..1b868d2a6cbb535311250acbd542cd40a94d3432 100644 --- a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H +++ b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H @@ -141,7 +141,7 @@ public: //const isoSurfaceCell& surface() const const isoSurface& surface() const { - return isoSurfPtr_(); + return *isoSurfPtr_; } //- Does the surface need an update? diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurface.H b/src/sampling/sampledSurface/sampledSurface/sampledSurface.H index f0148f8ca64b2b35f536d8a8705348a0548efeac..1080c96d5d115ac7fa0ce3bce6af3f15ecaff346 100644 --- a/src/sampling/sampledSurface/sampledSurface/sampledSurface.H +++ b/src/sampling/sampledSurface/sampledSurface/sampledSurface.H @@ -205,7 +205,7 @@ public: autoPtr<sampledSurface> clone() const { NotImplemented; - return autoPtr<sampledSurface>(nullptr); + return autoPtr<sampledSurface>(); } diff --git a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C index 8c736658387785aecdbde70bc28a99456d810c6e..0421ee931d174785b2ff318855bbedad106d6f72 100644 --- a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C +++ b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C @@ -158,7 +158,7 @@ Foam::sampledTriSurfaceMesh::nonCoupledboundaryTree() const ); } - return boundaryTreePtr_(); + return *boundaryTreePtr_; } diff --git a/src/sampling/surfMeshSampler/surfMeshSampler/surfMeshSampler.H b/src/sampling/surfMeshSampler/surfMeshSampler/surfMeshSampler.H index c8edec3b6928f00a46656092236f2c31d4ad0c40..a4f8d5c45fd1d53a0143bb0d9814eac0cebb87e7 100644 --- a/src/sampling/surfMeshSampler/surfMeshSampler/surfMeshSampler.H +++ b/src/sampling/surfMeshSampler/surfMeshSampler/surfMeshSampler.H @@ -181,7 +181,7 @@ public: autoPtr<surfMeshSampler> clone() const { NotImplemented; - return autoPtr<surfMeshSampler>(nullptr); + return autoPtr<surfMeshSampler>(); } diff --git a/src/sampling/surface/triSurfaceMesh/discreteSurface.C b/src/sampling/surface/triSurfaceMesh/discreteSurface.C index f41c323a6da2979d80a11d97d6a87193d3eb9c6b..e04f2b8abdaa65d9e1c455880ad19cd26a395b69 100644 --- a/src/sampling/surface/triSurfaceMesh/discreteSurface.C +++ b/src/sampling/surface/triSurfaceMesh/discreteSurface.C @@ -152,7 +152,7 @@ Foam::discreteSurface::nonCoupledboundaryTree() const ); } - return boundaryTreePtr_(); + return *boundaryTreePtr_; } diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C index 53b0d3314642fa1fdcf7f0b3e1772c413e5cbfb7..8e51d68c7de206d585be2cf12cb23373b3ff2b78 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C @@ -123,7 +123,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion momentOfInertia_(dict.lookup("momentOfInertia")), aRelax_(dict.lookupOrDefault<scalar>("accelerationRelaxation", 1.0)), aDamp_(dict.lookupOrDefault<scalar>("accelerationDamping", 1.0)), - report_(dict.lookupOrDefault<Switch>("report", false)), + report_(dict.lookupOrDefault("report", false)), solver_(sixDoFSolver::New(dict.subDict("solver"), *this)) { addRestraints(dict); @@ -171,14 +171,14 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion aRelax_(sDoFRBM.aRelax_), aDamp_(sDoFRBM.aDamp_), report_(sDoFRBM.report_), - solver_(sDoFRBM.solver_, false) + solver_(sDoFRBM.solver_.clone()) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::sixDoFRigidBodyMotion::~sixDoFRigidBodyMotion() -{} +{} // Define here (incomplete type in header) // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.H b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.H index dc1e864eccc4ce81aa3afcb0375723652cc7edb9..1d5a1e99931a12a2243e87eb40b7d35f2856e6d4 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.H +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.H @@ -111,8 +111,8 @@ class sixDoFRigidBodyMotion //- Acceleration damping coefficient (for steady-state simulations) scalar aDamp_; - //- Switch to turn reporting of motion data on and off - Switch report_; + //- Reporting of motion data (on or off) + bool report_; //- Motion solver autoPtr<sixDoFSolver> solver_; diff --git a/src/sixDoFRigidBodyState/sixDoFRigidBodyState.C b/src/sixDoFRigidBodyState/sixDoFRigidBodyState.C index a77e0dc024da0c1853f7ec927142fc2bc48be3d4..7a88136a8e196af096727aa4e4b4d56a13eed19c 100644 --- a/src/sixDoFRigidBodyState/sixDoFRigidBodyState.C +++ b/src/sixDoFRigidBodyState/sixDoFRigidBodyState.C @@ -57,7 +57,6 @@ Foam::functionObjects::sixDoFRigidBodyState::angleTypeNames_ }; - // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // void Foam::functionObjects::sixDoFRigidBodyState::writeFileHeader(Ostream& os) @@ -93,12 +92,6 @@ Foam::functionObjects::sixDoFRigidBodyState::sixDoFRigidBodyState } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::functionObjects::sixDoFRigidBodyState::~sixDoFRigidBodyState() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::functionObjects::sixDoFRigidBodyState::read(const dictionary& dict) diff --git a/src/sixDoFRigidBodyState/sixDoFRigidBodyState.H b/src/sixDoFRigidBodyState/sixDoFRigidBodyState.H index e35e14044a00ca6892e8d5d8ead02781de544ee8..c260dbb4d04d3e3519bed09e8c27c55317cb2e94 100644 --- a/src/sixDoFRigidBodyState/sixDoFRigidBodyState.H +++ b/src/sixDoFRigidBodyState/sixDoFRigidBodyState.H @@ -129,7 +129,7 @@ public: //- Destructor - virtual ~sixDoFRigidBodyState(); + virtual ~sixDoFRigidBodyState() = default; // Member Functions diff --git a/src/surfMesh/surfZone/surfZone/surfZone.H b/src/surfMesh/surfZone/surfZone/surfZone.H index 40a434865423eb3d673aaf4c2c7e2f6529536d5a..95685f11c24edee1655521c73c4b5867d5066db8 100644 --- a/src/surfMesh/surfZone/surfZone/surfZone.H +++ b/src/surfMesh/surfZone/surfZone/surfZone.H @@ -115,7 +115,7 @@ public: autoPtr<surfZone> clone() const { NotImplemented; - return autoPtr<surfZone>(nullptr); + return autoPtr<surfZone>(); } static autoPtr<surfZone> New(Istream& is) diff --git a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C index b307c820c5deb7c17b848c4b3c32286d0762addd..9b32adcd51d37d0c2feb331d7739e498bcb448de 100644 --- a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C +++ b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C @@ -127,7 +127,7 @@ const Foam::liquidMixtureProperties& Foam::SLGThermo::liquids() const << abort(FatalError); } - return liquids_(); + return *liquids_; } @@ -140,7 +140,7 @@ const Foam::solidMixtureProperties& Foam::SLGThermo::solids() const << abort(FatalError); } - return solids_(); + return *solids_; } diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModelI.H b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModelI.H index b34e0b10b3269eaecdf3ca287f21e23d0d0282be..511d1a906c7352d918a3bc00ffd490d8d6bcbf48 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModelI.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModelI.H @@ -27,13 +27,13 @@ License inline Foam::psiReactionThermo& Foam::psiChemistryModel::thermo() { - return thermo_(); + return *thermo_; } inline const Foam::psiReactionThermo& Foam::psiChemistryModel::thermo() const { - return thermo_(); + return *thermo_; } diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModelI.H b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModelI.H index 9664bd77466bc968b53356eef7965be04adcb899..9553c80d326430c7a23e79b5b6a79e0324dc4d39 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModelI.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModelI.H @@ -27,13 +27,13 @@ License inline Foam::rhoReactionThermo& Foam::rhoChemistryModel::thermo() { - return thermo_(); + return *thermo_; } inline const Foam::rhoReactionThermo& Foam::rhoChemistryModel::thermo() const { - return thermo_(); + return *thermo_; } diff --git a/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C b/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C index 3250cc66b00d1945bb92872353d51fdbb6cdb00d..fcd820e25210f33a20ec48d69c81b924574107e8 100644 --- a/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C +++ b/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C @@ -75,7 +75,7 @@ void Foam::radiation::fvDOM::initialise() deltaPhi, deltaTheta, nLambda_, - absorptionEmission_, + *absorptionEmission_, blackBody_, i ) @@ -108,7 +108,7 @@ void Foam::radiation::fvDOM::initialise() deltaPhi, deltaTheta, nLambda_, - absorptionEmission_, + *absorptionEmission_, blackBody_, i ) @@ -140,7 +140,7 @@ void Foam::radiation::fvDOM::initialise() deltaPhi, deltaTheta, nLambda_, - absorptionEmission_, + *absorptionEmission_, blackBody_, i ) diff --git a/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C b/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C index b8de0f96bcd4219702abd3fcf0043ccbaf7d881b..a3069566531db6e03b05e632393c48a16337d8a5 100644 --- a/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C +++ b/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C @@ -275,7 +275,7 @@ Foam::radiation::radiationModel::absorptionEmission() const << "not activate" << abort(FatalError); } - return absorptionEmission_(); + return *absorptionEmission_; } @@ -289,7 +289,7 @@ Foam::radiation::radiationModel::soot() const << "not activate" << abort(FatalError); } - return soot_(); + return *soot_; } @@ -303,7 +303,7 @@ Foam::radiation::radiationModel::transmissivity() const << "not activate" << abort(FatalError); } - return transmissivity_(); + return *transmissivity_; } diff --git a/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.C b/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.C index 12569bda35106906d2b0026a5db9155243426a55..6d9ef2a18d12ceb39e08d38e3c4881516ce4b19c 100644 --- a/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.C +++ b/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.C @@ -131,14 +131,14 @@ Foam::radiation::boundaryRadiationPropertiesPatch:: const Foam::radiation::absorptionEmissionModel& Foam::radiation::boundaryRadiationPropertiesPatch::absorptionEmission() const { - return absorptionEmission_(); + return *absorptionEmission_; } const Foam::radiation::transmissivityModel& Foam::radiation::boundaryRadiationPropertiesPatch::transmissiveModel() const { - return transmissivity_(); + return *transmissivity_; } diff --git a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.H b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.H index fb9b8eb6a76fd63728a627b69ca3b9d9ad397ccf..4f99f59c92e754f327b5041066e674d46a8dcff9 100644 --- a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.H +++ b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.H @@ -296,7 +296,7 @@ public: //- Return coordinateSystem const coordinateSystem& coord() { - return coord_(); + return *coord_; } //- Return sunTrackingUpdateInterval diff --git a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelI.H b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelI.H index 48aa40841fb25c617c3fd99af6b522c98462a5da..d425477c04f2ac8538c3e6b43fd6e732ff67326a 100644 --- a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelI.H +++ b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelI.H @@ -27,14 +27,14 @@ License inline Foam::solidReactionThermo& Foam::basicSolidChemistryModel::solidThermo() { - return solidThermo_(); + return *solidThermo_; } inline const Foam::solidReactionThermo& Foam::basicSolidChemistryModel::solidThermo() const { - return solidThermo_(); + return *solidThermo_; } diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelectorI.H b/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelectorI.H index 16aa85ee1a6ffbba9c37e37cf53bc5e788fbe4c3..dfe42cf57d695dafa4e085a6533061b634f8d1b2 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelectorI.H +++ b/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelectorI.H @@ -30,7 +30,7 @@ inline const ThermophysicalProperties& Foam::thermophysicalPropertiesSelector<ThermophysicalProperties> ::properties() const { - return propertiesPtr_(); + return *propertiesPtr_; } diff --git a/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C b/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C index 3f7bf842d0dfa375a7e28fee050fe9c17fa63d1f..bfcf0d4368472890b054fa7dc07cf70fdec83265 100644 --- a/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C @@ -183,7 +183,7 @@ humidityTemperatureCoupledMixedFvPatchScalarField qrNbrName_(psf.qrNbrName_), qrName_(psf.qrName_), specieName_(psf.specieName_), - liquid_(psf.liquid_, false), + liquid_(psf.liquid_.clone()), liquidDict_(psf.liquidDict_), mass_(psf.mass_, mapper), Tvap_(psf.Tvap_), @@ -342,7 +342,7 @@ humidityTemperatureCoupledMixedFvPatchScalarField qrNbrName_(psf.qrNbrName_), qrName_(psf.qrName_), specieName_(psf.specieName_), - liquid_(psf.liquid_, false), + liquid_(psf.liquid_.clone()), liquidDict_(psf.liquidDict_), mass_(psf.mass_), Tvap_(psf.Tvap_), diff --git a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.H b/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.H index f1552e29051457625ac7b31ef59f4c557c3ab32e..8f4136f3c0e48071bb004fb423ffe004e42c6f3f 100644 --- a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.H +++ b/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.H @@ -108,7 +108,7 @@ public: //- Return coordinate system const coordinateSystem& cs() const { - return csPtr_(); + return *csPtr_; } //- Update the mesh for both mesh motion and topology change diff --git a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.H b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.H index 7821b2d9fb027d4a6c051cc323a8cff83045c5b1..6b69e96c1bc267e9a0e1049046865e52e13340a2 100644 --- a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.H +++ b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.H @@ -103,13 +103,13 @@ 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 phase1 density diff --git a/src/transportModels/twoPhaseProperties/alphaContactAngle/temperatureDependentAlphaContactAngle/temperatureDependentAlphaContactAngleFvPatchScalarField.C b/src/transportModels/twoPhaseProperties/alphaContactAngle/temperatureDependentAlphaContactAngle/temperatureDependentAlphaContactAngleFvPatchScalarField.C index 8dfa30a477c0447f21f3de954e2e7d0703fe9b70..1c1714285f516d27d25641065b4d5ef1b748adee 100644 --- a/src/transportModels/twoPhaseProperties/alphaContactAngle/temperatureDependentAlphaContactAngle/temperatureDependentAlphaContactAngleFvPatchScalarField.C +++ b/src/transportModels/twoPhaseProperties/alphaContactAngle/temperatureDependentAlphaContactAngle/temperatureDependentAlphaContactAngleFvPatchScalarField.C @@ -70,7 +70,7 @@ temperatureDependentAlphaContactAngleFvPatchScalarField : alphaContactAngleFvPatchScalarField(psf, p, iF, mapper), TName_(psf.TName_), - theta0_(psf.theta0_, false) + theta0_(psf.theta0_.clone()) {} @@ -82,7 +82,7 @@ temperatureDependentAlphaContactAngleFvPatchScalarField : alphaContactAngleFvPatchScalarField(psf), TName_(psf.TName_), - theta0_(psf.theta0_, false) + theta0_(psf.theta0_.clone()) {} @@ -95,7 +95,7 @@ temperatureDependentAlphaContactAngleFvPatchScalarField : alphaContactAngleFvPatchScalarField(psf, iF), TName_(psf.TName_), - theta0_(psf.theta0_, false) + theta0_(psf.theta0_.clone()) {}