ENH: use tmp field factory methods [12] (#2723)

- applications
This commit is contained in:
Mark Olesen 2023-10-08 18:35:04 +02:00
parent ec2b1be8c5
commit 8b73d06898
32 changed files with 171 additions and 387 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -93,24 +94,14 @@ Foam::PDRDragModels::basic::~basic()
Foam::tmp<Foam::volSymmTensorField> Foam::PDRDragModels::basic::Dcu() const
{
tmp<volSymmTensorField> tDragDcu
(
new volSymmTensorField
(
IOobject
auto tDragDcu = volSymmTensorField::New
(
"tDragDcu",
U_.mesh().time().constant(),
U_.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
IOobject::NO_REGISTER,
U_.mesh(),
dimensionedSymmTensor(dimMass/dimTime/dimVolume, Zero)
)
);
volSymmTensorField& DragDcu = tDragDcu.ref();
auto& DragDcu = tDragDcu.ref();
if (on_)
{
@ -127,24 +118,14 @@ Foam::tmp<Foam::volSymmTensorField> Foam::PDRDragModels::basic::Dcu() const
Foam::tmp<Foam::volScalarField> Foam::PDRDragModels::basic::Gk() const
{
tmp<volScalarField> tGk
(
new volScalarField
(
IOobject
auto tGk = volScalarField::New
(
"tGk",
U_.mesh().time().constant(),
U_.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
IOobject::NO_REGISTER,
U_.mesh(),
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
)
);
volScalarField& Gk = tGk.ref();
auto& Gk = tGk.ref();
if (on_)
{

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -93,23 +94,14 @@ Foam::tmp<Foam::volScalarField> Foam::XiEqModels::SCOPEXiEq::XiEq() const
volScalarField K(0.157*upBySu/sqrt(Rl));
volScalarField Ma(MaModel.Ma());
tmp<volScalarField> tXiEq
(
new volScalarField
(
IOobject
auto tXiEq = volScalarField::New
(
"XiEq",
epsilon.time().timeName(),
epsilon.db(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
IOobject::NO_REGISTER,
epsilon.mesh(),
dimensionedScalar(dimless, Zero)
)
);
volScalarField& xieq = tXiEq.ref();
auto& xieq = tXiEq.ref();
forAll(xieq, celli)
{

View File

@ -78,11 +78,10 @@ bool Foam::XiEqModel::read(const dictionary& XiEqProperties)
void Foam::XiEqModel::writeFields() const
{
//***HGW It is not clear why B is written here
if (Su_.mesh().foundObject<volSymmTensorField>("B"))
const auto* B = Su_.mesh().cfindObject<volSymmTensorField>("B");
if (B)
{
const volSymmTensorField& B =
Su_.mesh().lookupObject<volSymmTensorField>("B");
B.write();
B->write();
}
}
@ -98,39 +97,26 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const
const volSymmTensorField& nsv =
mesh.lookupObject<volSymmTensorField>("nsv");
tmp<volScalarField> tN
(
new volScalarField
(
IOobject
auto tN = volScalarField::New
(
"tN",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
IOobject::NO_REGISTER,
mesh,
dimensionedScalar(Nv.dimensions(), Zero)
)
);
volScalarField& N = tN.ref();
auto& N = tN.ref();
N.primitiveFieldRef() = Nv.primitiveField()*pow(mesh.V(), 2.0/3.0);
volSymmTensorField ns
(
IOobject
auto tns = volSymmTensorField::New
(
"tns",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
IOobject::NO_REGISTER,
mesh,
dimensionedSymmTensor(nsv.dimensions(), Zero)
);
auto& ns = tns.ref();
ns.primitiveFieldRef() = nsv.primitiveField()*pow(mesh.V(), 2.0/3.0);
const volVectorField Uhat

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -255,24 +256,14 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi
scalar phi
) const
{
tmp<volScalarField> tSu0
(
new volScalarField
(
IOobject
auto tSu0 = volScalarField::New
(
"Su0",
p.time().timeName(),
p.db(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
IOobject::NO_REGISTER,
p.mesh(),
dimensionedScalar(dimVelocity, Zero)
)
);
volScalarField& Su0 = tSu0.ref();
auto& Su0 = tSu0.ref();
forAll(Su0, celli)
{
@ -304,24 +295,14 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi
const volScalarField& phi
) const
{
tmp<volScalarField> tSu0
(
new volScalarField
(
IOobject
auto tSu0 = volScalarField::New
(
"Su0",
p.time().timeName(),
p.db(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
IOobject::NO_REGISTER,
p.mesh(),
dimensionedScalar(dimVelocity, Zero)
)
);
volScalarField& Su0 = tSu0.ref();
auto& Su0 = tSu0.ref();
forAll(Su0, celli)
{
@ -358,24 +339,14 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Ma
const volScalarField& phi
) const
{
tmp<volScalarField> tMa
(
new volScalarField
(
IOobject
auto tMa = volScalarField::New
(
"Ma",
phi.time().timeName(),
phi.db(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
IOobject::NO_REGISTER,
phi.mesh(),
dimensionedScalar(dimless, Zero)
)
);
volScalarField& ma = tMa.ref();
auto& ma = tMa.ref();
forAll(ma, celli)
{
@ -418,21 +389,12 @@ Foam::laminarFlameSpeedModels::SCOPE::Ma() const
{
const fvMesh& mesh = psiuReactionThermo_.p().mesh();
return tmp<volScalarField>
(
new volScalarField
(
IOobject
return volScalarField::New
(
"Ma",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
IOobject::NO_REGISTER,
mesh,
dimensionedScalar("Ma", dimless, Ma(equivalenceRatio_))
)
);
}
}

View File

@ -3,12 +3,7 @@ if (nAlphaSubCycles > 1)
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh.newIOobject("rhoPhiSum"),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -3,12 +3,7 @@ if (nAlphaSubCycles > 1)
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh.newIOobject("rhoPhiSum"),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -4,26 +4,19 @@ if (nAlphaSubCycles > 1)
{
dimensionedScalar totalDeltaT = runTime.deltaT();
talphaPhi1 = new surfaceScalarField
talphaPhi1.reset
(
IOobject
new surfaceScalarField
(
"alphaPhi1",
runTime.timeName(),
mesh
),
mesh.newIOobject("alphaPhi1"),
mesh,
dimensionedScalar(alphaPhi10.dimensions(), Zero)
)
);
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh.newIOobject("rhoPhiSum"),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -13,26 +13,19 @@ if (nAlphaSubCycles > 1)
{
dimensionedScalar totalDeltaT = runTime.deltaT();
talphaPhi1 = new surfaceScalarField
talphaPhi1.reset
(
IOobject
new surfaceScalarField
(
"alphaPhi1",
runTime.timeName(),
mesh
),
mesh.newIOobject("alphaPhi1"),
mesh,
dimensionedScalar(alphaPhi10.dimensions(), Zero)
)
);
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh.newIOobject("rhoPhiSum"),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -99,7 +99,8 @@ Foam::multiphaseMixtureThermo::multiphaseMixtureThermo
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
IOobject::AUTO_WRITE,
IOobject::REGISTER
),
mesh_,
dimensionedScalar(dimless, Zero)
@ -998,19 +999,12 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseMixtureThermo::K
Foam::tmp<Foam::volScalarField>
Foam::multiphaseMixtureThermo::nearInterface() const
{
tmp<volScalarField> tnearInt
(
new volScalarField
(
IOobject
auto tnearInt = volScalarField::New
(
"nearInterface",
mesh_.time().timeName(),
mesh_
),
IOobject::NO_REGISTER,
mesh_,
dimensionedScalar(dimless, Zero)
)
);
for (const phaseModel& phase : phases_)

View File

@ -18,12 +18,7 @@
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField alphaPhiSum
(
IOobject
(
"alphaPhiSum",
runTime.timeName(),
mesh
),
mesh.newIOobject("alphaPhiSum"),
mesh,
dimensionedScalar(phi.dimensions(), Zero)
);

View File

@ -158,13 +158,11 @@ Foam::tmp<Foam::volSymmTensorField> Foam::relativeVelocityModel::tauDm() const
// Calculate the relative velocity of the continuous phase w.r.t the mean
volVectorField Ucm(betad*Udm_/betac);
return tmp<volSymmTensorField>
(
new volSymmTensorField
return volSymmTensorField::New
(
"tauDm",
IOobject::NO_REGISTER,
betad*sqr(Udm_) + betac*sqr(Ucm)
)
);
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -407,7 +407,8 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
IOobject::AUTO_WRITE,
IOobject::REGISTER
),
mesh_,
dimensionedScalar(dimPower/dimVolume, Zero)
@ -504,7 +505,8 @@ Foam::radiation::laserDTRM::laserDTRM
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
IOobject::AUTO_WRITE,
IOobject::REGISTER
),
mesh_,
dimensionedScalar(dimPower/pow3(dimLength), Zero)
@ -535,42 +537,23 @@ Foam::label Foam::radiation::laserDTRM::nBands() const
void Foam::radiation::laserDTRM::calculate()
{
tmp<volScalarField> treflectingCells
(
new volScalarField
(
IOobject
auto treflectingCells = volScalarField::New
(
"reflectingCellsVol",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
IOobject::NO_REGISTER,
mesh_,
dimensionedScalar("zero", dimless, -1)
)
);
volScalarField& reflectingCellsVol = treflectingCells.ref();
auto& reflectingCellsVol = treflectingCells.ref();
tmp<volVectorField> tnHat
(
new volVectorField
(
IOobject
auto tnHat = volVectorField::New
(
"nHat",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
IOobject::NO_REGISTER,
mesh_,
dimensionedVector(dimless, Zero)
)
);
volVectorField& nHat = tnHat.ref();
auto& nHat = tnHat.ref();
// Reset the field
@ -686,9 +669,9 @@ void Foam::radiation::laserDTRM::calculate()
globalIndex::gatherInplaceOp(lines);
if (Pstream::master())
if (UPstream::master())
{
OBJstream os(type() + ":particlePath.obj");
OBJstream os(type() + "-particlePath.obj");
for (label pointi = 0; pointi < lines.size(); pointi += 2)
{

View File

@ -88,25 +88,14 @@ Foam::radiation::localDensityAbsorptionEmission::localDensityAbsorptionEmission
Foam::tmp<Foam::volScalarField>
Foam::radiation::localDensityAbsorptionEmission::aCont(const label bandI) const
{
tmp<volScalarField> ta
(
new volScalarField
(
IOobject
auto ta = volScalarField::New
(
"a",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
IOobject::NO_REGISTER,
mesh_,
dimensionedScalar(inv(dimLength), Zero)
)
);
volScalarField& a = ta.ref();
auto& a = ta.ref();
forAll(alphaNames_, i)
{
@ -121,25 +110,14 @@ Foam::radiation::localDensityAbsorptionEmission::aCont(const label bandI) const
Foam::tmp<Foam::volScalarField>
Foam::radiation::localDensityAbsorptionEmission::eCont(const label bandI) const
{
tmp<volScalarField> te
(
new volScalarField
(
IOobject
auto te = volScalarField::New
(
"e",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
IOobject::NO_REGISTER,
mesh_,
dimensionedScalar(inv(dimLength), Zero)
)
);
volScalarField& e = te.ref();
auto& e = te.ref();
forAll(alphaNames_, i)
{
@ -154,22 +132,12 @@ Foam::radiation::localDensityAbsorptionEmission::eCont(const label bandI) const
Foam::tmp<Foam::volScalarField>
Foam::radiation::localDensityAbsorptionEmission::ECont(const label bandI) const
{
tmp<volScalarField> tE
(
new volScalarField
(
IOobject
auto tE = volScalarField::New
(
"E",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
IOobject::NO_REGISTER,
mesh_,
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
)
);
scalarField& E = tE.ref().primitiveFieldRef();

View File

@ -171,16 +171,8 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::TSource() const
const volScalarField& T = mesh_.lookupObject<volScalarField>("T");
tmp<fvScalarMatrix> tTSource
(
new fvScalarMatrix
(
T,
dimEnergy/dimTime
)
);
fvScalarMatrix& TSource = tTSource.ref();
auto tTSource = tmp<fvScalarMatrix>::New(T, dimEnergy/dimTime);
auto& TSource = tTSource.ref();
const twoPhaseMixtureEThermo& thermo =
refCast<const twoPhaseMixtureEThermo>

View File

@ -382,7 +382,7 @@ Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::kappaEff
const volScalarField& kappat
) const
{
tmp<Foam::volScalarField> kappaEff(kappa() + kappat);
tmp<volScalarField> kappaEff(kappa() + kappat);
kappaEff.ref().rename("kappaEff");
return kappaEff;
}

View File

@ -3,12 +3,7 @@ if (nAlphaSubCycles > 1)
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh.newIOobject("rhoPhiSum"),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -32,12 +32,7 @@ if (nAlphaSubCycles > 1)
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh.newIOobject("rhoPhiSum"),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -21,12 +21,7 @@
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh.newIOobject("rhoPhiSum"),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -50,7 +50,8 @@
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
IOobject::AUTO_WRITE,
IOobject::REGISTER
),
mesh,
dimensionedScalar(dimVelocity*dimArea, Zero)

View File

@ -68,8 +68,9 @@ Foam::multiphaseMixture::multiphaseMixture
"transportProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
IOobject::READ_MODIFIED,
IOobject::NO_WRITE,
IOobject::REGISTER
)
),
@ -85,9 +86,7 @@ Foam::multiphaseMixture::multiphaseMixture
(
"rhoPhi",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
mesh_
),
mesh_,
dimensionedScalar(dimMass/dimTime, Zero)
@ -101,7 +100,8 @@ Foam::multiphaseMixture::multiphaseMixture
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
IOobject::AUTO_WRITE,
IOobject::REGISTER
),
mesh_,
dimensionedScalar(dimless, Zero)
@ -257,19 +257,12 @@ Foam::multiphaseMixture::nuf() const
Foam::tmp<Foam::surfaceScalarField>
Foam::multiphaseMixture::surfaceTensionForce() const
{
tmp<surfaceScalarField> tstf
(
new surfaceScalarField
(
IOobject
auto tstf = surfaceScalarField::New
(
"surfaceTensionForce",
mesh_.time().timeName(),
mesh_
),
IOobject::NO_REGISTER,
mesh_,
dimensionedScalar(dimensionSet(1, -2, -2, 0, 0), Zero)
)
);
surfaceScalarField& stf = tstf.ref();
@ -324,12 +317,7 @@ void Foam::multiphaseMixture::solve()
{
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh_
),
mesh_.newIOobject("rhoPhiSum"),
mesh_,
dimensionedScalar(rhoPhi_.dimensions(), Zero)
);
@ -552,19 +540,12 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::K
Foam::tmp<Foam::volScalarField>
Foam::multiphaseMixture::nearInterface() const
{
tmp<volScalarField> tnearInt
(
new volScalarField
(
IOobject
auto tnearInt = volScalarField::New
(
"nearInterface",
mesh_.time().timeName(),
mesh_
),
IOobject::NO_REGISTER,
mesh_,
dimensionedScalar(dimless, Zero)
)
);
for (const phase& ph : phases_)
@ -649,12 +630,7 @@ void Foam::multiphaseMixture::solveAlphas
volScalarField sumAlpha
(
IOobject
(
"sumAlpha",
mesh_.time().timeName(),
mesh_
),
mesh_.newIOobject("sumAlpha"),
mesh_,
dimensionedScalar(dimless, Zero)
);

View File

@ -5,12 +5,7 @@ if (nAlphaSubCycles > 1)
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh.newIOobject("rhoPhiSum"),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -67,8 +67,8 @@ using namespace Foam;
// // (note:without calculating pointNormals
// // to avoid them being stored)
//
// tmp<pointField> textrudeN(new pointField(p.nPoints(), Zero));
// pointField& extrudeN = textrudeN();
// auto textrudeN = tmp<pointField>::New(p.nPoints(), Zero);
// auto& extrudeN = textrudeN.ref();
// {
// const faceList& localFaces = p.localFaces();
// const vectorField& faceAreas = mesh.faceAreas();

View File

@ -1088,8 +1088,8 @@ tmp<pointField> calcOffset
{
vectorField::subField fc = pp.faceCentres();
tmp<pointField> toffsets(new pointField(fc.size()));
pointField& offsets = toffsets.ref();
auto toffsets = tmp<pointField>::New(fc.size());
auto& offsets = toffsets.ref();
forAll(fc, i)
{

View File

@ -64,8 +64,8 @@ Foam::tmp<Foam::Field<Type>> filterFarPoints
const Field<Type>& field
)
{
tmp<Field<Type>> tNewField(new Field<Type>(field.size()));
Field<Type>& newField = tNewField.ref();
auto tNewField = tmp<Field<Type>>::New(field.size());
auto& newField = tNewField.ref();
label added = 0;
label count = 0;

View File

@ -268,8 +268,8 @@ Foam::tmp<Foam::pointField> Foam::DelaunayMeshTools::allPoints
const Triangulation& t
)
{
tmp<pointField> tpts(new pointField(t.vertexCount(), point::max));
pointField& pts = tpts.ref();
auto tpts = tmp<pointField>::New(t.vertexCount(), point::max);
auto& pts = tpts.ref();
for
(

View File

@ -258,8 +258,8 @@ Foam::label Foam::cellShapeControlMesh::removePoints()
Foam::tmp<Foam::pointField> Foam::cellShapeControlMesh::cellCentres() const
{
tmp<pointField> tcellCentres(new pointField(number_of_finite_cells()));
pointField& cellCentres = tcellCentres.ref();
auto tcellCentres = tmp<pointField>::New(number_of_finite_cells());
auto& cellCentres = tcellCentres.ref();
label count = 0;
for

View File

@ -36,8 +36,8 @@ Foam::tmp<Foam::Field<Type>> Foam::smoothAlignmentSolver::filterFarPoints
const Field<Type>& field
)
{
tmp<Field<Type>> tNewField(new Field<Type>(field.size()));
Field<Type>& newField = tNewField.ref();
auto tNewField = tmp<Field<Type>>::New(field.size());
auto& newField = tNewField.ref();
label added = 0;
label count = 0;

View File

@ -310,8 +310,8 @@ tmp<scalarField> signedDistance
const labelList& surfaces
)
{
tmp<scalarField> tfld(new scalarField(points.size(), Foam::sqr(GREAT)));
scalarField& fld = tfld.ref();
auto tfld = tmp<scalarField>::New(points.size(), Foam::sqr(GREAT));
auto& fld = tfld.ref();
// Find nearest
List<pointIndexHit> nearest;

View File

@ -368,7 +368,7 @@ int main(int argc, char *argv[])
const auto dictFileName = args.get<fileName>(1);
autoPtr<IFstream> dictFile(new IFstream(dictFileName));
auto dictFile = autoPtr<IFstream>::New(dictFileName);
if (!dictFile().good())
{
FatalErrorInFunction

View File

@ -360,8 +360,8 @@ tmp<scalarField> avg
const scalarField& edgeWeights
)
{
tmp<scalarField> tres(new scalarField(s.nPoints(), Zero));
scalarField& res = tres.ref();
auto tres = tmp<scalarField>::New(s.nPoints(), Zero);
auto& res = tres.ref();
scalarField sumWeight(s.nPoints(), Zero);

View File

@ -62,8 +62,8 @@ tmp<pointField> avg
{
const labelListList& pointEdges = s.pointEdges();
tmp<pointField> tavg(new pointField(s.nPoints(), Zero));
pointField& avg = tavg.ref();
auto tavg = tmp<pointField>::New(s.nPoints(), Zero);
auto& avg = tavg.ref();
forAll(pointEdges, vertI)
{

View File

@ -33,8 +33,8 @@ localCode
const pointField& points
)
{
tmp<pointField> tnewPoints(new pointField(points));
pointField& newPoints = tnewPoints.ref();
auto tnewPoints = tmp<pointField>::New(points);
auto& newPoints = tnewPoints.ref();
const boundBox bb(points, true);
const scalar zMin = bb.min()[vector::Z];