ENH: remove reliance on the Xfer class (issue #639)

This class is largely a pre-C++11 holdover. It is now possible to
simply use move construct/assignment directly.

In a few rare cases (eg, polyMesh::resetPrimitives) it has been
replaced by an autoPtr.
This commit is contained in:
Mark Olesen
2018-03-05 13:28:53 +01:00
parent 57291e8692
commit 3d608bf06a
241 changed files with 3106 additions and 3971 deletions

View File

@ -56,19 +56,17 @@ bool Foam::cellVolumeWeightMethod::findInitialSeeds
const faceList& srcFaces = src_.faces();
const pointField& srcPts = src_.points();
for (label i = startSeedI; i < srcCellIDs.size(); i++)
for (label i = startSeedI; i < srcCellIDs.size(); ++i)
{
label srcI = srcCellIDs[i];
const label srcI = srcCellIDs[i];
if (mapFlag[srcI])
{
const pointField
pts(srcCells[srcI].points(srcFaces, srcPts).xfer());
const pointField pts(srcCells[srcI].points(srcFaces, srcPts));
forAll(pts, ptI)
for (const point& pt : pts)
{
const point& pt = pts[ptI];
label tgtI = tgt_.cellTree().findInside(pt);
const label tgtI = tgt_.cellTree().findInside(pt);
if (tgtI != -1 && intersect(srcI, tgtI))
{

View File

@ -469,10 +469,10 @@ void Foam::meshToMesh::calculate(const word& methodName, const bool normalise)
tgtRegion_.time(),
IOobject::NO_READ
),
xferMove(newTgtPoints),
xferMove(newTgtFaces),
xferMove(newTgtFaceOwners),
xferMove(newTgtFaceNeighbours),
std::move(newTgtPoints),
std::move(newTgtFaces),
std::move(newTgtFaceOwners),
std::move(newTgtFaceNeighbours),
false // no parallel comms
);

View File

@ -246,17 +246,12 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
}
}
autoPtr<mapDistribute> mapPtr
return autoPtr<mapDistribute>::New
(
new mapDistribute
(
segmentI, // size after construction
sendMap.xfer(),
constructMap.xfer()
)
segmentI, // size after construction
std::move(sendMap),
std::move(constructMap)
);
return mapPtr;
}

View File

@ -466,10 +466,10 @@ const Foam::meshedSurface& Foam::ensightSurfaceReader::geometry()
}
}
surfPtr_.reset(new meshedSurface(xferMove(points), faces.xfer()));
surfPtr_.reset(new meshedSurface(std::move(points), std::move(faces)));
}
return surfPtr_();
return *surfPtr_;
}

View File

@ -53,8 +53,7 @@ Foam::surfMeshSampler::getOrCreateSurfMesh() const
IOobject::NO_READ,
IOobject::NO_WRITE
),
xferCopy(pointField()), // initially no points
xferCopy(faceList()), // initially no faces
meshedSurface(), // Create as empty surface
name()
);
ptr->setWriteOption(IOobject::NO_WRITE);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -1689,19 +1689,21 @@ Foam::isoSurface::isoSurface
}
// Transfer to mesh storage
// Transfer to mesh storage. Note, an iso-surface has no zones
{
// Recover the pointField
pointField pts;
tmpsurf.swapPoints(pts);
// Transcribe from triFace to face
faceList faces;
tmpsurf.triFaceFaces(faces);
// An iso-surface has no zones
surfZoneList zones(0);
tmpsurf.clearOut();
// Reset primitive data (points, faces and zones)
this->MeshStorage::reset
(
tmpsurf.xferPoints(), faces.xfer(), zones.xfer()
);
MeshStorage updated(std::move(pts), std::move(faces), surfZoneList());
this->MeshStorage::transfer(updated);
}
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -616,8 +616,6 @@ void Foam::isoSurfaceCell::genPointTris
const pointField& pts = mesh_.points();
const cell& cFaces = mesh_.cells()[celli];
FixedList<label, 4> tet;
// Make tet from this face to the 4th point (same as cellcentre in
// non-tet cells)
const face& f = mesh_.faces()[facei];
@ -1563,19 +1561,21 @@ Foam::isoSurfaceCell::isoSurfaceCell
}
// Transfer to mesh storage
// Transfer to mesh storage. Note, an iso-surface has no zones
{
// Recover the pointField
pointField pts;
tmpsurf.swapPoints(pts);
// Transcribe from triFace to face
faceList faces;
tmpsurf.triFaceFaces(faces);
// An iso-surface has no zones
surfZoneList zones(0);
tmpsurf.clearOut();
// Reset primitive data (points, faces and zones)
this->MeshStorage::reset
(
tmpsurf.xferPoints(), faces.xfer(), zones.xfer()
);
MeshStorage updated(std::move(pts), std::move(faces), surfZoneList());
this->MeshStorage::transfer(updated);
}
}