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

@ -136,7 +136,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
<< abort(FatalError);
}
return tmp<Field<Type>>(new Field<Type>(0));
return tmp<Field<Type>>::New();
}

View File

@ -67,7 +67,7 @@ Foam::functionObjects::fieldValues::volFieldValue::getFieldValues
<< abort(FatalError);
}
return tmp<Field<Type>>(new Field<Type>(0.0));
return tmp<Field<Type>>::New(Zero);
}
@ -266,7 +266,7 @@ Foam::functionObjects::fieldValues::volFieldValue::filterField
}
else
{
return tmp<Field<Type>>(new Field<Type>(field, cellIDs()));
return tmp<Field<Type>>::New(field, cellIDs());
}
}

View File

@ -54,7 +54,7 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::rho(const label patchi) const
if (rhoName_ == "rhoInf")
{
const label n = mesh_.boundary()[patchi].size();
return tmp<Field<scalar>>(new Field<scalar>(n, rhoRef_));
return tmp<Field<scalar>>::New(n, rhoRef_);
}
else if (mesh_.foundObject<volScalarField>(rhoName_, false))
{
@ -77,7 +77,7 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::Cp(const label patchi) const
if (CpName_ == "CpInf")
{
const label n = mesh_.boundary()[patchi].size();
return tmp<Field<scalar>>(new Field<scalar>(n, CpRef_));
return tmp<Field<scalar>>::New(n, CpRef_);
}
else if (mesh_.foundObject<fluidThermo>(fluidThermo::typeName))
{

View File

@ -111,17 +111,14 @@ Foam::functionObjects::streamLineBase::wallPatch() const
}
}
return autoPtr<indirectPrimitivePatch>
return autoPtr<indirectPrimitivePatch>::New
(
new indirectPrimitivePatch
IndirectList<face>
(
IndirectList<face>
(
mesh_.faces(),
addressing
),
mesh_.points()
)
mesh_.faces(),
addressing
),
mesh_.points()
);
}