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

@ -179,7 +179,7 @@ public:
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
return autoPtr<polyPatch>(new cyclicACMIPolyPatch(*this, bm));
return autoPtr<polyPatch>::NewFrom<cyclicACMIPolyPatch>(*this, bm);
}
//- Construct and return a clone, resetting the face list

View File

@ -220,7 +220,7 @@ public:
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
return autoPtr<polyPatch>(new cyclicAMIPolyPatch(*this, bm));
return autoPtr<polyPatch>::NewFrom<cyclicAMIPolyPatch>(*this, bm);
}
//- Construct and return a clone, resetting the face list

View File

@ -138,13 +138,9 @@ public:
//- Return clone
autoPtr<coordinateRotation> clone() const
{
return autoPtr<coordinateRotation>
(
new EulerCoordinateRotation
(
*this
)
);
return
autoPtr<coordinateRotation>::NewFrom
<EulerCoordinateRotation>(*this);
}

View File

@ -131,13 +131,9 @@ public:
//- Return clone
autoPtr<coordinateRotation> clone() const
{
return autoPtr<coordinateRotation>
(
new STARCDCoordinateRotation
(
*this
)
);
return
autoPtr<coordinateRotation>::NewFrom
<STARCDCoordinateRotation>(*this);
}

View File

@ -132,13 +132,12 @@ public:
//- Return clone
autoPtr<coordinateRotation> clone() const
{
return autoPtr<coordinateRotation>(new axesRotation(*this));
return autoPtr<coordinateRotation>::NewFrom<axesRotation>(*this);
}
//- Destructor
virtual ~axesRotation()
{}
virtual ~axesRotation() = default;
// Member Functions

View File

@ -128,13 +128,12 @@ public:
//- Return clone
autoPtr<coordinateRotation> clone() const
{
return autoPtr<coordinateRotation>(new cylindrical(*this));
return autoPtr<coordinateRotation>::NewFrom<cylindrical>(*this);
}
//- Destructor
virtual ~cylindrical()
{}
virtual ~cylindrical() = default;
// Member Functions

View File

@ -199,7 +199,7 @@ public:
//- Return clone
autoPtr<coordinateSystem> clone() const
{
return autoPtr<coordinateSystem>(new coordinateSystem(*this));
return autoPtr<coordinateSystem>::New(*this);
}

View File

@ -62,7 +62,7 @@ Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
{
const dictionary& coordDict = dict.subDict(typeName_());
return autoPtr<coordinateSystem>(new coordinateSystem(coordDict));
return autoPtr<coordinateSystem>::New(coordDict);
}
@ -74,7 +74,7 @@ Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
const word name(is);
const dictionary dict(is);
return autoPtr<coordinateSystem>(new coordinateSystem(name, dict));
return autoPtr<coordinateSystem>::New(name, dict);
}

View File

@ -92,16 +92,12 @@ public:
//- Read file and return edgeMesh
static autoPtr<edgeMesh> New(const fileName& name)
{
return autoPtr<edgeMesh>
(
new edgeMeshFormat(name)
);
return autoPtr<edgeMesh>::NewFrom<edgeMeshFormat>(name);
}
//- Destructor
virtual ~edgeMeshFormat()
{}
virtual ~edgeMeshFormat() = default;
// Member Functions

View File

@ -74,16 +74,14 @@ public:
//- Read file and return surface
static autoPtr<edgeMesh> New(const fileName& name)
{
return autoPtr<edgeMesh>
(
new extendedFeatureEdgeMeshFormat(name)
);
return
autoPtr<edgeMesh>::NewFrom
<extendedFeatureEdgeMeshFormat>(name);
}
//- Destructor
virtual ~extendedFeatureEdgeMeshFormat()
{}
virtual ~extendedFeatureEdgeMeshFormat() = default;
// Member Functions

View File

@ -82,10 +82,7 @@ public:
//- Read file and return edge mesh
static autoPtr<edgeMesh> New(const fileName& name)
{
return autoPtr<edgeMesh>
(
new NASedgeFormat(name)
);
return autoPtr<edgeMesh>::NewFrom<NASedgeFormat>(name);
}

View File

@ -78,10 +78,7 @@ public:
//- Read file and return surface
static autoPtr<edgeMesh> New(const fileName& name)
{
return autoPtr<edgeMesh>
(
new OBJedgeFormat(name)
);
return autoPtr<edgeMesh>::NewFrom<OBJedgeFormat>(name);
}

View File

@ -100,16 +100,12 @@ public:
//- Read file and return edgeMesh
static autoPtr<edgeMesh> New(const fileName& name)
{
return autoPtr<edgeMesh>
(
new STARCDedgeFormat(name)
);
return autoPtr<edgeMesh>::NewFrom<STARCDedgeFormat>(name);
}
//- Destructor
virtual ~STARCDedgeFormat()
{}
virtual ~STARCDedgeFormat() = default;
// Member Functions

View File

@ -90,16 +90,12 @@ public:
//- Read file and return surface
static autoPtr<edgeMesh> New(const fileName& name)
{
return autoPtr<edgeMesh>
(
new VTKedgeFormat(name)
);
return autoPtr<edgeMesh>::NewFrom<VTKedgeFormat>(name);
}
//- Destructor
virtual ~VTKedgeFormat()
{}
virtual ~VTKedgeFormat() = default;
// Member Functions

View File

@ -215,7 +215,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
compactOffsets[i] = globalToCompact.size();
}
return autoPtr<globalIndex>(new globalIndex(std::move(compactOffsets)));
return autoPtr<globalIndex>::New(std::move(compactOffsets));
}

View File

@ -274,7 +274,7 @@ const Foam::wordList& Foam::searchablePlate::regions() const
Foam::tmp<Foam::pointField> Foam::searchablePlate::coordinates() const
{
return tmp<pointField>(new pointField(1, origin_ + 0.5*span_));
return tmp<pointField>::New(1, origin_ + 0.5*span_);
}

View File

@ -374,17 +374,14 @@ Foam::pointToPointPlanarInterpolation::pointToPointPlanarInterpolation
Foam::autoPtr<Foam::pointToPointPlanarInterpolation>
Foam::pointToPointPlanarInterpolation::clone() const
{
return autoPtr<pointToPointPlanarInterpolation>
return autoPtr<pointToPointPlanarInterpolation>::New
(
new pointToPointPlanarInterpolation
(
perturb_,
nearestOnly_,
referenceCS_,
nPoints_,
nearestVertex_,
nearestVertexWeight_
)
perturb_,
nearestOnly_,
referenceCS_,
nPoints_,
nearestVertex_,
nearestVertexWeight_
);
}