diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H index 44310e4df3..253b7fb07a 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/phaseModel/phaseModel.H @@ -100,7 +100,7 @@ public: autoPtr operator()(Istream& is) const { - return autoPtr(new phaseModel(is, p_, T_)); + return autoPtr::New(is, p_, T_); } }; diff --git a/applications/test/PtrList/Test-PtrList.C b/applications/test/PtrList/Test-PtrList.C index 043cfe5c37..2c21975835 100644 --- a/applications/test/PtrList/Test-PtrList.C +++ b/applications/test/PtrList/Test-PtrList.C @@ -60,7 +60,7 @@ public: autoPtr clone() const { - return autoPtr(new Scalar(data_)); + return autoPtr::New(data_); } friend Ostream& operator<<(Ostream& os, const Scalar& val) diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.C index 33abcb622c..676ef0ab61 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.C @@ -93,14 +93,11 @@ Foam::autoPtr Foam::smoothAlignmentSolver::buildReferredMap indices.transfer(dynIndices); List> compactMap; - return autoPtr + return autoPtr::New ( - new mapDistribute - ( - globalIndexing, - indices, - compactMap - ) + globalIndexing, + indices, + compactMap ); } @@ -157,14 +154,11 @@ Foam::autoPtr Foam::smoothAlignmentSolver::buildMap } List> compactMap; - return autoPtr + return autoPtr::New ( - new mapDistribute - ( - globalIndexing, - pointPoints, - compactMap - ) + globalIndexing, + pointPoints, + compactMap ); } diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index 6ddc7cda15..5f176118c4 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -518,39 +518,36 @@ autoPtr reorderMesh } - return autoPtr + return autoPtr::New ( - new mapPolyMesh - ( - mesh, // const polyMesh& mesh, - mesh.nPoints(), // nOldPoints, - mesh.nFaces(), // nOldFaces, - mesh.nCells(), // nOldCells, - identity(mesh.nPoints()), // pointMap, - List(0), // pointsFromPoints, - faceOrder, // faceMap, - List(0), // facesFromPoints, - List(0), // facesFromEdges, - List(0), // facesFromFaces, - cellOrder, // cellMap, - List(0), // cellsFromPoints, - List(0), // cellsFromEdges, - List(0), // cellsFromFaces, - List(0), // cellsFromCells, - identity(mesh.nPoints()), // reversePointMap, - reverseFaceOrder, // reverseFaceMap, - reverseCellOrder, // reverseCellMap, - flipFaceFlux, // flipFaceFlux, - patchPointMap, // patchPointMap, - labelListList(0), // pointZoneMap, - labelListList(0), // faceZonePointMap, - labelListList(0), // faceZoneFaceMap, - labelListList(0), // cellZoneMap, - pointField(0), // preMotionPoints, - patchStarts, // oldPatchStarts, - oldPatchNMeshPoints, // oldPatchNMeshPoints - autoPtr() // oldCellVolumes - ) + mesh, // const polyMesh& mesh, + mesh.nPoints(), // nOldPoints, + mesh.nFaces(), // nOldFaces, + mesh.nCells(), // nOldCells, + identity(mesh.nPoints()), // pointMap, + List(), // pointsFromPoints, + faceOrder, // faceMap, + List(), // facesFromPoints, + List(), // facesFromEdges, + List(), // facesFromFaces, + cellOrder, // cellMap, + List(), // cellsFromPoints, + List(), // cellsFromEdges, + List(), // cellsFromFaces, + List(), // cellsFromCells, + identity(mesh.nPoints()), // reversePointMap, + reverseFaceOrder, // reverseFaceMap, + reverseCellOrder, // reverseCellMap, + flipFaceFlux, // flipFaceFlux, + patchPointMap, // patchPointMap, + labelListList(), // pointZoneMap, + labelListList(), // faceZonePointMap, + labelListList(), // faceZoneFaceMap, + labelListList(), // cellZoneMap, + pointField(), // preMotionPoints, + patchStarts, // oldPatchStarts, + oldPatchNMeshPoints, // oldPatchNMeshPoints + autoPtr() // oldCellVolumes ); } diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C index 1842fd2490..905d61f2d7 100644 --- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C +++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C @@ -98,15 +98,12 @@ autoPtr determineCoupledFaces { if (fullMatch || masterMesh.nCells() == 0) { - return autoPtr + return autoPtr::New ( - new faceCoupleInfo - ( - masterMesh, - meshToAdd, - mergeDist, // Absolute merging distance - true // Matching faces identical - ) + masterMesh, + meshToAdd, + mergeDist, // Absolute merging distance + true // Matching faces identical ); } else @@ -215,20 +212,17 @@ autoPtr determineCoupledFaces } addFaces.shrink(); - return autoPtr + return autoPtr::New ( - new faceCoupleInfo - ( - masterMesh, - masterFaces, - meshToAdd, - addFaces, - mergeDist, // Absolute merging distance - true, // Matching faces identical? - false, // If perfect match are faces already ordered - // (e.g. processor patches) - false // are faces each on separate patch? - ) + masterMesh, + masterFaces, + meshToAdd, + addFaces, + mergeDist, // Absolute merging distance + true, // Matching faces identical? + false, // If perfect match are faces already ordered + // (e.g. processor patches) + false // are faces each on separate patch? ); } } diff --git a/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracksTemplates.C b/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracksTemplates.C index f54b9b04a4..18e10d75be 100644 --- a/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracksTemplates.C +++ b/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracksTemplates.C @@ -49,7 +49,7 @@ Foam::tmp> Foam::readParticleField if (obj != nullptr) { IOField newField(*obj); - return tmp>(new Field(newField.xfer())); + return tmp>::New(newField.xfer()); } FatalErrorInFunction diff --git a/applications/utilities/postProcessing/lumped/lumpedPointForces/lumpedPointForces.C b/applications/utilities/postProcessing/lumped/lumpedPointForces/lumpedPointForces.C index 95f2e85d22..c45dce76ae 100644 --- a/applications/utilities/postProcessing/lumped/lumpedPointForces/lumpedPointForces.C +++ b/applications/utilities/postProcessing/lumped/lumpedPointForces/lumpedPointForces.C @@ -55,22 +55,19 @@ autoPtr loadField Info<< "Reading " << GeoFieldType::typeName << ' ' << io->name() << endl; - return autoPtr + return autoPtr::New ( - new GeoFieldType + IOobject ( - IOobject - ( - io->name(), - io->instance(), - io->local(), - io->db(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE, - io->registerObject() - ), - mesh - ) + io->name(), + io->instance(), + io->local(), + io->db(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE, + io->registerObject() + ), + mesh ); } diff --git a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C index 4355608576..4f63381fbe 100644 --- a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C +++ b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C @@ -244,7 +244,7 @@ tmp calcNut // Correct nut turbulence->validate(); - return tmp(new volScalarField(turbulence->nut())); + return tmp::New(turbulence->nut()); } else { @@ -264,7 +264,7 @@ tmp calcNut // Correct nut turbulence->validate(); - return tmp(new volScalarField(turbulence->nut())); + return tmp::New(turbulence->nut()); } } diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C index 0510d50bb9..f7578ee9de 100644 --- a/applications/utilities/preProcessing/setFields/setFields.C +++ b/applications/utilities/preProcessing/setFields/setFields.C @@ -141,7 +141,7 @@ public: autoPtr clone() const { - return autoPtr(new setCellField()); + return autoPtr::New(); } class iNew @@ -182,7 +182,7 @@ public: << endl; } - return autoPtr(new setCellField()); + return autoPtr::New(); } }; }; @@ -332,7 +332,7 @@ public: autoPtr clone() const { - return autoPtr(new setFaceField()); + return autoPtr::New(); } class iNew @@ -373,7 +373,7 @@ public: << endl; } - return autoPtr(new setFaceField()); + return autoPtr::New(); } }; }; diff --git a/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C b/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C index 939895cb0f..4449929a20 100644 --- a/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C +++ b/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C @@ -1480,33 +1480,30 @@ autoPtr createEdgeMesh //calcFeaturePoints(inter.cutPoints(), inter.cutEdges()); - return autoPtr + return autoPtr::New ( - new extendedFeatureEdgeMesh - ( - io, - inter.cutPoints(), - inter.cutEdges(), + io, + inter.cutPoints(), + inter.cutEdges(), - 0, // concaveStart, - 0, // mixedStart, - 0, // nonFeatureStart, + 0, // concaveStart, + 0, // mixedStart, + 0, // nonFeatureStart, - internalStart, // internalStart, - nIntOrExt, // flatStart, - nIntOrExt + nFlat, // openStart, - nIntOrExt + nFlat + nOpen, // multipleStart, + internalStart, // internalStart, + nIntOrExt, // flatStart, + nIntOrExt + nFlat, // openStart, + nIntOrExt + nFlat + nOpen, // multipleStart, - normalsTmp, - normalVolumeTypesTmp, - edgeDirections, - normalDirectionsTmp, - edgeNormalsTmp, + normalsTmp, + normalVolumeTypesTmp, + edgeDirections, + normalDirectionsTmp, + edgeNormalsTmp, - labelListList(0), // featurePointNormals, - labelListList(0), // featurePointEdges, - labelList(0) // regionEdges - ) + labelListList(), // featurePointNormals, + labelListList(), // featurePointEdges, + labelList() // regionEdges ); } diff --git a/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromFile.C b/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromFile.C index 5dd577420f..7cb51d0ccf 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromFile.C +++ b/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromFile.C @@ -86,16 +86,13 @@ Foam::surfaceFeaturesExtraction::extractFromFile::features << "Selecting edges based purely on geometric tests: " << geometricTestOnly().c_str() << endl; - return autoPtr + return autoPtr::New ( - new surfaceFeatures - ( - surf, - eMesh.points(), - eMesh.edges(), - 1e-6, // mergeTol - geometricTestOnly() - ) + surf, + eMesh.points(), + eMesh.edges(), + 1e-6, // mergeTol + geometricTestOnly() ); } diff --git a/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromNone.C b/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromNone.C index 45061472c4..032f676306 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromNone.C +++ b/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromNone.C @@ -73,7 +73,7 @@ Foam::surfaceFeaturesExtraction::extractFromNone::features const triSurface& surf ) const { - return autoPtr(new surfaceFeatures(surf)); + return autoPtr::New(surf); } diff --git a/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromSurface.C b/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromSurface.C index f5a0354b62..6635a95a3e 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromSurface.C +++ b/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromSurface.C @@ -80,16 +80,13 @@ Foam::surfaceFeaturesExtraction::extractFromSurface::features << "Selecting edges based purely on geometric tests: " << geometricTestOnly().c_str() << endl; - return autoPtr + return autoPtr::New ( - new surfaceFeatures - ( - surf, - includedAngle(), - 0, // minLen - 0, // minElems - geometricTestOnly() - ) + surf, + includedAngle(), + 0, // minLen + 0, // minElems + geometricTestOnly() ); } diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H index c76391fe06..3b4705320e 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H @@ -418,10 +418,7 @@ public: //- Clone autoPtr> clone() const { - return autoPtr> - ( - new dynamicIndexedOctree(*this) - ); + return autoPtr>::New(*this); } diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H index 1d4c7d844f..762c0a4548 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H +++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H @@ -432,10 +432,7 @@ public: //- Clone autoPtr> clone() const { - return autoPtr> - ( - new indexedOctree(*this) - ); + return autoPtr>::New(*this); } // Member Functions diff --git a/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H b/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H index 65ae222f6e..3f3cc4b622 100644 --- a/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H +++ b/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H @@ -101,10 +101,7 @@ template inline Foam::autoPtr> Foam::CompactListList::clone() const { - return autoPtr> - ( - new CompactListList(*this) - ); + return autoPtr>::New(*this); } diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H index 385765aade..db4d46fffc 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H @@ -135,7 +135,7 @@ template inline Foam::autoPtr> Foam::FixedList::clone() const { - return autoPtr>(new FixedList(*this)); + return autoPtr>::New(*this); } diff --git a/src/OpenFOAM/containers/Lists/List/ListI.H b/src/OpenFOAM/containers/Lists/List/ListI.H index 742500554d..46e24e1d73 100644 --- a/src/OpenFOAM/containers/Lists/List/ListI.H +++ b/src/OpenFOAM/containers/Lists/List/ListI.H @@ -95,7 +95,7 @@ inline constexpr Foam::List::List() noexcept template inline Foam::autoPtr> Foam::List::clone() const { - return autoPtr>(new List(*this)); + return autoPtr>::New(*this); } diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedBoolListI.H b/src/OpenFOAM/containers/Lists/PackedList/PackedBoolListI.H index bd596dbf2b..c1d4e7156f 100644 --- a/src/OpenFOAM/containers/Lists/PackedList/PackedBoolListI.H +++ b/src/OpenFOAM/containers/Lists/PackedList/PackedBoolListI.H @@ -125,7 +125,7 @@ inline Foam::PackedBoolList::PackedBoolList inline Foam::autoPtr Foam::PackedBoolList::clone() const { - return autoPtr(new PackedBoolList(*this)); + return autoPtr::New(*this); } diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H b/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H index 9696290f92..9a3e0a8a41 100644 --- a/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H +++ b/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H @@ -267,7 +267,7 @@ template inline Foam::autoPtr> Foam::PackedList::clone() const { - return autoPtr>(new PackedList(*this)); + return autoPtr>::New(*this); } diff --git a/src/OpenFOAM/db/IOobject/IOobject.H b/src/OpenFOAM/db/IOobject/IOobject.H index c520fbd890..e25d715b9b 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.H +++ b/src/OpenFOAM/db/IOobject/IOobject.H @@ -279,13 +279,13 @@ public: //- Clone autoPtr clone() const { - return autoPtr(new IOobject(*this)); + return autoPtr::New(*this); } //- Clone resetting registry autoPtr clone(const objectRegistry& registry) const { - return autoPtr(new IOobject(*this, registry)); + return autoPtr::New(*this, registry); } diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index d015a46467..a5a926df25 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.C +++ b/src/OpenFOAM/db/dictionary/dictionary.C @@ -150,7 +150,7 @@ Foam::dictionary::dictionary Foam::autoPtr Foam::dictionary::clone() const { - return autoPtr(new dictionary(*this)); + return autoPtr::New(*this); } diff --git a/src/OpenFOAM/db/dictionary/dictionaryIO.C b/src/OpenFOAM/db/dictionary/dictionaryIO.C index d608b74e68..2453f3760b 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryIO.C +++ b/src/OpenFOAM/db/dictionary/dictionaryIO.C @@ -71,7 +71,7 @@ Foam::dictionary::dictionary(Istream& is, bool keepHeader) Foam::autoPtr Foam::dictionary::New(Istream& is) { - return autoPtr(new dictionary(is)); + return autoPtr::New(is); } diff --git a/src/OpenFOAM/dimensionSet/dimensionSet.H b/src/OpenFOAM/dimensionSet/dimensionSet.H index ca18178fee..fa07827382 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSet.H +++ b/src/OpenFOAM/dimensionSet/dimensionSet.H @@ -250,7 +250,7 @@ public: //- Construct and return a clone autoPtr clone() const { - return autoPtr(new dimensionSet(*this)); + return autoPtr::New(*this); } //- Construct from Istream diff --git a/src/OpenFOAM/fields/FieldFields/FieldField/FieldField.C b/src/OpenFOAM/fields/FieldFields/FieldField/FieldField.C index 48610c8f97..17a9ce9170 100644 --- a/src/OpenFOAM/fields/FieldFields/FieldField/FieldField.C +++ b/src/OpenFOAM/fields/FieldFields/FieldField/FieldField.C @@ -177,7 +177,7 @@ FieldField::FieldField(Istream& is) template class Field, class Type> tmp> FieldField::clone() const { - return tmp>(new FieldField(*this)); + return tmp>::New(*this); } diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C index 321fdb1029..1cb7cacf83 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.C +++ b/src/OpenFOAM/fields/Fields/Field/Field.C @@ -348,7 +348,7 @@ Foam::Field::Field template Foam::tmp> Foam::Field::clone() const { - return tmp>(new Field(*this)); + return tmp>::New(*this); } diff --git a/src/OpenFOAM/fields/Fields/Field/Field.H b/src/OpenFOAM/fields/Fields/Field/Field.H index 6fcab57ea0..1af0dbdc59 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.H +++ b/src/OpenFOAM/fields/Fields/Field/Field.H @@ -241,7 +241,7 @@ public: template static tmp> NewCalculatedType(const Field& f) { - return tmp>(new Field(f.size())); + return tmp>::New(f.size()); } diff --git a/src/OpenFOAM/fields/Fields/Field/FieldMapper.H b/src/OpenFOAM/fields/Fields/Field/FieldMapper.H index c09b3ad563..de5dd948bf 100644 --- a/src/OpenFOAM/fields/Fields/Field/FieldMapper.H +++ b/src/OpenFOAM/fields/Fields/Field/FieldMapper.H @@ -118,7 +118,7 @@ public: template tmp> operator()(const Field& f) const { - return tmp>(new Field(f, *this)); + return tmp>::New(f, *this); } }; diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C index b2016d79a3..19dcfab134 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C @@ -149,7 +149,7 @@ Foam::pointPatchField::patchInternalField << abort(FatalError); } - return tmp>(new Field(iF, meshPoints)); + return tmp>::New(iF, meshPoints); } diff --git a/src/OpenFOAM/graph/curve/curve.H b/src/OpenFOAM/graph/curve/curve.H index 2d8a8c9941..c9a34374c8 100644 --- a/src/OpenFOAM/graph/curve/curve.H +++ b/src/OpenFOAM/graph/curve/curve.H @@ -145,7 +145,7 @@ public: autoPtr clone() const { - return autoPtr(new curve(*this)); + return autoPtr::New(*this); } diff --git a/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H b/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H index 4026e203bd..56de4eb76a 100644 --- a/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H +++ b/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H @@ -98,7 +98,7 @@ public: static autoPtr New(Istream& is) { - return autoPtr(new procLduInterface(is)); + return autoPtr::New(is); } diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixPreconditioner.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixPreconditioner.C index ad3de4764c..468297c2a5 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixPreconditioner.C +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixPreconditioner.C @@ -89,20 +89,15 @@ Foam::LduMatrix::preconditioner::New ) ); } - else - { - FatalIOErrorInFunction - ( - preconditionerDict - ) << "cannot preconditione incomplete matrix, " - "no diagonal or off-diagonal coefficient" - << exit(FatalIOError); - return autoPtr::preconditioner> - ( - nullptr - ); - } + FatalIOErrorInFunction + ( + preconditionerDict + ) << "cannot preconditione incomplete matrix, " + "no diagonal or off-diagonal coefficient" + << exit(FatalIOError); + + return autoPtr::preconditioner>(); } diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSmoother.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSmoother.C index 758dafff9a..dd27fc51c2 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSmoother.C +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSmoother.C @@ -84,17 +84,12 @@ Foam::LduMatrix::smoother::New ) ); } - else - { - FatalIOErrorInFunction(smootherDict) - << "cannot solve incomplete matrix, no off-diagonal coefficients" - << exit(FatalIOError); - return autoPtr::smoother> - ( - nullptr - ); - } + FatalIOErrorInFunction(smootherDict) + << "cannot solve incomplete matrix, no off-diagonal coefficients" + << exit(FatalIOError); + + return autoPtr::smoother>(); } diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C index 6ca7b2a64c..626301066e 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C @@ -99,18 +99,13 @@ Foam::LduMatrix::solver::New ) ); } - else - { - FatalIOErrorInFunction(solverDict) - << "cannot solve incomplete matrix, " - "no diagonal or off-diagonal coefficient" - << exit(FatalIOError); - return autoPtr::solver> - ( - nullptr - ); - } + FatalIOErrorInFunction(solverDict) + << "cannot solve incomplete matrix, " + "no diagonal or off-diagonal coefficient" + << exit(FatalIOError); + + return autoPtr::solver>(); } diff --git a/src/OpenFOAM/matrices/Matrix/MatrixI.H b/src/OpenFOAM/matrices/Matrix/MatrixI.H index deed75bd45..d8503b5ce1 100644 --- a/src/OpenFOAM/matrices/Matrix/MatrixI.H +++ b/src/OpenFOAM/matrices/Matrix/MatrixI.H @@ -40,7 +40,7 @@ template inline Foam::autoPtr> Foam::Matrix:: clone() const { - return autoPtr>(new Matrix(*this)); + return autoPtr>::New(*this); } diff --git a/src/OpenFOAM/matrices/RectangularMatrix/RectangularMatrixI.H b/src/OpenFOAM/matrices/RectangularMatrix/RectangularMatrixI.H index e07888e25b..47843ac299 100644 --- a/src/OpenFOAM/matrices/RectangularMatrix/RectangularMatrixI.H +++ b/src/OpenFOAM/matrices/RectangularMatrix/RectangularMatrixI.H @@ -110,10 +110,7 @@ template inline Foam::autoPtr> Foam::RectangularMatrix::clone() const { - return autoPtr> - ( - new RectangularMatrix(*this) - ); + return autoPtr>::New(*this); } diff --git a/src/OpenFOAM/matrices/SquareMatrix/SquareMatrixI.H b/src/OpenFOAM/matrices/SquareMatrix/SquareMatrixI.H index b85715ff07..375492b250 100644 --- a/src/OpenFOAM/matrices/SquareMatrix/SquareMatrixI.H +++ b/src/OpenFOAM/matrices/SquareMatrix/SquareMatrixI.H @@ -148,7 +148,7 @@ template inline Foam::autoPtr> Foam::SquareMatrix::clone() const { - return autoPtr>(new SquareMatrix(*this)); + return autoPtr>::New(*this); } diff --git a/src/OpenFOAM/matrices/SymmetricSquareMatrix/SymmetricSquareMatrixI.H b/src/OpenFOAM/matrices/SymmetricSquareMatrix/SymmetricSquareMatrixI.H index 333da73f5d..4fd590411d 100644 --- a/src/OpenFOAM/matrices/SymmetricSquareMatrix/SymmetricSquareMatrixI.H +++ b/src/OpenFOAM/matrices/SymmetricSquareMatrix/SymmetricSquareMatrixI.H @@ -88,10 +88,7 @@ template inline Foam::autoPtr> Foam::SymmetricSquareMatrix::clone() const { - return autoPtr> - ( - new SymmetricSquareMatrix(*this) - ); + return autoPtr>::New(*this); } diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C index 4fd508c6bf..27f8c3687d 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C @@ -130,17 +130,15 @@ Foam::lduMatrix::preconditioner::New ) ); } - else - { - FatalIOErrorInFunction - ( - controls - ) << "cannot solve incomplete matrix, " - "no diagonal or off-diagonal coefficient" - << exit(FatalIOError); - return autoPtr(); - } + FatalIOErrorInFunction + ( + controls + ) << "cannot solve incomplete matrix, " + "no diagonal or off-diagonal coefficient" + << exit(FatalIOError); + + return autoPtr(); } diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C index 71c9475d39..731d4c89b3 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C @@ -136,15 +136,13 @@ Foam::autoPtr Foam::lduMatrix::smoother::New ) ); } - else - { - FatalIOErrorInFunction(solverControls) - << "cannot solve incomplete matrix, " - "no diagonal or off-diagonal coefficient" - << exit(FatalIOError); - return autoPtr(); - } + FatalIOErrorInFunction(solverControls) + << "cannot solve incomplete matrix, " + "no diagonal or off-diagonal coefficient" + << exit(FatalIOError); + + return autoPtr(); } diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C index 38e10b12e5..4b0a2092ec 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C @@ -116,15 +116,13 @@ Foam::autoPtr Foam::lduMatrix::solver::New ) ); } - else - { - FatalIOErrorInFunction(solverControls) - << "cannot solve incomplete matrix, " - "no diagonal or off-diagonal coefficient" - << exit(FatalIOError); - return autoPtr(); - } + FatalIOErrorInFunction(solverControls) + << "cannot solve incomplete matrix, " + "no diagonal or off-diagonal coefficient" + << exit(FatalIOError); + + return autoPtr(); } diff --git a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.H b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.H index d1f08405fc..9c8998ac1c 100644 --- a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.H +++ b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.H @@ -157,13 +157,13 @@ public: //- Return a new cellModel on free-store created from Istream static autoPtr New(Istream& is) { - return autoPtr(new cellModel(is)); + return autoPtr::New(is); } //- Return clone autoPtr clone() const { - return autoPtr(new cellModel(*this)); + return autoPtr::New(*this); } diff --git a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeI.H b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeI.H index ad1443b679..42dfd3f4e8 100644 --- a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeI.H +++ b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeI.H @@ -77,7 +77,7 @@ inline Foam::cellShape::cellShape(Istream& is) inline Foam::autoPtr Foam::cellShape::clone() const { - return autoPtr(new cellShape(*this)); + return autoPtr::New(*this); } diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C index d1fc64caea..b97a0c81e1 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C @@ -498,7 +498,7 @@ Foam::mapDistribute::mapDistribute(Istream& is) Foam::autoPtr Foam::mapDistribute::clone() const { - return autoPtr(new mapDistribute(*this)); + return autoPtr::New(*this); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index b840b7d8d8..5010532693 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -149,7 +149,7 @@ Foam::autoPtr Foam::polyMesh::readTetBasePtIs() const if (io.typeHeaderOk(true)) { - return autoPtr(new labelIOList(io)); + return autoPtr::New(io); } return autoPtr(); diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H index 7759f9c546..ef2ec98080 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H @@ -231,7 +231,7 @@ public: //- Construct and return a clone, resetting the boundary mesh virtual autoPtr clone(const polyBoundaryMesh& bm) const { - return autoPtr(new polyPatch(*this, bm)); + return autoPtr::New(*this, bm); } //- Construct and return a clone, resetting the face list @@ -244,10 +244,7 @@ public: const label newStart ) const { - return autoPtr - ( - new polyPatch(*this, bm, index, newSize, newStart) - ); + return autoPtr::New(*this, bm, index, newSize, newStart); } //- Construct and return a clone, resetting the face list @@ -260,10 +257,8 @@ public: const label newStart ) const { - return autoPtr - ( - new polyPatch(*this, bm, index, mapAddressing, newStart) - ); + return autoPtr::New + (*this, bm, index, mapAddressing, newStart); } diff --git a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H index fe39d79d24..7f6f4e9785 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H +++ b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H @@ -182,10 +182,7 @@ public: //- Construct and return a clone, resetting the zone mesh virtual autoPtr clone(const cellZoneMesh& zm) const { - return autoPtr - ( - new cellZone(*this, *this, index(), zm) - ); + return autoPtr::New(*this, *this, index(), zm); } //- Construct and return a clone, @@ -197,10 +194,7 @@ public: const cellZoneMesh& zm ) const { - return autoPtr - ( - new cellZone(*this, addr, index, zm) - ); + return autoPtr::New(*this, addr, index, zm); } diff --git a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H index 0d1d6607eb..25688b3a99 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H +++ b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H @@ -228,10 +228,7 @@ public: //- Construct and return a clone, resetting the zone mesh virtual autoPtr clone(const faceZoneMesh& zm) const { - return autoPtr - ( - new faceZone(*this, *this, flipMap(), index(), zm) - ); + return autoPtr::New(*this, *this, flipMap(), index(), zm); } //- Construct and return a clone, @@ -244,10 +241,7 @@ public: const faceZoneMesh& zm ) const { - return autoPtr - ( - new faceZone(*this, addr, fm, index, zm) - ); + return autoPtr::New(*this, addr, fm, index, zm); } diff --git a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H index a42d49e1c9..4979d83d38 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H +++ b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H @@ -183,10 +183,7 @@ public: //- Construct and return a clone, resetting the zone mesh virtual autoPtr clone(const pointZoneMesh& zm) const { - return autoPtr - ( - new pointZone(*this, *this, index(), zm) - ); + return autoPtr::New(*this, *this, index(), zm); } //- Construct and return a clone, resetting the point list @@ -198,10 +195,7 @@ public: const labelUList& addr ) const { - return autoPtr - ( - new pointZone(*this, addr, index, zm) - ); + return autoPtr::New(*this, addr, index, zm); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.C b/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.C index d72e0c0de7..aa2312d27a 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.C +++ b/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.C @@ -90,7 +90,7 @@ Foam::tmp> Foam::Function1Types::Constant::value const scalarField& x ) const { - return tmp>(new Field(x.size(), value_)); + return tmp>::New(x.size(), value_); } diff --git a/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.C b/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.C index 707abfc1c1..31f0972ac9 100644 --- a/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.C +++ b/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.C @@ -60,7 +60,7 @@ Foam::tmp> Foam::Function1Types::OneConstant::value const scalarField& x ) const { - return tmp>(new Field(x.size(), pTraits::one)); + return tmp>::New(x.size(), pTraits::one); } diff --git a/src/OpenFOAM/primitives/functions/Function1/makeFunction1s.C b/src/OpenFOAM/primitives/functions/Function1/makeFunction1s.C index 3dff56b9a0..139a9b78dd 100644 --- a/src/OpenFOAM/primitives/functions/Function1/makeFunction1s.C +++ b/src/OpenFOAM/primitives/functions/Function1/makeFunction1s.C @@ -75,7 +75,7 @@ Foam::Function1Types::Constant::integrate ) const { NotImplemented; - return tmp>(new Field