Commit 416a3790 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: prefer autoPtr::reset() to autoPtr::set()

- in most cases already checked valid() so don't need additional check
  for setting an existing pointer
parent e96cbd90
......@@ -29,8 +29,10 @@ volVectorField U
#include "createPhi.H"
// Creating e based thermo
autoPtr<twoPhaseMixtureEThermo> thermo;
thermo.set(new twoPhaseMixtureEThermo(U, phi));
autoPtr<twoPhaseMixtureEThermo> thermo
(
new twoPhaseMixtureEThermo(U, phi)
);
// Create mixture and
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n" << endl;
......
......@@ -49,7 +49,7 @@ Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::ThermoPhaseModel
{
if (createThermo)
{
thermoPtr_.set
thermoPtr_.reset
(
ThermoType::New(fluid.mesh(), this->name()).ptr()
);
......
......@@ -76,7 +76,7 @@ Foam::BlendedInterfacialModel<modelType>::BlendedInterfacialModel
{
if (modelTable.found(pair_))
{
model_.set
model_.reset
(
modelType::New
(
......@@ -88,7 +88,7 @@ Foam::BlendedInterfacialModel<modelType>::BlendedInterfacialModel
if (modelTable.found(pair1In2_))
{
model1In2_.set
model1In2_.reset
(
modelType::New
(
......@@ -100,7 +100,7 @@ Foam::BlendedInterfacialModel<modelType>::BlendedInterfacialModel
if (modelTable.found(pair2In1_))
{
model2In1_.set
model2In1_.reset
(
modelType::New
(
......
......@@ -41,7 +41,7 @@ Foam::orderedPhasePair::orderedPhasePair
{
if (aspectRatioTable.found(*this))
{
aspectRatio_.set
aspectRatio_.reset
(
aspectRatioModel::New
(
......
......@@ -132,7 +132,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
phasePair::scalarTable sigmaTable(lookup("sigma"));
phasePair::dictTable aspectRatioTable(lookup("aspectRatio"));
pair_.set
pair_.reset
(
new phasePair
(
......@@ -143,7 +143,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
pair1In2_.set
pair1In2_.reset
(
new orderedPhasePair
(
......@@ -155,7 +155,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
pair2In1_.set
pair2In1_.reset
(
new orderedPhasePair
(
......@@ -170,7 +170,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
// Models
drag_.set
drag_.reset
(
new BlendedInterfacialModel<dragModel>
(
......@@ -187,7 +187,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
virtualMass_.set
virtualMass_.reset
(
new BlendedInterfacialModel<virtualMassModel>
(
......@@ -203,7 +203,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
heatTransfer_.set
heatTransfer_.reset
(
new BlendedInterfacialModel<heatTransferModel>
(
......@@ -219,7 +219,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
lift_.set
lift_.reset
(
new BlendedInterfacialModel<liftModel>
(
......@@ -235,7 +235,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
wallLubrication_.set
wallLubrication_.reset
(
new BlendedInterfacialModel<wallLubricationModel>
(
......@@ -251,7 +251,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
turbulentDispersion_.set
turbulentDispersion_.reset
(
new BlendedInterfacialModel<turbulentDispersionModel>
(
......
......@@ -166,7 +166,7 @@ int main(int argc, char *argv[])
{
meshFilterPtr.set
meshFilterPtr.reset
(
new polyMeshFilter(mesh, pointPriority, collapseDict)
);
......
......@@ -159,7 +159,7 @@ int main(int argc, char *argv[])
if (surfaceFormat == MESHEDSURFACE)
{
fMesh.set(new MeshedSurface<face>("MeshedSurface.obj"));
fMesh.reset(new MeshedSurface<face>("MeshedSurface.obj"));
EdgeMap<label> edgeRegionMap;
wordList patchNames(1, "default");
......@@ -184,7 +184,7 @@ int main(int argc, char *argv[])
poly2DMesh.createMesh();
mesh.set
mesh.reset
(
new polyMesh
(
......@@ -224,7 +224,7 @@ int main(int argc, char *argv[])
}
else if (surfaceFormat == POLYMESH2D)
{
mesh.set
mesh.reset
(
new polyMesh
(
......@@ -244,7 +244,7 @@ int main(int argc, char *argv[])
extruder.addFrontBackPatches();
meshMod.set(new polyTopoChange(mesh().boundaryMesh().size()));
meshMod.reset(new polyTopoChange(mesh().boundaryMesh().size()));
extruder.setRefinement(meshMod());
......
......@@ -379,7 +379,7 @@ void Foam::searchableSurfaceControl::initialVertices
vectorField norms = features.featurePointNormals(info.index());
// Create a triad from these norms.
pointAlignment.set(new triad());
pointAlignment.reset(new triad());
forAll(norms, nI)
{
pointAlignment() += norms[nI];
......@@ -406,7 +406,7 @@ void Foam::searchableSurfaceControl::initialVertices
vectorField norms = features.edgeNormals(info.index());
// Create a triad from these norms.
pointAlignment.set(new triad());
pointAlignment.reset(new triad());
forAll(norms, nI)
{
pointAlignment() += norms[nI];
......@@ -431,7 +431,7 @@ void Foam::searchableSurfaceControl::initialVertices
normals[0] = vector(1, 1, 1);
}
pointAlignment.set(new triad(normals[0]));
pointAlignment.reset(new triad(normals[0]));
if (infoList[0].hit())
{
......
......@@ -420,7 +420,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
}
}
receivedVertices.set
receivedVertices.reset
(
new labelPairHashSet(number_of_vertices()/Pstream::nProcs())
);
......
......@@ -167,7 +167,7 @@ Foam::searchableBoxFeatures::features() const
labelList regionEdges;
features.set
features.reset
(
new extendedFeatureEdgeMesh
(
......
......@@ -183,7 +183,7 @@ Foam::searchablePlateFeatures::features() const
labelList regionEdges;
features.set
features.reset
(
new extendedFeatureEdgeMesh
(
......
......@@ -44,10 +44,6 @@ addToRunTimeSelectionTable
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::triSurfaceMeshFeatures::triSurfaceMeshFeatures
......@@ -98,7 +94,7 @@ Foam::triSurfaceMeshFeatures::features() const
(mode_ == extendedFeatureEdgeMesh::BOTH ? true : false)
);
features.set
features.reset
(
new extendedFeatureEdgeMesh
(
......
......@@ -314,7 +314,7 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
}
}
surfacePtr.set
surfacePtr.reset
(
new refinementSurfaces
(
......@@ -731,7 +731,7 @@ int main(int argc, char *argv[])
<< runTime.timeName() << nl << endl;
}
meshPtr.set
meshPtr.reset
(
new fvMesh
(
......@@ -982,7 +982,7 @@ int main(int argc, char *argv[])
}
else
{
surfacesPtr.set
surfacesPtr.reset
(
new refinementSurfaces
(
......
......@@ -165,7 +165,7 @@ int main(int argc, char *argv[])
if (dictPath.size())
{
csDictIoPtr.set
csDictIoPtr.reset
(
new IOobject
(
......@@ -179,7 +179,7 @@ int main(int argc, char *argv[])
}
else
{
csDictIoPtr.set
csDictIoPtr.reset
(
new IOobject
(
......
......@@ -145,7 +145,7 @@ int main(int argc, char *argv[])
{
const fileName dictPath = args["dict"];
ioPtr.set
ioPtr.reset
(
new IOobject
(
......@@ -163,7 +163,7 @@ int main(int argc, char *argv[])
}
else
{
ioPtr.set
ioPtr.reset
(
new IOobject
(
......
......@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
{
const fileName dictPath = args["dict"];
ioPtr.set
ioPtr.reset
(
new IOobject
(
......@@ -176,7 +176,7 @@ int main(int argc, char *argv[])
}
else
{
ioPtr.set
ioPtr.reset
(
new IOobject
(
......
......@@ -1019,7 +1019,7 @@ void Foam::Time::setDeltaT(const scalar deltaT, const bool adjust)
Foam::TimeState Foam::Time::subCycle(const label nSubCycles)
{
subCycling_ = true;
prevTimeState_.set(new TimeState(*this));
prevTimeState_.reset(new TimeState(*this));
setTime(*this - deltaT(), (timeIndex() - 1)*nSubCycles);
deltaT_ /= nSubCycles;
......
......@@ -770,7 +770,7 @@ bool Foam::functionObjectList::read()
);
if (functionObjects::timeControl::entriesPresent(dict))
{
foPtr.set
foPtr.reset
(
new functionObjects::timeControl(key, time_, dict)
);
......
......@@ -112,7 +112,7 @@ Foam::autoPtr<Foam::OFstream> Foam::functionObjects::writeFile::createFile
fName = fName + "_" + startTimeName;
}
osPtr.set(new OFstream(outputDir/(fName + ".dat")));
osPtr.reset(new OFstream(outputDir/(fName + ".dat")));
initStream(osPtr());
}
......
......@@ -275,7 +275,7 @@ Foam::codedFixedValuePointPatchField<Type>::redirectPatchField() const
IStringStream is(os.str());
dictionary dict(is);
redirectPatchFieldPtr_.set
redirectPatchFieldPtr_.reset
(
pointPatchField<Type>::New
(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment