Commit 57291e86 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: use autoPtr::New and tmp::New for simple return types

parent 52b36f84
......@@ -100,7 +100,7 @@ public:
autoPtr<phaseModel> operator()(Istream& is) const
{
return autoPtr<phaseModel>(new phaseModel(is, p_, T_));
return autoPtr<phaseModel>::New(is, p_, T_);
}
};
......
......@@ -60,7 +60,7 @@ public:
autoPtr<Scalar> clone() const
{
return autoPtr<Scalar>(new Scalar(data_));
return autoPtr<Scalar>::New(data_);
}
friend Ostream& operator<<(Ostream& os, const Scalar& val)
......
......@@ -93,14 +93,11 @@ Foam::autoPtr<Foam::mapDistribute> Foam::smoothAlignmentSolver::buildReferredMap
indices.transfer(dynIndices);
List<Map<label>> compactMap;
return autoPtr<mapDistribute>
return autoPtr<mapDistribute>::New
(
new mapDistribute
(
globalIndexing,
indices,
compactMap
)
globalIndexing,
indices,
compactMap
);
}
......@@ -157,14 +154,11 @@ Foam::autoPtr<Foam::mapDistribute> Foam::smoothAlignmentSolver::buildMap
}
List<Map<label>> compactMap;
return autoPtr<mapDistribute>
return autoPtr<mapDistribute>::New
(
new mapDistribute
(
globalIndexing,
pointPoints,
compactMap
)
globalIndexing,
pointPoints,
compactMap
);
}
......
......@@ -518,39 +518,36 @@ autoPtr<mapPolyMesh> reorderMesh
}
return autoPtr<mapPolyMesh>
return autoPtr<mapPolyMesh>::New
(
new mapPolyMesh
(
mesh, // const polyMesh& mesh,
mesh.nPoints(), // nOldPoints,
mesh.nFaces(), // nOldFaces,
mesh.nCells(), // nOldCells,
identity(mesh.nPoints()), // pointMap,
List<objectMap>(0), // pointsFromPoints,
faceOrder, // faceMap,
List<objectMap>(0), // facesFromPoints,
List<objectMap>(0), // facesFromEdges,
List<objectMap>(0), // facesFromFaces,
cellOrder, // cellMap,
List<objectMap>(0), // cellsFromPoints,
List<objectMap>(0), // cellsFromEdges,
List<objectMap>(0), // cellsFromFaces,
List<objectMap>(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<scalarField>() // oldCellVolumes
)
mesh, // const polyMesh& mesh,
mesh.nPoints(), // nOldPoints,
mesh.nFaces(), // nOldFaces,
mesh.nCells(), // nOldCells,
identity(mesh.nPoints()), // pointMap,
List<objectMap>(), // pointsFromPoints,
faceOrder, // faceMap,
List<objectMap>(), // facesFromPoints,
List<objectMap>(), // facesFromEdges,
List<objectMap>(), // facesFromFaces,
cellOrder, // cellMap,
List<objectMap>(), // cellsFromPoints,
List<objectMap>(), // cellsFromEdges,
List<objectMap>(), // cellsFromFaces,
List<objectMap>(), // 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<scalarField>() // oldCellVolumes
);
}
......
......@@ -98,15 +98,12 @@ autoPtr<faceCoupleInfo> determineCoupledFaces
{
if (fullMatch || masterMesh.nCells() == 0)
{
return autoPtr<faceCoupleInfo>
return autoPtr<faceCoupleInfo>::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<faceCoupleInfo> determineCoupledFaces
}
addFaces.shrink();
return autoPtr<faceCoupleInfo>
return autoPtr<faceCoupleInfo>::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?
);
}
}
......
......@@ -49,7 +49,7 @@ Foam::tmp<Foam::Field<Type>> Foam::readParticleField
if (obj != nullptr)
{
IOField<Type> newField(*obj);
return tmp<Field<Type>>(new Field<Type>(newField.xfer()));
return tmp<Field<Type>>::New(newField.xfer());
}
FatalErrorInFunction
......
......@@ -55,22 +55,19 @@ autoPtr<GeoFieldType> loadField
Info<< "Reading " << GeoFieldType::typeName
<< ' ' << io->name() << endl;
return autoPtr<GeoFieldType>
return autoPtr<GeoFieldType>::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
);
}
......
......@@ -244,7 +244,7 @@ tmp<volScalarField> calcNut
// Correct nut
turbulence->validate();
return tmp<volScalarField>(new volScalarField(turbulence->nut()));
return tmp<volScalarField>::New(turbulence->nut());
}
else
{
......@@ -264,7 +264,7 @@ tmp<volScalarField> calcNut
// Correct nut
turbulence->validate();
return tmp<volScalarField>(new volScalarField(turbulence->nut()));
return tmp<volScalarField>::New(turbulence->nut());
}
}
......
......@@ -141,7 +141,7 @@ public:
autoPtr<setCellField> clone() const
{
return autoPtr<setCellField>(new setCellField());
return autoPtr<setCellField>::New();
}
class iNew
......@@ -182,7 +182,7 @@ public:
<< endl;
}
return autoPtr<setCellField>(new setCellField());
return autoPtr<setCellField>::New();
}
};
};
......@@ -332,7 +332,7 @@ public:
autoPtr<setFaceField> clone() const
{
return autoPtr<setFaceField>(new setFaceField());
return autoPtr<setFaceField>::New();
}
class iNew
......@@ -373,7 +373,7 @@ public:
<< endl;
}
return autoPtr<setFaceField>(new setFaceField());
return autoPtr<setFaceField>::New();
}
};
};
......
......@@ -1480,33 +1480,30 @@ autoPtr<extendedFeatureEdgeMesh> createEdgeMesh
//calcFeaturePoints(inter.cutPoints(), inter.cutEdges());
return autoPtr<extendedFeatureEdgeMesh>
return autoPtr<extendedFeatureEdgeMesh>::New
(
new extendedFeatureEdgeMesh
(
io,
inter.cutPoints(),
inter.cutEdges(),
0, // concaveStart,
0, // mixedStart,
0, // nonFeatureStart,
internalStart, // internalStart,
nIntOrExt, // flatStart,
nIntOrExt + nFlat, // openStart,
nIntOrExt + nFlat + nOpen, // multipleStart,
normalsTmp,
normalVolumeTypesTmp,
edgeDirections,
normalDirectionsTmp,
edgeNormalsTmp,
labelListList(0), // featurePointNormals,
labelListList(0), // featurePointEdges,
labelList(0) // regionEdges
)
io,
inter.cutPoints(),
inter.cutEdges(),
0, // concaveStart,
0, // mixedStart,
0, // nonFeatureStart,
internalStart, // internalStart,
nIntOrExt, // flatStart,
nIntOrExt + nFlat, // openStart,
nIntOrExt + nFlat + nOpen, // multipleStart,
normalsTmp,
normalVolumeTypesTmp,
edgeDirections,
normalDirectionsTmp,
edgeNormalsTmp,
labelListList(), // featurePointNormals,
labelListList(), // featurePointEdges,
labelList() // regionEdges
);
}
......
......@@ -86,16 +86,13 @@ Foam::surfaceFeaturesExtraction::extractFromFile::features
<< "Selecting edges based purely on geometric tests: "
<< geometricTestOnly().c_str() << endl;
return autoPtr<surfaceFeatures>
return autoPtr<surfaceFeatures>::New
(
new surfaceFeatures
(
surf,
eMesh.points(),
eMesh.edges(),
1e-6, // mergeTol
geometricTestOnly()
)
surf,
eMesh.points(),
eMesh.edges(),
1e-6, // mergeTol
geometricTestOnly()
);
}
......
......@@ -73,7 +73,7 @@ Foam::surfaceFeaturesExtraction::extractFromNone::features
const triSurface& surf
) const
{
return autoPtr<surfaceFeatures>(new surfaceFeatures(surf));
return autoPtr<surfaceFeatures>::New(surf);
}
......
......@@ -80,16 +80,13 @@ Foam::surfaceFeaturesExtraction::extractFromSurface::features
<< "Selecting edges based purely on geometric tests: "
<< geometricTestOnly().c_str() << endl;
return autoPtr<surfaceFeatures>
return autoPtr<surfaceFeatures>::New
(
new surfaceFeatures
(
surf,
includedAngle(),
0, // minLen
0, // minElems
geometricTestOnly()
)
surf,
includedAngle(),
0, // minLen
0, // minElems
geometricTestOnly()
);
}
......
......@@ -418,10 +418,7 @@ public:
//- Clone
autoPtr<dynamicIndexedOctree<Type>> clone() const
{
return autoPtr<dynamicIndexedOctree<Type>>
(
new dynamicIndexedOctree<Type>(*this)
);
return autoPtr<dynamicIndexedOctree<Type>>::New(*this);
}
......
......@@ -432,10 +432,7 @@ public:
//- Clone
autoPtr<indexedOctree<Type>> clone() const
{
return autoPtr<indexedOctree<Type>>
(
new indexedOctree<Type>(*this)
);
return autoPtr<indexedOctree<Type>>::New(*this);
}
// Member Functions
......
......@@ -101,10 +101,7 @@ template<class T, class Container>
inline Foam::autoPtr<Foam::CompactListList<T, Container>>
Foam::CompactListList<T, Container>::clone() const
{
return autoPtr<CompactListList<T, Container>>
(
new CompactListList<T, Container>(*this)
);
return autoPtr<CompactListList<T, Container>>::New(*this);
}
......
......@@ -135,7 +135,7 @@ template<class T, unsigned Size>
inline Foam::autoPtr<Foam::FixedList<T, Size>>
Foam::FixedList<T, Size>::clone() const
{
return autoPtr<FixedList<T, Size>>(new FixedList<T, Size>(*this));
return autoPtr<FixedList<T, Size>>::New(*this);
}
......
......@@ -95,7 +95,7 @@ inline constexpr Foam::List<T>::List() noexcept
template<class T>
inline Foam::autoPtr<Foam::List<T>> Foam::List<T>::clone() const
{
return autoPtr<List<T>>(new List<T>(*this));
return autoPtr<List<T>>::New(*this);
}
......
......@@ -125,7 +125,7 @@ inline Foam::PackedBoolList::PackedBoolList
inline Foam::autoPtr<Foam::PackedBoolList>
Foam::PackedBoolList::clone() const
{
return autoPtr<PackedBoolList>(new PackedBoolList(*this));
return autoPtr<PackedBoolList>::New(*this);
}
......
......@@ -267,7 +267,7 @@ template<unsigned nBits>
inline Foam::autoPtr<Foam::PackedList<nBits>>
Foam::PackedList<nBits>::clone() const
{
return autoPtr<PackedList<nBits>>(new PackedList<nBits>(*this));
return autoPtr<PackedList<nBits>>::New(*this);
}
......
......@@ -279,13 +279,13 @@ public:
//- Clone
autoPtr<IOobject> clone() const
{
return autoPtr<IOobject>(new IOobject(*this));
return autoPtr<IOobject>::New(*this);
}
//- Clone resetting registry
autoPtr<IOobject> clone(const objectRegistry& registry) const
{
return autoPtr<IOobject>(new IOobject(*this, registry));
return autoPtr<IOobject>::New(*this, registry);
}
......
......@@ -150,7 +150,7 @@ Foam::dictionary::dictionary
Foam::autoPtr<Foam::dictionary> Foam::dictionary::clone() const
{
return autoPtr<dictionary>(new dictionary(*this));
return autoPtr<dictionary>::New(*this);
}
......
......@@ -71,7 +71,7 @@ Foam::dictionary::dictionary(Istream& is, bool keepHeader)
Foam::autoPtr<Foam::dictionary> Foam::dictionary::New(Istream& is)
{
return autoPtr<dictionary>(new dictionary(is));
return autoPtr<dictionary>::New(is);
}
......
......@@ -250,7 +250,7 @@ public:
//- Construct and return a clone
autoPtr<dimensionSet> clone() const
{
return autoPtr<dimensionSet>(new dimensionSet(*this));
return autoPtr<dimensionSet>::New(*this);
}
//- Construct from Istream
......
......@@ -177,7 +177,7 @@ FieldField<Field, Type>::FieldField(Istream& is)
template<template<class> class Field, class Type>
tmp<FieldField<Field, Type>> FieldField<Field, Type>::clone() const
{
return tmp<FieldField<Field, Type>>(new FieldField<Field, Type>(*this));
return tmp<FieldField<Field, Type>>::New(*this);
}
......
......@@ -348,7 +348,7 @@ Foam::Field<Type>::Field
template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::Field<Type>::clone() const
{
return tmp<Field<Type>>(new Field<Type>(*this));
return tmp<Field<Type>>::New(*this);
}
......
......@@ -241,7 +241,7 @@ public:
template<class Type2>
static tmp<Field<Type>> NewCalculatedType(const Field<Type2>& f)
{
return tmp<Field<Type>>(new Field<Type>(f.size()));
return tmp<Field<Type>>::New(f.size());
}
......