From 660f3e5492f9589f0f742b112da75543ca9acc4f Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 26 Feb 2018 12:00:00 +0100 Subject: [PATCH] ENH: cleanup autoPtr class (issue #639) Improve alignment of its behaviour with std::unique_ptr - element_type typedef - release() method - identical to ptr() method - get() method to get the pointer without checking and without releasing it. - operator*() for dereferencing Method name changes - renamed rawPtr() to get() - renamed rawRef() to ref(), removed unused const version. Removed methods/operators - assignment from a raw pointer was deleted (was rarely used). Can be convenient, but uncontrolled and potentially unsafe. Do allow assignment from a literal nullptr though, since this can never leak (and also corresponds to the unique_ptr API). Additional methods - clone() method: forwards to the clone() method of the underlying data object with argument forwarding. - reset(autoPtr&&) as an alternative to operator=(autoPtr&&) STYLE: avoid implicit conversion from autoPtr to object type in many places - existing implementation has the following: operator const T&() const { return operator*(); } which means that the following code works: autoPtr map = ...; updateMesh(*map); // OK: explicit dereferencing updateMesh(map()); // OK: explicit dereferencing updateMesh(map); // OK: implicit dereferencing for clarity it may preferable to avoid the implicit dereferencing - prefer operator* to operator() when deferenced a return value so it is clearer that a pointer is involve and not a function call etc Eg, return *meshPtr_; vs. return meshPtr_(); --- .../solvers/combustion/PDRFoam/createFields.H | 4 +- .../twoPhaseMixtureThermo.H | 8 +- .../phaseModel/phaseModel.C | 2 +- .../phaseModel/phaseModel.H | 4 +- ...incompressibleTwoPhaseInteractingMixture.H | 4 +- .../incompressibleThreePhaseMixture.H | 6 +- .../multiphaseSystem/phaseModel/phaseModel.C | 2 +- .../multiphaseSystem/phaseModel/phaseModel.H | 4 +- .../multiphaseMixture/phase/phase.C | 2 +- .../multiphaseMixture/phase/phase.H | 2 +- .../HeatAndMassTransferPhaseSystem.C | 49 +--- .../HeatTransferPhaseSystem.C | 12 +- ...terfaceCompositionPhaseChangePhaseSystem.C | 34 +-- .../MomentumTransferPhaseSystem.C | 101 ++----- .../ThermalPhaseChangePhaseSystem.C | 48 +--- .../MovingPhaseModel/MovingPhaseModel.C | 2 +- .../phaseModel/phaseModel/phaseModel.C | 2 +- .../phaseSystem/phaseSystemTemplates.C | 10 +- .../reactingMultiphaseEulerFoam/pU/pEqn.H | 9 +- .../IATE/IATEsources/IATEsource/IATEsource.H | 2 +- .../BlendedInterfacialModel.C | 8 +- .../IATE/IATEsources/IATEsource/IATEsource.H | 2 +- .../twoPhaseSystem/phaseModel/phaseModel.C | 4 +- .../twoPhaseSystem/phaseModel/phaseModel.H | 8 +- .../twoPhaseSystem/twoPhaseSystem.C | 62 ++--- .../solidDisplacementFoam/createFields.H | 2 +- applications/test/autoPtr/Make/files | 3 + applications/test/autoPtr/Make/options | 5 + applications/test/autoPtr/Test-autoPtr.C | 219 +++++++++++++++ .../test/fieldMapping/Test-fieldMapping.C | 4 +- applications/test/hexRef8/Test-hexRef8.C | 4 +- .../utilities/mesh/advanced/PDRMesh/PDRMesh.C | 8 +- .../advanced/collapseEdges/collapseEdges.C | 10 +- .../combinePatchFaces/combinePatchFaces.C | 6 +- .../advanced/refineHexMesh/refineHexMesh.C | 4 +- .../mesh/advanced/removeFaces/removeFaces.C | 10 +- .../mesh/advanced/selectCells/selectCells.C | 12 +- .../mesh/conversion/ccm/ccmToFoam/ccmToFoam.C | 4 +- .../mesh/conversion/star4ToFoam/star4ToFoam.C | 2 +- .../conversion/tetgenToFoam/tetgenToFoam.C | 2 +- .../extrude/extrudeMesh/extrudeMesh.C | 8 +- .../extrudeToRegionMesh/extrudeToRegionMesh.C | 4 +- .../extrude2DMesh/extrude2DMeshApp.C | 4 +- .../DelaunayMesh/DistributedDelaunayMesh.C | 10 +- .../DelaunayMesh/DistributedDelaunayMesh.H | 2 +- .../backgroundMeshDecomposition.C | 24 +- .../backgroundMeshDecomposition.H | 2 +- .../backgroundMeshDecompositionI.H | 2 +- .../conformalVoronoiMesh.C | 6 +- .../conformalVoronoiMeshI.H | 2 +- .../conformalVoronoiMeshTemplates.C | 2 +- .../initialPointsMethod/initialPointsMethod.C | 6 - .../initialPointsMethod/initialPointsMethod.H | 4 +- .../searchableSurfaceFeatures.H | 2 +- .../foamyMesh/foamyQuadMesh/foamyQuadMesh.C | 2 +- .../manipulation/checkMesh/checkGeometry.C | 6 +- .../manipulation/checkMesh/checkTopology.C | 6 +- .../createBaffles/createBaffles.C | 5 +- .../faceSelection/faceSelection.H | 2 +- .../faceSelection/faceZoneSelection.H | 2 +- .../searchableSurfaceSelection.H | 2 +- .../mergeOrSplitBaffles/mergeOrSplitBaffles.C | 4 +- .../polyDualMesh/polyDualMeshApp.C | 2 +- .../manipulation/renumberMesh/renumberMesh.C | 2 +- .../mesh/manipulation/setSet/setSet.C | 4 +- .../reconstructParMesh/reconstructParMesh.C | 8 +- .../redistributePar/redistributePar.C | 19 +- .../ensightOutputCloudTemplates.C | 2 +- .../ensightOutputSerialCloudTemplates.C | 2 +- .../foamToEnsightParts/foamToEnsightParts.C | 2 +- .../foamToVTK/foamVtkLagrangianWriter.H | 2 +- .../miscellaneous/pdfPlot/createFields.H | 2 +- .../searchableSurfaceModifier/autoPatch.H | 2 +- .../searchableSurfaceModifier/cut.H | 2 +- .../searchableSurfaceModifier.H | 2 +- .../dynamicIndexedOctree.C | 42 ++- .../dynamicIndexedOctree.H | 2 +- .../decomposedBlockData/decomposedBlockData.C | 78 +++--- src/OpenFOAM/db/IOstreams/token/token.C | 6 - src/OpenFOAM/db/IOstreams/token/token.H | 22 +- src/OpenFOAM/db/Time/Time.H | 2 +- src/OpenFOAM/db/dictionary/entry/entryIO.C | 2 +- .../functionObject/functionObject.H | 2 +- .../functionObjectList/functionObjectList.C | 4 +- .../timeControl/timeControlFunctionObjectI.H | 2 +- .../db/functionObjects/writeFile/writeFile.C | 2 +- src/OpenFOAM/db/regIOobject/regIOobjectRead.C | 4 +- .../codedFixedValuePointPatchField.C | 2 +- .../uniformFixedValuePointPatchField.C | 6 +- .../fileOperation/fileOperation.C | 7 +- .../LUscalarMatrix/procLduInterface.H | 2 +- .../lduMatrix/lduMatrixPreconditioner.C | 2 +- .../lduMatrix/lduMatrix/lduMatrixSmoother.C | 2 +- .../lduMatrix/lduMatrix/lduMatrixSolver.C | 2 +- .../GAMGAgglomeration/GAMGAgglomeration.C | 2 +- src/OpenFOAM/memory/autoPtr/autoPtr.H | 255 +++++++++++++----- src/OpenFOAM/memory/autoPtr/autoPtrI.H | 233 ++++++++++------ .../polyMesh/globalMeshData/globalMeshData.C | 59 ++-- .../polyMesh/globalMeshData/globalPoints.H | 4 +- .../mapDistribute/mapDistributeBase.C | 2 +- .../meshes/polyMesh/mapPolyMesh/mapPolyMesh.C | 12 +- .../meshes/polyMesh/mapPolyMesh/mapPolyMesh.H | 2 +- .../polyBoundaryMesh/polyBoundaryMesh.C | 7 +- src/OpenFOAM/meshes/polyMesh/polyMesh.C | 12 +- src/OpenFOAM/meshes/polyMesh/polyMeshIO.C | 2 +- .../constraint/processor/processorPolyPatch.C | 4 +- .../functions/Function1/Scale/Scale.C | 4 +- .../functions/Function1/Sine/Sine.C | 8 +- .../functions/Function1/Square/Square.C | 8 +- .../functions/Function1/Table/TableBase.C | 2 +- ...allHeatFluxTemperatureFvPatchScalarField.C | 6 +- .../thermalBaffle1DFvPatchScalarField.C | 2 +- .../turbulenceModels/LES/LESModel/LESModel.H | 2 +- .../LES/LESdeltas/IDDESDelta/IDDESDelta.H | 2 +- .../RAS/kOmegaSSTSAS/kOmegaSSTSAS.H | 2 +- .../porousBafflePressureFvPatchField.C | 14 +- .../psiThermoCombustion/psiThermoCombustion.C | 4 +- .../rhoThermoCombustion/rhoThermoCombustion.C | 4 +- src/conversion/common/reader/meshReader.C | 15 +- src/conversion/ensight/mesh/ensightMeshI.H | 2 +- .../ensight/mesh/ensightMeshOptions.C | 4 +- src/conversion/ensight/output/ensightOutput.H | 2 +- .../ensight/output/ensightSerialOutput.H | 4 +- .../vtk/output/foamVtkInternalWriter.H | 2 +- .../vtk/output/foamVtkPatchWriter.H | 2 +- .../vtk/output/foamVtkSurfaceMeshWriter.H | 2 +- .../dynamicMotionSolverFvMesh.C | 2 +- .../dynamicRefineFvMesh/dynamicRefineFvMesh.C | 61 ++--- .../extrudePatchMesh/extrudePatchMesh.C | 12 +- .../extrudePatchMesh/extrudePatchMesh.H | 2 +- src/dynamicMesh/fvMeshAdder/fvMeshAdder.C | 31 +-- .../fvMeshDistribute/fvMeshDistribute.C | 25 +- src/dynamicMesh/fvMeshSubset/fvMeshSubset.C | 6 +- src/dynamicMesh/meshCut/cellCuts/cellCuts.H | 2 +- .../meshCut/cellLooper/cellLooper.H | 2 +- .../multiDirRefinement/multiDirRefinement.C | 2 +- ...yMotionDisplacementPointPatchVectorField.C | 2 +- ...yMotionDisplacementPointPatchVectorField.H | 2 +- .../motionSolvers/motionSolver/motionSolver.C | 2 +- .../polyMeshAdder/faceCoupleInfo.H | 6 +- .../polyTopoChange/hexRef8/hexRef8.C | 2 +- .../polyTopoChanger/polyTopoChanger.C | 2 +- .../repatchPolyTopoChanger.C | 2 +- src/engine/enginePiston/enginePiston.H | 2 +- src/engine/engineValve/engineValve.H | 2 +- .../cfdTools/general/MRF/MRFZone.H | 2 +- .../cfdTools/general/fvOptions/fvOption.H | 2 +- .../porosityModel/porosityModel.C | 2 +- .../codedFixedValueFvPatchField.C | 2 +- .../codedMixed/codedMixedFvPatchField.C | 2 +- ...lindricalInletVelocityFvPatchVectorField.C | 18 +- .../derived/fixedMean/fixedMeanFvPatchField.C | 6 +- .../fixedProfile/fixedProfileFvPatchField.C | 6 +- .../flowRateInletVelocityFvPatchVectorField.C | 6 +- ...flowRateOutletVelocityFvPatchVectorField.C | 6 +- ...ureInletOutletVelocityFvPatchVectorField.C | 6 +- ...ureInletOutletVelocityFvPatchVectorField.H | 2 +- .../rotatingTotalPressureFvPatchScalarField.C | 6 +- .../rotatingWallVelocityFvPatchVectorField.C | 8 +- ...lFlowRateInletVelocityFvPatchVectorField.C | 12 +- .../swirlInletVelocityFvPatchVectorField.C | 18 +- .../timeVaryingMappedFixedValueFvPatchField.C | 6 +- ...ranslatingWallVelocityFvPatchVectorField.C | 8 +- .../turbulentDFSEMInletFvPatchVectorField.C | 2 +- .../uniformFixedGradientFvPatchField.C | 6 +- .../uniformFixedValueFvPatchField.C | 6 +- .../uniformInletOutletFvPatchField.C | 6 +- .../uniformJump/uniformJumpFvPatchField.C | 6 +- .../uniformJumpAMIFvPatchField.C | 6 +- .../uniformTotalPressureFvPatchScalarField.C | 6 +- ...tFlowRateInletVelocityFvPatchVectorField.C | 6 +- .../CrankNicolsonDdtScheme.C | 5 +- .../extendedCentredCellToCellStencil.H | 2 +- .../extendedCentredCellToFaceStencil.H | 2 +- .../extendedUpwindCellToFaceStencil.H | 4 +- .../extendedCentredFaceToCellStencil.H | 2 +- .../field/streamLine/streamLineBase.C | 2 +- .../codedFunctionObject/codedFunctionObject.C | 2 +- .../utilities/ensightWrite/ensightWrite.H | 4 +- .../displacementSBRStressFvMotionSolver.H | 2 +- .../displacementLaplacianFvMotionSolver.C | 3 +- ...dBodyDisplacementLaplacianFvMotionSolver.C | 3 +- ...surfaceDisplacementPointPatchVectorField.C | 3 +- ...aceSlipDisplacementPointPatchVectorField.C | 3 +- ...meVaryingMappedFixedValuePointPatchField.C | 6 +- .../interRegionOption/interRegionOptionI.H | 2 +- .../jouleHeatingSource/jouleHeatingSource.C | 2 +- .../sources/general/codedSource/CodedSource.C | 2 +- .../interRegionHeatTransferModelI.H | 4 +- .../tabulatedHeatTransfer.C | 4 +- .../tabulatedNTUHeatTransfer.C | 2 +- .../variableHeatTransfer.C | 8 +- .../variableHeatTransfer.H | 9 +- .../clouds/Templates/DSMCCloud/DSMCCloudI.H | 10 +- .../InteractionLists/InteractionListsI.H | 4 +- .../CollidingCloud/CollidingCloudI.H | 6 +- .../Templates/KinematicCloud/KinematicCloud.C | 7 - .../Templates/KinematicCloud/KinematicCloud.H | 2 +- .../KinematicCloud/KinematicCloudI.H | 30 +-- .../clouds/Templates/MPPICCloud/MPPICCloudI.H | 14 +- .../Templates/ReactingCloud/ReactingCloud.C | 7 - .../Templates/ReactingCloud/ReactingCloud.H | 2 +- .../Templates/ReactingCloud/ReactingCloudI.H | 8 +- .../ReactingMultiphaseCloudI.H | 6 +- .../Templates/ThermoCloud/ThermoCloud.C | 7 - .../Templates/ThermoCloud/ThermoCloud.H | 2 +- .../Templates/ThermoCloud/ThermoCloudI.H | 38 ++- .../KinematicParcelTrackingDataI.H | 6 +- .../MPPICParcel/MPPICParcelTrackingDataI.H | 6 +- .../ReactingParcelTrackingDataI.H | 2 +- .../ThermoParcel/ThermoParcelTrackingDataI.H | 8 +- .../ParticleTracks/ParticleTracksI.H | 2 +- .../CellZoneInjection/CellZoneInjection.C | 2 +- .../ConeInjection/ConeInjection.C | 2 +- .../ConeNozzleInjection/ConeNozzleInjection.C | 2 +- .../FieldActivatedInjection.C | 2 +- .../InflationInjection/InflationInjection.C | 2 +- .../ManualInjection/ManualInjection.C | 2 +- .../PatchFlowRateInjection.C | 2 +- .../PatchInjection/PatchInjection.C | 2 +- .../Lift/LiftForce/LiftForceI.H | 2 +- .../PressureGradient/PressureGradientForceI.H | 2 +- .../LocalInteraction/LocalInteraction.C | 4 +- .../AveragingMethod/AveragingMethod.C | 7 - .../AveragingMethod/AveragingMethod.H | 2 +- .../MPPIC/AveragingMethods/Dual/Dual.C | 26 +- .../MPPIC/AveragingMethods/Dual/Dual.H | 12 +- .../pairPotentialList/pairPotentialListI.H | 3 +- .../clouds/Templates/SprayCloud/SprayCloudI.H | 6 +- src/lumpedPointMotion/lumpedPointMovement.C | 2 +- .../blockEdges/blockEdge/blockEdge.C | 2 +- .../blockFaces/blockFace/blockFace.C | 2 +- .../blockVertices/blockVertex/blockVertex.C | 4 +- src/mesh/blockMesh/blocks/block/block.H | 2 +- .../displacementMeshMoverMotionSolver.C | 2 +- .../medialAxisMeshMover.C | 4 +- .../meshRefinement/meshRefinement.C | 46 ++-- .../meshRefinement/meshRefinementBaffles.C | 60 +++-- .../meshRefinement/meshRefinementMerge.C | 44 +-- .../meshRefinement/meshRefinementRefine.C | 9 +- .../refinementFeatures/refinementFeatures.C | 3 +- .../snappyHexMeshDriver/snappyLayerDriver.C | 66 ++--- .../AMIInterpolation/AMIInterpolationI.H | 4 +- .../cyclicACMIGAMGInterface.H | 2 +- .../cyclicAMIGAMGInterface.H | 2 +- .../cyclicACMIPointPatchField.H | 4 +- .../cyclicAMIPointPatchField.H | 4 +- .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.C | 2 +- .../coordinateRotation/cylindrical.C | 8 +- .../coordinateRotation/cylindrical.H | 2 +- .../coordinateSystems/coordinateSystem.C | 92 ++++--- .../coordinateSystems/coordinateSystem.H | 34 ++- src/meshTools/edgeMesh/edgeMesh.C | 2 +- .../extendedEdgeMesh/extendedEdgeMesh.C | 8 +- .../mappedPolyPatch/mappedPatchBaseI.H | 4 +- src/meshTools/meshSearch/meshSearch.C | 4 +- .../regionCoupledBaseGAMGInterface.H | 2 +- .../regionCoupledBase.C | 2 +- src/meshTools/regionSplit/regionSplit.H | 2 +- .../searchableSurface/searchableSurface.H | 2 +- .../triSurfaceMesh/triSurfaceMesh.C | 3 +- .../sets/topoSetSource/topoSetSource.H | 2 +- src/meshTools/sets/topoSets/topoSet.H | 2 +- .../triSurfaceSearch/triSurfaceSearch.C | 2 +- .../dynamicOversetFvMesh.C | 4 +- .../oversetPolyPatch/oversetGAMGInterface.H | 2 +- .../decompose/decompose/decompositionModel.H | 2 +- .../distributedTriSurfaceMesh.C | 2 +- .../pyrolysisModel/pyrolysisModel.H | 2 +- .../regionModel/regionModel/regionModelI.H | 8 +- .../regionModel1D/regionModel1DI.H | 2 +- .../singleLayerRegion/singleLayerRegion.C | 4 +- ...linedFilmNusseltHeightFvPatchScalarField.C | 18 +- ...lmNusseltInletVelocityFvPatchVectorField.C | 18 +- .../kinematicSingleLayerI.H | 4 +- .../thermoSingleLayer/thermoSingleLayerI.H | 8 +- .../thermalBaffle/thermalBaffle.C | 2 +- .../bodies/compositeBody/compositeBodyI.H | 2 +- .../bodies/subBody/subBodyI.H | 2 +- .../joints/floating/floatingJoint.C | 13 +- .../joints/floating/floatingJoint.H | 4 +- .../rigidBodyMeshMotion/rigidBodyMeshMotion.C | 2 +- .../sampledSet/sampledSet/sampledSet.H | 2 +- .../distanceSurface/distanceSurface.H | 8 +- .../isoSurface/sampledIsoSurface.H | 2 +- .../sampledCuttingPlane/sampledCuttingPlane.H | 2 +- .../sampledSurface/sampledSurface.H | 2 +- .../sampledTriSurfaceMesh.C | 2 +- .../surfMeshSampler/surfMeshSampler.H | 2 +- .../surface/triSurfaceMesh/discreteSurface.C | 2 +- .../sixDoFRigidBodyMotion.C | 6 +- .../sixDoFRigidBodyMotion.H | 4 +- .../sixDoFRigidBodyState.C | 7 - .../sixDoFRigidBodyState.H | 2 +- src/surfMesh/surfZone/surfZone/surfZone.H | 2 +- .../SLGThermo/SLGThermo/SLGThermo.C | 4 +- .../psiChemistryModel/psiChemistryModelI.H | 4 +- .../rhoChemistryModel/rhoChemistryModelI.H | 4 +- .../radiationModels/fvDOM/fvDOM/fvDOM.C | 6 +- .../radiationModel/radiationModel.C | 6 +- .../boundaryRadiationPropertiesPatch.C | 4 +- .../solarCalculator/solarCalculator.H | 2 +- .../basicSolidChemistryModelI.H | 4 +- .../thermophysicalPropertiesSelectorI.H | 2 +- ...emperatureCoupledMixedFvPatchScalarField.C | 4 +- .../mixerFvMesh/mixerFvMesh.H | 2 +- .../incompressibleTwoPhaseMixture.H | 4 +- ...ndentAlphaContactAngleFvPatchScalarField.C | 6 +- 308 files changed, 1613 insertions(+), 1388 deletions(-) create mode 100644 applications/test/autoPtr/Make/files create mode 100644 applications/test/autoPtr/Make/options create mode 100644 applications/test/autoPtr/Test-autoPtr.C diff --git a/applications/solvers/combustion/PDRFoam/createFields.H b/applications/solvers/combustion/PDRFoam/createFields.H index 84155c4849..c0602016c8 100644 --- a/applications/solvers/combustion/PDRFoam/createFields.H +++ b/applications/solvers/combustion/PDRFoam/createFields.H @@ -165,7 +165,7 @@ IOdictionary PDRProperties autoPtr drag = PDRDragModel::New ( PDRProperties, - turbulence, + *turbulence, rho, U, phi @@ -176,7 +176,7 @@ autoPtr flameWrinkling = XiModel::New ( PDRProperties, thermo, - turbulence, + *turbulence, Su, rho, b, diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H index aefdbdee4f..b84ce6a7fa 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H @@ -89,22 +89,22 @@ public: const rhoThermo& thermo1() const { - return thermo1_(); + return *thermo1_; } const rhoThermo& thermo2() const { - return thermo2_(); + return *thermo2_; } rhoThermo& thermo1() { - return thermo1_(); + return *thermo1_; } rhoThermo& thermo2() { - return thermo2_(); + return *thermo2_; } //- Correct the thermodynamics of each phase diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.C b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.C index c97a5a1382..007b8206ae 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.C @@ -81,7 +81,7 @@ Foam::phaseModel::phaseModel Foam::autoPtr Foam::phaseModel::clone() const { NotImplemented; - return autoPtr(nullptr); + return autoPtr(); } diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H index 66d0ac8d63..44310e4df3 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H @@ -120,13 +120,13 @@ public: //- Return const-access to phase rhoThermo const rhoThermo& thermo() const { - return thermo_(); + return *thermo_; } //- Return access to phase rhoThermo rhoThermo& thermo() { - return thermo_(); + return *thermo_; } //- Return const-access to phase divergence diff --git a/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.H b/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.H index 0950bbaba0..d790264fef 100644 --- a/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.H +++ b/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.H @@ -106,13 +106,13 @@ public: //- Return const-access to the mixture viscosityModel const mixtureViscosityModel& muModel() const { - return muModel_(); + return *muModel_; } //- Return const-access to the continuous-phase viscosityModel const viscosityModel& nucModel() const { - return nucModel_(); + return *nucModel_; } //- Return const-access to the dispersed-phase density diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/incompressibleThreePhaseMixture.H b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/incompressibleThreePhaseMixture.H index 58341e6cad..393c388d9f 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/incompressibleThreePhaseMixture.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/incompressibleThreePhaseMixture.H @@ -181,19 +181,19 @@ public: //- Return const-access to phase1 viscosityModel const viscosityModel& nuModel1() const { - return nuModel1_(); + return *nuModel1_; } //- Return const-access to phase2 viscosityModel const viscosityModel& nuModel2() const { - return nuModel2_(); + return *nuModel2_; } //- Return const-access to phase3 viscosityModel const viscosityModel& nuModel3() const { - return nuModel3_(); + return *nuModel3_; } //- Return the dynamic laminar viscosity diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C index 224d0345d6..b57058d61f 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C @@ -205,7 +205,7 @@ Foam::phaseModel::~phaseModel() Foam::autoPtr Foam::phaseModel::clone() const { NotImplemented; - return autoPtr(nullptr); + return autoPtr(); } diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H index 90e48183ca..3740878610 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H @@ -190,12 +190,12 @@ public: const surfaceScalarField& phi() const { - return phiPtr_(); + return *phiPtr_; } surfaceScalarField& phi() { - return phiPtr_(); + return *phiPtr_; } const surfaceScalarField& alphaPhi() const diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C index 5fc59061a4..e14906619b 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C @@ -68,7 +68,7 @@ Foam::phase::phase Foam::autoPtr Foam::phase::clone() const { NotImplemented; - return autoPtr(nullptr); + return autoPtr(); } diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.H b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.H index 91341fcf5c..3ce0ba7d65 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.H +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.H @@ -120,7 +120,7 @@ public: //- Return const-access to phase1 viscosityModel const viscosityModel& nuModel() const { - return nuModel_(); + return *nuModel_; } //- Return the kinematic laminar viscosity diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatAndMassTransferPhaseSystem/HeatAndMassTransferPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatAndMassTransferPhaseSystem/HeatAndMassTransferPhaseSystem.C index c63f6bfd44..bb493847b0 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatAndMassTransferPhaseSystem/HeatAndMassTransferPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatAndMassTransferPhaseSystem/HeatAndMassTransferPhaseSystem.C @@ -59,14 +59,9 @@ HeatAndMassTransferPhaseSystem massTransferModels_ ); - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -197,14 +192,9 @@ Foam::HeatAndMassTransferPhaseSystem::dmdt ) ); - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -239,14 +229,9 @@ Foam::HeatAndMassTransferPhaseSystem::momentumTransfer() const phaseSystem::momentumTransferTable& eqns = eqnsPtr(); // Source term due to mass trasfer - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -291,17 +276,10 @@ Foam::HeatAndMassTransferPhaseSystem::heatTransfer() const } // Heat transfer with the interface - forAllConstIter - ( - heatTransferModelTable, - heatTransferModels_, - heatTransferModelIter - ) + forAllConstIters(heatTransferModels_, heatTransferModelIter) { - const phasePair& pair - ( - this->phasePairs_[heatTransferModelIter.key()] - ); + const phasePair& pair = + *(this->phasePairs_[heatTransferModelIter.key()]); const phaseModel* phase = &pair.phase1(); const phaseModel* otherPhase = &pair.phase2(); @@ -344,14 +322,9 @@ Foam::HeatAndMassTransferPhaseSystem::heatTransfer() const } // Source term due to mass transfer - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C index 9fee19e77f..465d0b3af9 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C @@ -128,16 +128,12 @@ Foam::HeatTransferPhaseSystem::heatTransfer() const ); } - forAllConstIter - ( - heatTransferModelTable, - heatTransferModels_, - heatTransferModelIter - ) + forAllConstIters(heatTransferModels_, heatTransferModelIter) { - const volScalarField K(heatTransferModelIter()->K()); + const phasePair& pair = + *(this->phasePairs_[heatTransferModelIter.key()]); - const phasePair& pair(this->phasePairs_[heatTransferModelIter.key()]); + const volScalarField K(heatTransferModelIter()->K()); const phaseModel* phase = &pair.phase1(); const phaseModel* otherPhase = &pair.phase2(); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C index 1c9b53c803..53f724680b 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C @@ -86,14 +86,9 @@ massTransfer() const } // Reset the interfacial mass flow rates - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -108,22 +103,18 @@ massTransfer() const } // Sum up the contribution from each interface composition model - forAllConstIter + forAllConstIters ( - interfaceCompositionModelTable, interfaceCompositionModels_, interfaceCompositionModelIter ) { - const interfaceCompositionModel& compositionModel - ( - interfaceCompositionModelIter() - ); + const phasePair& pair = + *(this->phasePairs_[interfaceCompositionModelIter.key()]); + + const interfaceCompositionModel& compositionModel = + *(interfaceCompositionModelIter.object()); - const phasePair& pair - ( - this->phasePairs_[interfaceCompositionModelIter.key()] - ); const phaseModel& phase = pair.phase1(); const phaseModel& otherPhase = pair.phase2(); const phasePairKey key(phase.name(), otherPhase.name()); @@ -209,14 +200,9 @@ correctThermo() // Yfi is likely to be a strong non-linear (typically exponential) function // of Tf, so the solution for the temperature is newton-accelerated - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C index 02969b89cb..43d5881fed 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C @@ -82,14 +82,10 @@ MomentumTransferPhaseSystem turbulentDispersionModels_ ); - forAllConstIter - ( - dragModelTable, - dragModels_, - dragModelIter - ) + forAllConstIters(dragModels_, dragModelIter) { - const phasePair& pair(this->phasePairs_[dragModelIter.key()]); + const phasePair& pair = + *(this->phasePairs_[dragModelIter.key()]); Kds_.insert ( @@ -102,14 +98,10 @@ MomentumTransferPhaseSystem ); } - forAllConstIter - ( - virtualMassModelTable, - virtualMassModels_, - virtualMassModelIter - ) + forAllConstIters(virtualMassModels_, virtualMassModelIter) { - const phasePair& pair(this->phasePairs_[virtualMassModelIter.key()]); + const phasePair& pair = + *(this->phasePairs_[virtualMassModelIter.key()]); Vms_.insert ( @@ -183,16 +175,11 @@ Foam::MomentumTransferPhaseSystem::Kd ) ); - forAllConstIter - ( - phaseSystem::KdTable, - Kds_, - KdIter - ) + forAllConstIters(Kds_, KdIter) { - const volScalarField& K(*KdIter()); + const phasePair& pair = *(this->phasePairs_[KdIter.key()]); - const phasePair& pair(this->phasePairs_[KdIter.key()]); + const volScalarField& K(*KdIter()); const phaseModel* phase1 = &pair.phase1(); const phaseModel* phase2 = &pair.phase2(); @@ -430,27 +417,17 @@ Foam::MomentumTransferPhaseSystem::momentumTransfer() const } // Update the drag coefficients - forAllConstIter - ( - dragModelTable, - dragModels_, - dragModelIter - ) + forAllConstIters(dragModels_, dragModelIter) { *Kds_[dragModelIter.key()] = dragModelIter()->K(); } // Add the implicit part of the drag force - forAllConstIter - ( - phaseSystem::KdTable, - Kds_, - KdIter - ) + forAllConstIters(Kds_, KdIter) { - const volScalarField& K(*KdIter()); + const phasePair& pair = *(this->phasePairs_[KdIter.key()]); - const phasePair& pair(this->phasePairs_[KdIter.key()]); + const volScalarField& K(*KdIter()); const phaseModel* phase = &pair.phase1(); const phaseModel* otherPhase = &pair.phase2(); @@ -466,27 +443,17 @@ Foam::MomentumTransferPhaseSystem::momentumTransfer() const } // Update the virtual mass coefficients - forAllConstIter - ( - virtualMassModelTable, - virtualMassModels_, - virtualMassModelIter - ) + forAllConstIters(virtualMassModels_, virtualMassModelIter) { *Vms_[virtualMassModelIter.key()] = virtualMassModelIter()->K(); } // Add the virtual mass force - forAllConstIter - ( - phaseSystem::VmTable, - Vms_, - VmIter - ) + forAllConstIters(Vms_, VmIter) { - const volScalarField& Vm(*VmIter()); + const phasePair& pair = *(this->phasePairs_[VmIter.key()]); - const phasePair& pair(this->phasePairs_[VmIter.key()]); + const volScalarField& Vm(*VmIter()); const phaseModel* phase = &pair.phase1(); const phaseModel* otherPhase = &pair.phase2(); @@ -557,33 +524,22 @@ Foam::MomentumTransferPhaseSystem::Fs() const PtrList& Fs = tFs(); // Add the lift force - forAllConstIter - ( - liftModelTable, - liftModels_, - liftModelIter - ) + forAllConstIters(liftModels_, modelIter) { - const volVectorField F(liftModelIter()->F()); + const phasePair& pair = *(this->phasePairs_[modelIter.key()]); - const phasePair& pair(this->phasePairs_[liftModelIter.key()]); + const volVectorField F(modelIter()->template F()); setF(Fs, pair.phase1().index()) += F; setF(Fs, pair.phase2().index()) -= F; } // Add the wall lubrication force - forAllConstIter - ( - wallLubricationModelTable, - wallLubricationModels_, - wallLubricationModelIter - ) + forAllConstIters(wallLubricationModels_, modelIter) { - const volVectorField F(wallLubricationModelIter()->F()); + const phasePair& pair = *(this->phasePairs_[modelIter.key()]); - const phasePair& - pair(this->phasePairs_[wallLubricationModelIter.key()]); + const volVectorField F(modelIter()->template F()); setF(Fs, pair.phase1().index()) += F; setF(Fs, pair.phase2().index()) -= F; @@ -647,15 +603,10 @@ Foam::MomentumTransferPhaseSystem::phiDs PtrList& phiDs = tphiDs(); // Add the turbulent dispersion force - forAllConstIter - ( - turbulentDispersionModelTable, - turbulentDispersionModels_, - turbulentDispersionModelIter - ) + forAllConstIters(turbulentDispersionModels_, turbulentDispersionModelIter) { - const phasePair& - pair(this->phasePairs_[turbulentDispersionModelIter.key()]); + const phasePair& pair = + *(this->phasePairs_[turbulentDispersionModelIter.key()]); const volScalarField D(turbulentDispersionModelIter()->D()); const surfaceScalarField snGradAlpha1 diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C index a6dd838d23..bb5c2462c3 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C @@ -42,14 +42,9 @@ ThermalPhaseChangePhaseSystem massTransfer_(this->lookup("massTransfer")) { - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -92,7 +87,7 @@ template const Foam::saturationModel& Foam::ThermalPhaseChangePhaseSystem::saturation() const { - return saturationModel_(); + return *saturationModel_; } @@ -109,14 +104,9 @@ Foam::ThermalPhaseChangePhaseSystem::heatTransfer() const phaseSystem::heatTransferTable& eqns = eqnsPtr(); // Accumulate mDotL contributions from boundaries - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -219,19 +209,15 @@ Foam::ThermalPhaseChangePhaseSystem::massTransfer() const } } - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { continue; } + const phaseModel& phase = pair.phase1(); const phaseModel& otherPhase = pair.phase2(); @@ -292,14 +278,9 @@ Foam::ThermalPhaseChangePhaseSystem::iDmdt ) ); - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { @@ -332,14 +313,9 @@ void Foam::ThermalPhaseChangePhaseSystem::correctThermo() BasePhaseSystem::correctThermo(); - forAllConstIter - ( - phaseSystem::phasePairTable, - this->phasePairs_, - phasePairIter - ) + forAllConstIters(this->phasePairs_, phasePairIter) { - const phasePair& pair(phasePairIter()); + const phasePair& pair = *(phasePairIter.object()); if (pair.ordered()) { diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C index 2afa388aca..460e21ce85 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C @@ -401,7 +401,7 @@ template const Foam::phaseCompressibleTurbulenceModel& Foam::MovingPhaseModel::turbulence() const { - return turbulence_; + return *turbulence_; } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C index da10824230..26be4e1bc7 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C @@ -77,7 +77,7 @@ Foam::phaseModel::phaseModel Foam::autoPtr Foam::phaseModel::clone() const { NotImplemented; - return autoPtr(nullptr); + return autoPtr(); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C index 8f4bf7ee0f..768c905e1f 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C @@ -48,8 +48,8 @@ void Foam::phaseSystem::createSubModels key, modelType::New ( - *iter, - phasePairs_[key] + iter.object(), + phasePairs_[key]() ) ); } @@ -98,11 +98,11 @@ void Foam::phaseSystem::generatePairsAndSubModels const blendingMethod& blending ( blendingMethods_.found(modelName) - ? blendingMethods_[modelName] - : blendingMethods_["default"] + ? *(blendingMethods_[modelName]) + : *(blendingMethods_["default"]) ); - autoPtr noModel(nullptr); + autoPtr noModel; forAllConstIter(typename modelTypeTable, tempModels, iter) { diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H index a164b73f26..758c411968 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H @@ -217,16 +217,11 @@ while (pimple.correct()) ) ); - forAllConstIter - ( - phaseSystem::KdTable, - fluid.Kds(), - KdIter - ) + forAllConstIters(fluid.Kds(), KdIter) { const volScalarField& K(*KdIter()); - const phasePair& pair(fluid.phasePairs()[KdIter.key()]); + const phasePair& pair = *(fluid.phasePairs()[KdIter.key()]); const phaseModel* phase1 = &pair.phase1(); const phaseModel* phase2 = &pair.phase2(); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H index 3183796015..db917c4865 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H @@ -115,7 +115,7 @@ public: autoPtr clone() const { NotImplemented; - return autoPtr(nullptr); + return autoPtr(); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.C index cc089e347e..289054982d 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.C @@ -451,9 +451,11 @@ bool Foam::BlendedInterfacialModel::hasModel ) const { return - &phase == &(pair_.phase1()) + ( + &phase == &(pair_.phase1()) ? model1In2_.valid() - : model2In1_.valid(); + : model2In1_.valid() + ); } @@ -463,7 +465,7 @@ const modelType& Foam::BlendedInterfacialModel::phaseModel const class phaseModel& phase ) const { - return &phase == &(pair_.phase1()) ? model1In2_ : model2In1_; + return &phase == &(pair_.phase1()) ? *model1In2_ : *model2In1_; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H index c7655b9c34..29c150ce74 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H @@ -114,7 +114,7 @@ public: autoPtr clone() const { NotImplemented; - return autoPtr(nullptr); + return autoPtr(); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C index 9352b72397..139826e885 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C @@ -227,14 +227,14 @@ Foam::tmp Foam::phaseModel::d() const Foam::PhaseCompressibleTurbulenceModel& Foam::phaseModel::turbulence() { - return turbulence_(); + return *turbulence_; } const Foam::PhaseCompressibleTurbulenceModel& Foam::phaseModel::turbulence() const { - return turbulence_(); + return *turbulence_; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H index 894907fe7c..f0c88afa1e 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H @@ -162,14 +162,14 @@ public: //- Return the thermophysical model const rhoThermo& thermo() const { - return thermo_(); + return *thermo_; } //- Return non-const access to the thermophysical model // for correction rhoThermo& thermo() { - return thermo_(); + return *thermo_; } //- Return the laminar viscosity @@ -286,13 +286,13 @@ public: //- Return the volumetric flux const surfaceScalarField& phi() const { - return phiPtr_(); + return *phiPtr_; } //- Return non-const access to the volumetric flux surfaceScalarField& phi() { - return phiPtr_(); + return *phiPtr_; } //- Return the volumetric flux of the phase diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C index 5a99c32ae2..4750293fe8 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C @@ -177,12 +177,12 @@ Foam::twoPhaseSystem::twoPhaseSystem lookup("drag"), ( blendingMethods_.found("drag") - ? blendingMethods_["drag"] - : blendingMethods_["default"] + ? *(blendingMethods_["drag"]) + : *(blendingMethods_["default"]) ), - pair_, - pair1In2_, - pair2In1_, + *pair_, + *pair1In2_, + *pair2In1_, false // Do not zero drag coefficent at fixed-flux BCs ) ); @@ -194,12 +194,12 @@ Foam::twoPhaseSystem::twoPhaseSystem lookup("virtualMass"), ( blendingMethods_.found("virtualMass") - ? blendingMethods_["virtualMass"] - : blendingMethods_["default"] + ? *(blendingMethods_["virtualMass"]) + : *(blendingMethods_["default"]) ), - pair_, - pair1In2_, - pair2In1_ + *pair_, + *pair1In2_, + *pair2In1_ ) ); @@ -210,12 +210,12 @@ Foam::twoPhaseSystem::twoPhaseSystem lookup("heatTransfer"), ( blendingMethods_.found("heatTransfer") - ? blendingMethods_["heatTransfer"] - : blendingMethods_["default"] + ? *(blendingMethods_["heatTransfer"]) + : *(blendingMethods_["default"]) ), - pair_, - pair1In2_, - pair2In1_ + *pair_, + *pair1In2_, + *pair2In1_ ) ); @@ -226,12 +226,12 @@ Foam::twoPhaseSystem::twoPhaseSystem lookup("lift"), ( blendingMethods_.found("lift") - ? blendingMethods_["lift"] - : blendingMethods_["default"] + ? *(blendingMethods_["lift"]) + : *(blendingMethods_["default"]) ), - pair_, - pair1In2_, - pair2In1_ + *pair_, + *pair1In2_, + *pair2In1_ ) ); @@ -242,12 +242,12 @@ Foam::twoPhaseSystem::twoPhaseSystem lookup("wallLubrication"), ( blendingMethods_.found("wallLubrication") - ? blendingMethods_["wallLubrication"] - : blendingMethods_["default"] + ? *(blendingMethods_["wallLubrication"]) + : *(blendingMethods_["default"]) ), - pair_, - pair1In2_, - pair2In1_ + *pair_, + *pair1In2_, + *pair2In1_ ) ); @@ -258,12 +258,12 @@ Foam::twoPhaseSystem::twoPhaseSystem lookup("turbulentDispersion"), ( blendingMethods_.found("turbulentDispersion") - ? blendingMethods_["turbulentDispersion"] - : blendingMethods_["default"] + ? *(blendingMethods_["turbulentDispersion"]) + : *(blendingMethods_["default"]) ), - pair_, - pair1In2_, - pair2In1_ + *pair_, + *pair1In2_, + *pair2In1_ ) ); } @@ -272,7 +272,7 @@ Foam::twoPhaseSystem::twoPhaseSystem // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::twoPhaseSystem::~twoPhaseSystem() -{} +{} // Define here (incomplete type in header) // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/createFields.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/createFields.H index fd97d416f9..8d9ef025c8 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/createFields.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/createFields.H @@ -16,7 +16,7 @@ volVectorField D ); -autoPtr Tptr(nullptr); +autoPtr Tptr; if (thermalStress) { diff --git a/applications/test/autoPtr/Make/files b/applications/test/autoPtr/Make/files new file mode 100644 index 0000000000..a89ae35418 --- /dev/null +++ b/applications/test/autoPtr/Make/files @@ -0,0 +1,3 @@ +Test-autoPtr.C + +EXE = $(FOAM_USER_APPBIN)/Test-autoPtr diff --git a/applications/test/autoPtr/Make/options b/applications/test/autoPtr/Make/options new file mode 100644 index 0000000000..3ed9829402 --- /dev/null +++ b/applications/test/autoPtr/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude + +EXE_LIBS = \ + -lthermophysicalProperties diff --git a/applications/test/autoPtr/Test-autoPtr.C b/applications/test/autoPtr/Test-autoPtr.C new file mode 100644 index 0000000000..edd7f222e8 --- /dev/null +++ b/applications/test/autoPtr/Test-autoPtr.C @@ -0,0 +1,219 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "autoPtr.H" +#include "labelList.H" +#include "ListOps.H" +#include "IOstreams.H" +#include "Switch.H" + +#include "C7H16.H" + +using namespace Foam; + + +// An example of bad use, since our autoPtr is too generous when being passed +// around +void testTransfer1(autoPtr ap) +{ + // Passed in copy, so automatically removes content + // Transfer would be nice, but not actually needed + + Info<< "recv " << Switch(ap.valid()).c_str() << nl; +} + + +// An example of good use. We are allowed to manage the memory (or not) +// and not automatically start losing things. +void testTransfer2(autoPtr&& ap) +{ + // As rvalue, so this time we actually get to manage content + Info<< "recv " << Switch(ap.valid()).c_str() << nl; +} + + +// Constructor from literal nullptr is implicit +template +autoPtr testNullReturn1() +{ + return nullptr; +} + + +// Constructor from raw pointer is explicit +template +autoPtr testNullReturn2() +{ + T* p = new T; + + return p; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + { + auto list = autoPtr::New(10, label(-1)); + + Info<<"create: " << list() << nl; + + Info<<"create: " << autoPtr::New(10, label(-1))() + << nl << nl; + } + + // Confirm that forwarding with move construct actually works as expected + { + auto source = identity(8); + Info<<"move construct from " + << flatOutput(source) << " @ " << long(source.cdata()) + << nl << nl; + + auto list = autoPtr::New(std::move(source)); + + Info<<"created: " << flatOutput(*list) << " @ " << long(list->cdata()) + << nl << nl; + + Info<<"orig: " + << flatOutput(source) << " @ " << long(source.cdata()) + << nl << nl; + } + + // Explicit construct Base from Derived + { + autoPtr liqProp + ( + autoPtr::New() + ); + + Info<<"liq 1: " << liqProp() << nl << nl; + } + + // Construct Base from Derived + { + autoPtr liqProp = + autoPtr::NewFrom(); + + Info<<"liq 2: " << liqProp() << nl << nl; + } + + // Construct Base from Derived + { + const autoPtr liqProp(autoPtr::New()); + + Info<<"liq: " << liqProp() << nl << nl; + Info<<"liq-type: " << liqProp->type() << nl << nl; + Info<<"type: " << typeid(liqProp.get()).name() << nl; + } + + // Memory transfer + { + Info<< nl << nl; + + auto list = autoPtr::New(identity(8)); + Info<<"forward to function from " + << flatOutput(*list) << " @ " << long(list->cdata()) + << nl << nl; + + testTransfer2(std::move(list)); + + Info<<"now have valid=" << Switch(list.valid()).c_str(); + + if (list.valid()) + { + Info<< nl + << flatOutput(*list) << " @ " << long(list->cdata()) + << nl; + } + else + { + Info<< nl; + } + } + + // Memory transfer + { + Info<< nl << nl; + + testTransfer2(autoPtr::New(identity(8))); + } + + // Memory transfer + { + Info<< nl << nl; + + auto list = autoPtr::New(identity(8)); + Info<<"forward to function from " + << flatOutput(*list) << " @ " << long(list->cdata()) + << nl << nl; + + testTransfer2(std::move(list)); + + Info<<"now have valid=" << Switch(list.valid()).c_str(); + + if (list.valid()) + { + Info<< nl + << flatOutput(*list) << " @ " << long(list->cdata()) + << nl; + } + else + { + Info<< nl; + } + } + + + // Memory transfer + { + auto ptr1 = autoPtr::New(); + auto ptr2 = autoPtr::New(); + + Info<<"ptr valid: " << ptr1.valid() << nl; + + // Refuses to compile (good!): ptr1 = new labelList(10); + + // Does compile (good!): ptr1 = nullptr; + + ptr1.reset(std::move(ptr2)); + } + + + { + // Good this work: + autoPtr ptr1 = testNullReturn1(); + + // Good this does not compile: + // autoPtr ptr2 = testNullReturn2(); + } + + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/fieldMapping/Test-fieldMapping.C b/applications/test/fieldMapping/Test-fieldMapping.C index a641819d7e..0ca3052e4c 100644 --- a/applications/test/fieldMapping/Test-fieldMapping.C +++ b/applications/test/fieldMapping/Test-fieldMapping.C @@ -202,7 +202,7 @@ int main(int argc, char *argv[]) autoPtr morphMap = meshMod.changeMesh(mesh, inflate); Info<< "Mapping fields" << nl << endl; - mesh.updateMesh(morphMap); + mesh.updateMesh(morphMap()); // Move mesh (since morphing does not do this) if (morphMap().hasMotionPoints()) @@ -212,7 +212,7 @@ int main(int argc, char *argv[]) } // Update numbering of cells/vertices. - faceRemover.updateMesh(morphMap); + faceRemover.updateMesh(morphMap()); Info<< "Writing fields" << nl << endl; diff --git a/applications/test/hexRef8/Test-hexRef8.C b/applications/test/hexRef8/Test-hexRef8.C index 66a55fbafc..d34ff23c42 100644 --- a/applications/test/hexRef8/Test-hexRef8.C +++ b/applications/test/hexRef8/Test-hexRef8.C @@ -276,7 +276,7 @@ int main(int argc, char *argv[]) // Update fields Info<< nl << "-- mapping mesh data" << endl; - mesh.updateMesh(map); + mesh.updateMesh(map()); // Inflate mesh if (map().hasMotionPoints()) @@ -287,7 +287,7 @@ int main(int argc, char *argv[]) // Update numbering of cells/vertices. Info<< nl << "-- mapping hexRef8 data" << endl; - meshCutter.updateMesh(map); + meshCutter.updateMesh(map()); } diff --git a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C index f6bac7844a..6bd47c6bf7 100644 --- a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C +++ b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C @@ -1155,7 +1155,9 @@ int main(int argc, char *argv[]) } // Change the mesh. Change points directly (no inflation). - autoPtr map = meshMod.changeMesh(subsetter.subMesh(), false); + autoPtr mapPtr = + meshMod.changeMesh(subsetter.subMesh(), false); + mapPolyMesh& map = *mapPtr; // Update fields subsetter.subMesh().updateMesh(map); @@ -1231,9 +1233,9 @@ int main(int argc, char *argv[]) // Move mesh (since morphing might not do this) - if (map().hasMotionPoints()) + if (map.hasMotionPoints()) { - subsetter.subMesh().movePoints(map().preMotionPoints()); + subsetter.subMesh().movePoints(map.preMotionPoints()); } Info<< "Writing mesh with split blockedFaces to time " << runTime.value() diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C index fa307d05e6..f4d889d28a 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C @@ -186,7 +186,7 @@ int main(int argc, char *argv[]) polyMeshFilter::copySets(newMesh(), mesh); } - pointPriority = meshFilter.pointPriority(); + pointPriority = *(meshFilter.pointPriority()); } if (collapseFaceSet) @@ -203,14 +203,14 @@ int main(int argc, char *argv[]) // from the previous edge filtering to use as a stopping criterion. meshFilter.filter(indirectPatchFaces); { - polyTopoChange meshMod(newMesh); + polyTopoChange meshMod(newMesh()); meshMod.changeMesh(mesh, false); polyMeshFilter::copySets(newMesh(), mesh); } - pointPriority = meshFilter.pointPriority(); + pointPriority = *(meshFilter.pointPriority()); } if (collapseFaces) @@ -227,14 +227,14 @@ int main(int argc, char *argv[]) // from the previous edge filtering to use as a stopping criterion. meshFilter.filter(nBadFaces); { - polyTopoChange meshMod(newMesh); + polyTopoChange meshMod(newMesh()); meshMod.changeMesh(mesh, false); polyMeshFilter::copySets(newMesh(), mesh); } - pointPriority = meshFilter.pointPriority(); + pointPriority = *(meshFilter.pointPriority()); } // Write resulting mesh diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C index f1e3218540..3423d69865 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C +++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C @@ -113,7 +113,7 @@ label mergePatchFaces map = meshMod.changeMesh(mesh, false, true); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Move mesh (since morphing does not do this) if (map().hasMotionPoints()) @@ -269,7 +269,7 @@ label mergePatchFaces map = meshMod.changeMesh(mesh, false, true); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Move mesh (since morphing does not do this) if (map().hasMotionPoints()) @@ -322,7 +322,7 @@ label mergeEdges(const scalar minCos, polyMesh& mesh) autoPtr map = meshMod.changeMesh(mesh, false, true); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Move mesh (since morphing does not do this) if (map().hasMotionPoints()) diff --git a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C index 5b123d64e2..6901fcd8da 100644 --- a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C +++ b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C @@ -174,10 +174,10 @@ int main(int argc, char *argv[]) autoPtr map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Update numbering of cells/vertices. - meshCutter.updateMesh(map); + meshCutter.updateMesh(map()); // Optionally inflate mesh if (map().hasMotionPoints()) diff --git a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C index 2578a37e9b..bb78ffc827 100644 --- a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C +++ b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C @@ -155,18 +155,18 @@ int main(int argc, char *argv[]) meshMod ); - autoPtr morphMap = meshMod.changeMesh(mesh, false); + autoPtr map = meshMod.changeMesh(mesh, false); - mesh.updateMesh(morphMap); + mesh.updateMesh(map()); // Move mesh (since morphing does not do this) - if (morphMap().hasMotionPoints()) + if (map().hasMotionPoints()) { - mesh.movePoints(morphMap().preMotionPoints()); + mesh.movePoints(map().preMotionPoints()); } // Update numbering of cells/vertices. - faceRemover.updateMesh(morphMap); + faceRemover.updateMesh(map()); if (!overwrite) { diff --git a/applications/utilities/mesh/advanced/selectCells/selectCells.C b/applications/utilities/mesh/advanced/selectCells/selectCells.C index 8b4b2dcaf2..fef71bbd87 100644 --- a/applications/utilities/mesh/advanced/selectCells/selectCells.C +++ b/applications/utilities/mesh/advanced/selectCells/selectCells.C @@ -416,20 +416,14 @@ int main(int argc, char *argv[]) ); - // Surface - autoPtr surf(nullptr); - // Search engine on surface. - autoPtr querySurf(nullptr); - if (useSurface) { - surf.reset(new triSurface(surfName)); + triSurface surf(surfName); // Dump some stats - surf().writeStats(Info); + surf.writeStats(Info); - // Search engine on surface. - querySurf.reset(new triSurfaceSearch(surf)); + triSurfaceSearch querySurf(surf); // Set cellType[celli] according to relation to surface cutBySurface diff --git a/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C b/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C index 8596ca8f9c..98fa7d42a9 100644 --- a/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C +++ b/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C @@ -266,7 +266,7 @@ int main(int argc, char *argv[]) Info<< nl << "Bounding box size: " << mesh().bounds().span() << nl; // check number of regions - regionSplit rs(mesh); + regionSplit rs(mesh()); Info<< "Number of regions: " << rs.nRegions(); if (rs.nRegions() == 1) @@ -281,7 +281,7 @@ int main(int argc, char *argv[]) << "**************************************************" << nl; } Info<< endl; - reader.writeMesh(mesh, format); + reader.writeMesh(mesh(), format); // exportName only has a size when export is in effect if (exportName.size()) diff --git a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C index c3ffaf04f0..806ded99fb 100644 --- a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C +++ b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C @@ -119,7 +119,7 @@ int main(int argc, char *argv[]) autoPtr mesh = reader.mesh(runTime); - reader.writeMesh(mesh, format); + reader.writeMesh(mesh(), format); Info<< "\nEnd\n" << endl; diff --git a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C index 6d9295dd93..7d459ec82d 100644 --- a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C +++ b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C @@ -338,7 +338,7 @@ int main(int argc, char *argv[]) wordList(0) ) ); - const polyMesh& mesh = meshPtr; + const polyMesh& mesh = *meshPtr; if (readFaceFile) diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index 9051a84db5..f4bc4c55e8 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -433,7 +433,7 @@ int main(int argc, char *argv[]) autoPtr map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Move mesh (since morphing does not do this) if (map().hasMotionPoints()) @@ -788,7 +788,7 @@ int main(int argc, char *argv[]) ( layerExtrude.addedCells ( - meshFromMesh, + *meshFromMesh, layerExtrude.layerFaces() ) ); @@ -937,7 +937,7 @@ int main(int argc, char *argv[]) autoPtr map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Update stored data updateFaceLabels(map(), frontPatchFaces); @@ -1074,7 +1074,7 @@ int main(int argc, char *argv[]) autoPtr map = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(map); + mesh.updateMesh(map()); // Update local data updateCellSet(map(), addedCellsSet); diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index db1b8c2480..869d54d80a 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -2470,7 +2470,7 @@ int main(int argc, char *argv[]) // Update numbering on extruder. - extruder.updateMesh(shellMap); + extruder.updateMesh(shellMap()); // Calculate offsets from shell mesh back to original mesh @@ -2818,7 +2818,7 @@ int main(int argc, char *argv[]) addBafflesMap = meshMod.changeMesh(mesh, false); // Update fields - mesh.updateMesh(addBafflesMap); + mesh.updateMesh(addBafflesMap()); //XXXXXX diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C index d6d87e4c8f..10fda1151c 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C @@ -251,7 +251,7 @@ int main(int argc, char *argv[]) // Create a mesh from topo changes. autoPtr morphMap = meshMod().changeMesh(mesh(), false); - mesh().updateMesh(morphMap); + mesh().updateMesh(morphMap()); { edgeCollapser collapser(mesh()); @@ -302,7 +302,7 @@ int main(int argc, char *argv[]) autoPtr morphMap = meshModCollapse.changeMesh(mesh(), false); - mesh().updateMesh(morphMap); + mesh().updateMesh(morphMap()); } if (!overwrite) diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C index 97311eef3c..c053ce9e7b 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C @@ -142,13 +142,6 @@ Foam::DistributedDelaunayMesh::DistributedDelaunayMesh {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::DistributedDelaunayMesh::~DistributedDelaunayMesh() -{} - - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template @@ -491,7 +484,8 @@ Foam::label Foam::DistributedDelaunayMesh::referVertices const label preDistributionSize = parallelVertices.size(); - mapDistribute pointMap = buildMap(targetProcessor); + autoPtr pointMapPtr = buildMap(targetProcessor); + mapDistribute& pointMap = *pointMapPtr; // Make a copy of the original list. DynamicList originalParallelVertices(parallelVertices); diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H index 35b0859b53..07954827b8 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H @@ -141,7 +141,7 @@ public: //- Destructor - ~DistributedDelaunayMesh(); + ~DistributedDelaunayMesh() = default; // Queries diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C index 25d9188e01..210d027fe6 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C @@ -248,10 +248,10 @@ void Foam::backgroundMeshDecomposition::initialRefinement() ); // Update fields - mesh_.updateMesh(map); + mesh_.updateMesh(map()); // Update numbering of cells/vertices. - meshCutter_.updateMesh(map); + meshCutter_.updateMesh(map()); { // Map volumeStatus @@ -357,11 +357,11 @@ void Foam::backgroundMeshDecomposition::initialRefinement() ); // Update fields - mesh_.updateMesh(map); + mesh_.updateMesh(map()); // Update numbering of cells/vertices. - meshCutter_.updateMesh(map); - cellRemover.updateMesh(map); + meshCutter_.updateMesh(map()); + cellRemover.updateMesh(map()); { // Map volumeStatus @@ -416,7 +416,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement() newDecomp ); - meshCutter_.distribute(mapDist); + meshCutter_.distribute(mapDist()); mapDist().distributeCellData(volumeStatus); @@ -840,12 +840,6 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::backgroundMeshDecomposition::~backgroundMeshDecomposition() -{} - - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::autoPtr @@ -954,10 +948,10 @@ Foam::backgroundMeshDecomposition::distribute ); // Update fields - mesh_.updateMesh(map); + mesh_.updateMesh(map()); // Update numbering of cells/vertices. - meshCutter_.updateMesh(map); + meshCutter_.updateMesh(map()); Info<< " Background mesh refined from " << returnReduce(map().nOldCells(), sumOp