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

This commit is contained in:
Mark Olesen
2018-02-26 14:00:30 +01:00
parent 52b36f84b5
commit 57291e8692
196 changed files with 555 additions and 879 deletions

View File

@ -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_);
}
};

View File

@ -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)

View File

@ -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
);
}

View File

@ -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
);
}

View File

@ -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?
);
}
}

View File

@ -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

View File

@ -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
);
}

View File

@ -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());
}
}

View File

@ -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();
}
};
};

View File

@ -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(),
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
);
}

View File

@ -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()
);
}

View File

@ -73,7 +73,7 @@ Foam::surfaceFeaturesExtraction::extractFromNone::features
const triSurface& surf
) const
{
return autoPtr<surfaceFeatures>(new surfaceFeatures(surf));
return autoPtr<surfaceFeatures>::New(surf);
}

View File

@ -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()
);
}