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

- src/OpenFOAM, src/meshTools, src/mesh, src/dynamicMesh, src/sampling
  src/topoChanger src/overset src/fvMotionSolver
This commit is contained in:
Mark Olesen
2024-01-23 09:03:59 +01:00
parent ac574a6ccb
commit 21196d8c0b
30 changed files with 128 additions and 254 deletions

View File

@ -46,7 +46,8 @@ Foam::tmp<GeoField> Foam::uniformInterpolate
field0.time().timeName(),
field0.db(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
IOobject::AUTO_WRITE,
IOobject::REGISTER
),
weights[0]*(*fields[indices[0]])
);

View File

@ -90,16 +90,11 @@ template<class Type, class DType, class LUType>
Foam::tmp<Foam::Field<Type>>
Foam::LduMatrix<Type, DType, LUType>::H(const Field<Type>& psi) const
{
tmp<Field<Type>> tHpsi
(
new Field<Type>(lduAddr().size(), Zero)
);
auto tHpsi = tmp<Field<Type>>::New(lduAddr().size(), Foam::zero{});
if (lowerPtr_ || upperPtr_)
{
Field<Type> & Hpsi = tHpsi();
Type* __restrict__ HpsiPtr = Hpsi.begin();
Type* __restrict__ HpsiPtr = tHpsi.ref().begin();
const Type* __restrict__ psiPtr = psi.begin();

View File

@ -35,7 +35,7 @@ Description
template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::lduMatrix::H(const Field<Type>& psi) const
{
auto tHpsi = tmp<Field<Type>>::New(lduAddr().size(), Zero);
auto tHpsi = tmp<Field<Type>>::New(lduAddr().size(), Foam::zero{});
if (lowerPtr_ || upperPtr_)
{

View File

@ -1195,7 +1195,7 @@ void Foam::polyMesh::movePoints(const pointField& newPoints)
{
if (debug)
{
Info<< "tmp<scalarField> polyMesh::movePoints(const pointField&) : "
Info<< "void polyMesh::movePoints(const pointField&) : "
<< " Storing current points for time " << time().value()
<< " index " << time().timeIndex() << endl;
}

View File

@ -333,8 +333,8 @@ const Foam::vectorField::subField Foam::polyPatch::faceAreas() const
Foam::tmp<Foam::vectorField> Foam::polyPatch::faceCellCentres() const
{
tmp<vectorField> tcc(new vectorField(size()));
vectorField& cc = tcc.ref();
auto tcc = tmp<vectorField>::New(size());
auto& cc = tcc.ref();
// get reference to global cell centres
const vectorField& gcc = boundaryMesh_.mesh().cellCentres();
@ -352,8 +352,8 @@ Foam::tmp<Foam::vectorField> Foam::polyPatch::faceCellCentres() const
Foam::tmp<Foam::scalarField> Foam::polyPatch::areaFraction() const
{
tmp<scalarField> tfraction(new scalarField(size()));
scalarField& fraction = tfraction.ref();
auto tfraction = tmp<scalarField>::New(size());
auto& fraction = tfraction.ref();
const vectorField::subField faceAreas = this->faceAreas();
const pointField& points = this->points();

View File

@ -295,44 +295,29 @@ void Foam::interfaceTrackingFvMesh::makeControlPoints()
<< abort(FatalError);
}
IOobject controlPointsHeader
(
"controlPoints",
mesh().time().timeName(),
mesh(),
IOobject::MUST_READ
);
if (controlPointsHeader.typeHeaderOk<vectorIOField>())
{
Info<< "Reading control points" << endl;
controlPointsPtr_ =
new vectorIOField
(
IOobject
IOobject pointsIO
(
"controlPoints",
mesh().time().timeName(),
mesh(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
)
IOobject::AUTO_WRITE,
IOobject::REGISTER
);
if (pointsIO.typeHeaderOk<vectorIOField>())
{
Info<< "Reading control points" << endl;
controlPointsPtr_ = new vectorIOField(pointsIO);
}
else
{
pointsIO.readOpt(IOobject::NO_READ);
Info<< "Creating new control points" << endl;
controlPointsPtr_ =
new vectorIOField
controlPointsPtr_ = new vectorIOField
(
IOobject
(
"controlPoints",
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
pointsIO,
aMesh().areaCentres().internalField()
);

View File

@ -47,8 +47,8 @@ Foam::tmp<Foam::vectorField> Foam::layerAdditionRemoval::extrusionDir() const
const pointField& points = mesh.points();
const labelList& mp = masterFaceLayer.meshPoints();
tmp<vectorField> textrusionDir(new vectorField(mp.size()));
vectorField& extrusionDir = textrusionDir.ref();
auto textrusionDir = tmp<vectorField>::New(mp.size());
auto& extrusionDir = textrusionDir.ref();
if (setLayerPairing())
{

View File

@ -339,8 +339,8 @@ Foam::displacementInterpolationMotionSolver::curPoints() const
<< " points." << exit(FatalError);
}
tmp<pointField> tcurPoints(new pointField(points0()));
pointField& curPoints = tcurPoints.ref();
auto tcurPoints = tmp<pointField>::New(points0());
auto& curPoints = tcurPoints.ref();
// Interpolate the displacement of the face zones.
vectorField zoneDisp(displacements_.size(), Zero);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -338,14 +338,9 @@ void Foam::displacementLayeredMotionMotionSolver::cellZoneSolve
patchi,
new pointVectorField
(
IOobject
mesh().newIOobject
(
mesh().cellZones()[cellZoneI].name() + "_" + fz.name(),
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
mesh().cellZones()[cellZoneI].name() + "_" + fz.name()
),
pointDisplacement_ // to inherit the boundary conditions
)
@ -429,20 +424,18 @@ void Foam::displacementLayeredMotionMotionSolver::cellZoneSolve
if (debug)
{
// Normalised distance
pointScalarField distance
auto tdistance = pointScalarField::New
(
IOobject
IOobject::scopedName
(
mesh().cellZones()[cellZoneI].name() + ":distance",
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
mesh().cellZones()[cellZoneI].name(),
"distance"
),
IOobject::NO_REGISTER,
pointMesh::New(mesh()),
dimensionedScalar(dimLength, Zero)
);
auto& distance = tdistance.ref();
for (const label pointi : isZonePoint)
{

View File

@ -664,8 +664,8 @@ Foam::tmp<Foam::labelField> Foam::pairPatchAgglomeration::agglomerateOneLevel
{
const label nFineFaces = patch.size();
tmp<labelField> tcoarseCellMap(new labelField(nFineFaces, -1));
labelField& coarseCellMap = tcoarseCellMap.ref();
auto tcoarseCellMap = tmp<labelField>::New(nFineFaces, -1);
auto& coarseCellMap = tcoarseCellMap.ref();
const labelListList& faceFaces = patch.faceFaces();

View File

@ -186,8 +186,8 @@ Foam::displacementComponentLaplacianFvMotionSolver::curPoints() const
}
else
{
tmp<pointField> tcurPoints(new pointField(fvMesh_.points()));
pointField& curPoints = tcurPoints.ref();
auto tcurPoints = tmp<pointField>::New(fvMesh_.points());
auto& curPoints = tcurPoints.ref();
curPoints.replace
(

View File

@ -104,7 +104,7 @@ Foam::velocityComponentLaplacianFvMotionSolver::curPoints() const
pointMotionU_
);
tmp<pointField> tcurPoints(new pointField(fvMesh_.points()));
auto tcurPoints = tmp<pointField>::New(fvMesh_.points());
tcurPoints.ref().replace
(

View File

@ -301,28 +301,18 @@ void Foam::surfaceAlignedSBRStressFvMotionSolver::solve()
// Calculate rotations on surface intersection
calculateCellRot();
tmp<volVectorField> tUd
(
new volVectorField
(
IOobject
auto tUd = volVectorField::New
(
"Ud",
fvMesh_.time().timeName(),
fvMesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
IOobject::NO_REGISTER,
fvMesh_,
dimensionedVector(dimLength, Zero),
cellMotionBoundaryTypes<vector>
(
pointDisplacement().boundaryField()
)
)
);
volVectorField& Ud = tUd.ref();
auto& Ud = tUd.ref();
const vectorList& C = fvMesh_.C();
forAll(Ud, i)
@ -346,23 +336,14 @@ void Foam::surfaceAlignedSBRStressFvMotionSolver::solve()
const volTensorField gradD("gradD", fvc::grad(Ud));
tmp<volScalarField> tmu
(
new volScalarField
(
IOobject
auto tmu = volScalarField::New
(
"mu",
fvMesh_.time().timeName(),
fvMesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
IOobject::NO_REGISTER,
fvMesh_,
dimensionedScalar(dimless, Zero)
)
);
volScalarField& mu = tmu.ref();
auto& mu = tmu.ref();
const scalarList& V = fvMesh_.V();
mu.primitiveFieldRef() = (1.0/V);

View File

@ -113,8 +113,8 @@ Foam::tmp<Foam::scalarField> Foam::snappyLayerDriver::avgPointData
const scalarField& pointFld
)
{
tmp<scalarField> tfaceFld(new scalarField(pp.size(), Zero));
scalarField& faceFld = tfaceFld.ref();
auto tfaceFld = tmp<scalarField>::New(pp.size(), Zero);
auto& faceFld = tfaceFld.ref();
forAll(pp.localFaces(), facei)
{

View File

@ -257,8 +257,8 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::smoothInternalDisplacement
// Add coupled contributions
weightedPosition::syncPoints(mesh, sumLocation);
tmp<pointField> tdisplacement(new pointField(mesh.nPoints(), Zero));
pointField& displacement = tdisplacement.ref();
auto tdisplacement = tmp<pointField>::New(mesh.nPoints(), Zero);
auto& displacement = tdisplacement.ref();
label nAdapted = 0;
@ -490,8 +490,8 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::smoothPatchDisplacement
// Displacement to calculate.
tmp<pointField> tpatchDisp(new pointField(meshPoints.size(), Zero));
pointField& patchDisp = tpatchDisp.ref();
auto tpatchDisp = tmp<pointField>::New(meshPoints.size(), Zero);
auto& patchDisp = tpatchDisp.ref();
forAll(pointFaces, i)
{
@ -571,8 +571,8 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::smoothPatchDisplacement
// const labelListList& pointEdges = pp.pointEdges();
// const edgeList& edges = pp.edges();
//
// tmp<pointField> tavg(new pointField(pointEdges.size(), Zero));
// pointField& avg = tavg();
// auto tavg = tmp<pointField>::New(pointEdges.size(), Zero);
// auto& avg = tavg.ref();
//
// forAll(pointEdges, verti)
// {
@ -658,8 +658,8 @@ Foam::tmp<Foam::scalarField> Foam::snappySnapDriver::edgePatchDist
);
// Copy edge values into scalarField
tmp<scalarField> tedgeDist(new scalarField(mesh.nEdges()));
scalarField& edgeDist = tedgeDist.ref();
auto tedgeDist = tmp<scalarField>::New(mesh.nEdges());
auto& edgeDist = tedgeDist.ref();
forAll(allEdgeInfo, edgei)
{
@ -1057,7 +1057,7 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::avgCellCentres
// Add coupled contributions
weightedPosition::syncPoints(mesh, pp.meshPoints(), avgBoundary);
tmp<pointField> tavgBoundary(new pointField(avgBoundary.size()));
auto tavgBoundary = tmp<pointField>::New(avgBoundary.size());
weightedPosition::getPoints(avgBoundary, tavgBoundary.ref());
return tavgBoundary;
@ -1073,8 +1073,8 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::avgCellCentres
// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// // (Ripped from snappyLayerDriver)
//
// tmp<scalarField> tedgeLen(new scalarField(pp.nPoints()));
// scalarField& edgeLen = tedgeLen();
// auto tedgeLen = tmp<scalarField>::New(pp.nPoints());
// auto& edgeLen = tedgeLen.ref();
// {
// const fvMesh& mesh = meshRefiner_.mesh();
// const scalar edge0Len = meshRefiner_.meshCutter().level0EdgeLength();

View File

@ -41,15 +41,8 @@ Foam::cellQuality::cellQuality(const polyMesh& mesh)
Foam::tmp<Foam::scalarField> Foam::cellQuality::nonOrthogonality() const
{
tmp<scalarField> tresult
(
new scalarField
(
mesh_.nCells(), 0.0
)
);
scalarField& result = tresult.ref();
auto tresult = tmp<scalarField>::New(mesh_.nCells(), Zero);
auto& result = tresult.ref();
scalarField sumArea(mesh_.nCells(), Zero);
@ -103,14 +96,8 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::nonOrthogonality() const
Foam::tmp<Foam::scalarField> Foam::cellQuality::skewness() const
{
tmp<scalarField> tresult
(
new scalarField
(
mesh_.nCells(), 0.0
)
);
scalarField& result = tresult.ref();
auto tresult = tmp<scalarField>::New(mesh_.nCells(), Zero);
auto& result = tresult.ref();
scalarField sumArea(mesh_.nCells(), Zero);
@ -182,15 +169,8 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::skewness() const
Foam::tmp<Foam::scalarField> Foam::cellQuality::faceNonOrthogonality() const
{
tmp<scalarField> tresult
(
new scalarField
(
mesh_.nFaces(), 0.0
)
);
scalarField& result = tresult.ref();
auto tresult = tmp<scalarField>::New(mesh_.nFaces(), Zero);
auto& result = tresult.ref();
const vectorField& centres = mesh_.cellCentres();
const vectorField& areas = mesh_.faceAreas();
@ -242,15 +222,8 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceNonOrthogonality() const
Foam::tmp<Foam::scalarField> Foam::cellQuality::faceSkewness() const
{
tmp<scalarField> tresult
(
new scalarField
(
mesh_.nFaces(), 0.0
)
);
scalarField& result = tresult.ref();
auto tresult = tmp<scalarField>::New(mesh_.nFaces(), Zero);
auto& result = tresult.ref();
const vectorField& cellCtrs = mesh_.cellCentres();
const vectorField& faceCtrs = mesh_.faceCentres();

View File

@ -143,8 +143,8 @@ Foam::tmp<Foam::scalarField> Foam::edgeMeshTools::featureProximity
const scalar searchDistance
)
{
tmp<scalarField> tfld(new scalarField(surf.size(), searchDistance));
scalarField& featureProximity = tfld.ref();
auto tfld = tmp<scalarField>::New(surf.size(), searchDistance);
auto& featureProximity = tfld.ref();
Info<< "Extracting proximity of close feature points and "
<< "edges to the surface" << endl;

View File

@ -354,9 +354,8 @@ Foam::tmp<Foam::tensorField> Foam::momentOfInertia::meshInertia
const polyMesh& mesh
)
{
tmp<tensorField> tTf = tmp<tensorField>(new tensorField(mesh.nCells()));
tensorField& tf = tTf.ref();
auto tTf = tmp<tensorField>::New(mesh.nCells());
auto& tf = tTf.ref();
forAll(tf, cI)
{

View File

@ -103,8 +103,8 @@ Foam::triSurfaceTools::writeCloseness
{
Pair<tmp<scalarField>> tpair
(
tmp<scalarField>(new scalarField(surf.size(), GREAT)),
tmp<scalarField>(new scalarField(surf.size(), GREAT))
tmp<scalarField>::New(surf.size(), GREAT),
tmp<scalarField>::New(surf.size(), GREAT)
);
Info<< "Extracting internal and external closeness of surface." << endl;

View File

@ -158,22 +158,15 @@ Foam::cellCellStencil::createField
const UList<Type>& psi
)
{
auto tfld = tmp<volScalarField>::New
(
IOobject
auto tfld = volScalarField::New
(
name,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
IOobject::NO_REGISTER,
mesh,
dimensionedScalar(dimless, Zero),
fvPatchFieldBase::zeroGradientType()
);
volScalarField& fld = tfld.ref();
auto& fld = tfld.ref();
forAll(psi, cellI)
{

View File

@ -585,10 +585,7 @@ template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::oversetFvPatchField<Type>::
patchNeighbourField() const
{
return tmp<Field<Type>>
(
new Field<Type>(this->size(), Zero)
);
return tmp<Field<Type>>::New(this->size(), Zero);
}

View File

@ -195,10 +195,7 @@ public:
const tmp<scalarField>&
) const
{
return tmp<Field<Type>>
(
new Field<Type>(this->size(), Zero)
);
return tmp<Field<Type>>::New(this->size(), Foam::zero{});
}
//- Return the matrix source coefficients corresponding to the
@ -208,30 +205,21 @@ public:
const tmp<scalarField>&
) const
{
return tmp<Field<Type>>
(
new Field<Type>(this->size(), Zero)
);
return tmp<Field<Type>>::New(this->size(), Foam::zero{});
}
//- Return the matrix diagonal coefficients corresponding to the
//- evaluation of the gradient of this patchField
tmp<Field<Type>> gradientInternalCoeffs() const
{
return tmp<Field<Type>>
(
new Field<Type>(this->size(), Zero)
);
return tmp<Field<Type>>::New(this->size(), Foam::zero{});
}
//- Return the matrix source coefficients corresponding to the
//- evaluation of the gradient of this patchField
tmp<Field<Type>> gradientBoundaryCoeffs() const
{
return tmp<Field<Type>>
(
new Field<Type>(this->size(), Zero)
);
return tmp<Field<Type>>::New(this->size(), Foam::zero{});
}
//- Manipulate matrix

View File

@ -238,8 +238,8 @@ Foam::tmp<Foam::pointField> Foam::RBD::rigidBodyMotion::transformPoints
// to the current state in the global frame
spatialTransform X(X0(bodyID).inv() & X00(bodyID));
tmp<pointField> tpoints(new pointField(initialPoints.size()));
pointField& points = tpoints.ref();
auto tpoints = tmp<pointField>::New(initialPoints.size());
auto& points = tpoints.ref();
forAll(points, i)
{
@ -265,8 +265,8 @@ Foam::tmp<Foam::pointField> Foam::RBD::rigidBodyMotion::transformPoints
// interpolation
septernion s(X);
tmp<pointField> tpoints(new pointField(initialPoints));
pointField& points = tpoints.ref();
auto tpoints = tmp<pointField>::New(initialPoints);
auto& points = tpoints.ref();
forAll(points, i)
{
@ -314,8 +314,8 @@ Foam::tmp<Foam::pointField> Foam::RBD::rigidBodyMotion::transformPoints
ss[bi] = septernion(X);
}
tmp<pointField> tpoints(new pointField(initialPoints));
pointField& points = tpoints.ref();
auto tpoints = tmp<pointField>::New(initialPoints);
auto& points = tpoints.ref();
List<scalar> w(ss.size());

View File

@ -224,8 +224,8 @@ Foam::rigidBodyMeshMotion::curPoints() const
}
else
{
tmp<pointField> ttransformedPts(new pointField(mesh().points()));
pointField& transformedPts = ttransformedPts.ref();
auto ttransformedPts = tmp<pointField>::New(mesh().points());
auto& transformedPts = ttransformedPts.ref();
UIndirectList<point>(transformedPts, pointIDs()) =
pointField(newPoints.ref(), pointIDs());

View File

@ -218,14 +218,7 @@ Foam::tmp<Foam::Field<Type>> Foam::meshToMesh::mapSrcToTgt
const CombineOp& cop
) const
{
tmp<Field<Type>> tresult
(
new Field<Type>
(
tgtToSrcCellAddr_.size(),
Zero
)
);
auto tresult = tmp<Field<Type>>::New(tgtToSrcCellAddr_.size(), Zero);
mapSrcToTgt(srcField, cop, tresult.ref());
@ -423,14 +416,7 @@ Foam::tmp<Foam::Field<Type>> Foam::meshToMesh::mapTgtToSrc
const CombineOp& cop
) const
{
tmp<Field<Type>> tresult
(
new Field<Type>
(
srcToTgtCellAddr_.size(),
Zero
)
);
auto tresult = tmp<Field<Type>>::New(srcToTgtCellAddr_.size(), Zero);
mapTgtToSrc(tgtField, cop, tresult.ref());
@ -645,13 +631,13 @@ Foam::meshToMesh::mapSrcToTgt
auto tresult =
tmp<VolumeField<Type>>::New
(
IOobject
tgtMesh.newIOobject
(
type() + ":interpolate(" + field.name() + ")",
tgtMesh.time().timeName(),
tgtMesh,
IOobject::NO_READ,
IOobject::NO_WRITE
IOobject::scopedName
(
type(),
"interpolate(" + field.name() + ")"
)
),
tgtMesh,
field.dimensions(),
@ -876,13 +862,13 @@ Foam::meshToMesh::mapTgtToSrc
auto tresult =
tmp<VolumeField<Type>>::New
(
IOobject
srcMesh.newIOobject
(
type() + ":interpolate(" + field.name() + ")",
srcMesh.time().timeName(),
srcMesh,
IOobject::NO_READ,
IOobject::NO_WRITE
IOobject::scopedName
(
type(),
"interpolate(" + field.name() + ")"
)
),
srcMesh,
field.dimensions(),

View File

@ -464,20 +464,12 @@ void Foam::sampledCuttingPlane::createGeometry()
(
new volScalarField
(
IOobject
(
"cellDistance",
mesh.time().timeName(),
mesh.time(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh.newIOobject("cellDistance"),
mesh,
dimensionedScalar(dimLength, Zero)
)
);
const volScalarField& cellDistance = cellDistancePtr_();
const auto& cellDistance = *cellDistancePtr_;
setDistanceFields(plane_);
@ -485,20 +477,15 @@ void Foam::sampledCuttingPlane::createGeometry()
{
Pout<< "Writing cell distance:" << cellDistance.objectPath() << endl;
cellDistance.write();
pointScalarField pointDist
(
IOobject
auto tpointDist = pointScalarField::New
(
"pointDistance",
mesh.time().timeName(),
mesh.time(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
IOobject::NO_REGISTER,
pointMesh::New(mesh),
dimensionedScalar(dimLength, Zero)
);
auto& pointDist = tpointDist.ref();
pointDist.primitiveFieldRef() = pointDistance_;
Pout<< "Writing point distance:" << pointDist.objectPath() << endl;

View File

@ -393,8 +393,8 @@ Foam::tmp<Foam::pointField> Foam::sixDoFRigidBodyMotion::transform
quaternion(Q().T() & initialQ())
);
tmp<pointField> tpoints(new pointField(initialPoints));
pointField& points = tpoints.ref();
auto tpoints = tmp<pointField>::New(initialPoints);
auto& points = tpoints.ref();
forAll(points, pointi)
{

View File

@ -173,8 +173,8 @@ Foam::sixDoFRigidBodyMotionSolver::curPoints() const
if (!moveAllCells())
{
tmp<pointField> ttransformedPts(new pointField(mesh().points()));
pointField& transformedPts = ttransformedPts.ref();
auto ttransformedPts = tmp<pointField>::New(mesh().points());
auto& transformedPts = ttransformedPts.ref();
UIndirectList<point>(transformedPts, pointIDs()) =
pointField(newPoints.ref(), pointIDs());

View File

@ -275,12 +275,8 @@ bool Foam::linearValveLayersFvMesh::attached() const
Foam::tmp<Foam::pointField> Foam::linearValveLayersFvMesh::newPoints() const
{
tmp<pointField> tnewPoints
(
new pointField(points())
);
pointField& np = tnewPoints();
auto tnewPoints = tmp<pointField>::New(points());
auto& np = tnewPoints();
const word layerPatchName
(

View File

@ -70,8 +70,8 @@ Foam::tmp<Foam::scalarField> Foam::movingConeTopoFvMesh::vertexMarkup
Info<< "Updating vertex markup. curLeft: "
<< curLeft << " curRight: " << curRight << endl;
tmp<scalarField> tvertexMarkup(new scalarField(p.size()));
scalarField& vertexMarkup = tvertexMarkup.ref();
auto tvertexMarkup = tmp<scalarField>::New(p.size());
auto& vertexMarkup = tvertexMarkup.ref();
forAll(p, pI)
{