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

@ -1,8 +1,5 @@
Info<< "Constructing single cell mesh" << nl << endl; Info<< "Constructing single cell mesh" << nl << endl;
labelList owner(6, label(0));
labelList neighbour(0);
pointField points(8); pointField points(8);
points[0] = vector(0, 0, 0); points[0] = vector(0, 0, 0);
points[1] = vector(1, 0, 0); points[1] = vector(1, 0, 0);
@ -24,10 +21,10 @@ fvMesh mesh
runTime, runTime,
IOobject::READ_IF_PRESENT IOobject::READ_IF_PRESENT
), ),
xferMove<pointField>(points), std::move(points),
faces.xfer(), std::move(faces),
owner.xfer(), labelList(6, Zero), // owner
neighbour.xfer() labelList() // neighbour
); );
List<polyPatch*> patches(1); List<polyPatch*> patches(1);

View File

@ -180,7 +180,7 @@ int main(int argc, char *argv[])
{ {
std::cout<< "iter: " << typeid(*iter).name() << '\n'; std::cout<< "iter: " << typeid(*iter).name() << '\n';
Info<< "elem = " << *(*iter) << endl; // Info<< "elem = " << *(*iter) << endl;
} }
std::cout<< "iter type: " std::cout<< "iter type: "

View File

@ -194,13 +194,13 @@ int main(int argc, char *argv[])
printInfo("dlC", dlC, true); printInfo("dlC", dlC, true);
List<label> lstB(dlC.xfer()); List<label> lstB(std::move(dlC));
Info<< "Transferred to normal list via the xfer() method" << endl; Info<< "Move construct to normal list" << endl;
printInfo("lstB", lstB, true); printInfo("lstB", lstB, true);
printInfo("dlC", dlC, true); printInfo("dlC", dlC, true);
DynamicList<label> dlD(lstB.xfer()); DynamicList<label> dlD(std::move(lstB));
Info<< "Transfer construct from normal list" << endl; Info<< "Transfer construct from normal list" << endl;
printInfo("lstB", lstB, true); printInfo("lstB", lstB, true);
@ -279,7 +279,7 @@ int main(int argc, char *argv[])
Info<< "list in: " << flatOutput(list1) << nl Info<< "list in: " << flatOutput(list1) << nl
<< "list out: " << flatOutput(list2) << endl; << "list out: " << flatOutput(list2) << endl;
input2 = std::move(identity(15)); input2 = identity(15); // don't need std::move() on temporary object
list2 = std::move(input2); list2 = std::move(input2);
Info<< "list in: " << flatOutput(input2) << nl Info<< "list in: " << flatOutput(input2) << nl
<< "list out: " << flatOutput(list2) << endl; << "list out: " << flatOutput(list2) << endl;

View File

@ -102,7 +102,14 @@ int main(int argc, char *argv[])
Info<< "transfer contents to a List" << endl; Info<< "transfer contents to a List" << endl;
IListStream ibuf(obuf.xfer()); IListStream ibuf;
// Reclaim data storage from OListStream -> IListStream
{
List<char> data;
obuf.swap(data);
ibuf.swap(data);
}
Info<< nl; Info<< nl;
Info<< nl << "input string:"; Info<< nl << "input string:";

View File

@ -95,7 +95,7 @@ int main(int argc, char *argv[])
inplaceReverseList(addresses); inplaceReverseList(addresses);
idl1.resetAddressing(addresses.xfer()); idl1.resetAddressing(std::move(addresses));
printInfo(idl1); printInfo(idl1);

View File

@ -190,8 +190,8 @@ int main(int argc, char *argv[])
list2.setSize(10, vector(1, 2, 3)); list2.setSize(10, vector(1, 2, 3));
Info<< "list2: " << list2 << endl; Info<< "list2: " << list2 << endl;
List<vector> list3(list2.xfer()); List<vector> list3(std::move(list2));
Info<< "Transferred via the xfer() method" << endl; Info<< "Move construct" << endl;
Info<< "list2: " << list2 << nl Info<< "list2: " << list2 << nl
<< "list3: " << list3 << endl; << "list3: " << list3 << endl;

View File

@ -129,7 +129,13 @@ int main(int argc, char *argv[])
Info<< "transfer contents to a List or IListStream" << nl; Info<< "transfer contents to a List or IListStream" << nl;
IListStream ibuf(obuf.xfer()); IListStream ibuf;
// Reclaim data storage from OListStream -> IListStream
{
List<char> data;
obuf.swap(data);
ibuf.swap(data);
}
Info<<"original:"; Info<<"original:";
printInfo(obuf); printInfo(obuf);
@ -141,6 +147,7 @@ int main(int argc, char *argv[])
// Create from other storage types // Create from other storage types
List<char> written;
Info<< nl; Info<< nl;
{ {
Info<<"create std::move(List)" << endl; Info<<"create std::move(List)" << endl;
@ -163,35 +170,9 @@ int main(int argc, char *argv[])
toString(Info, list) << endl; toString(Info, list) << endl;
printInfo(buf1); printInfo(buf1);
}
Info<< nl;
List<char> written;
{
Info<<"create List.xfer()" << endl;
List<char> list(16, 'B');
Info<<"input:";
toString(Info, list) << endl;
OListStream buf1(list.xfer());
for (label i = 0; i < 26; ++i)
{
buf1 << char('A' + i);
}
for (label i = 0; i < 26; ++i)
{
buf1 << char('a' +i);
}
Info<<"orig:";
toString(Info, list) << endl;
printInfo(buf1);
// Move back to written // Move back to written
written = buf1.xfer(); buf1.swap(written);
printInfo(buf1); printInfo(buf1);
} }

View File

@ -147,8 +147,8 @@ int main(int argc, char *argv[])
Info<<"list1: " << list1 << endl; Info<<"list1: " << list1 << endl;
PtrList<Scalar> list3(list1.xfer()); PtrList<Scalar> list3(std::move(list1));
Info<< "Transferred via the xfer() method" << endl; Info<<"Move constructed" << endl;
Info<<"list1: " << list1 << nl Info<<"list1: " << list1 << nl
<<"list2: " << list2 << nl <<"list2: " << list2 << nl

View File

@ -71,7 +71,7 @@ int main(int argc, char *argv[])
<< "keys: " << dict1.keys() << nl << "keys: " << dict1.keys() << nl
<< "patterns: " << dict1.keys(true) << endl; << "patterns: " << dict1.keys(true) << endl;
dictionary dict2(dict1.xfer()); dictionary dict2(std::move(dict1));
Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc() << nl Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc() << nl
<< "dict2.toc(): " << dict2.name() << " " << dict2.toc() << "dict2.toc(): " << dict2.name() << " " << dict2.toc()

View File

@ -51,7 +51,9 @@ int main(int argc, char *argv[])
const scalar instanceValue(0.005); const scalar instanceValue(0.005);
IOobject io IOmapDistributePolyMesh map
(
IOobject
( (
"procAddressing", "procAddressing",
instance, instance,
@ -60,10 +62,9 @@ int main(int argc, char *argv[])
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
)
); );
IOmapDistributePolyMesh map(io);
{ {
// Load the instance mesh // Load the instance mesh
runTime.setTime(instanceValue, 0); runTime.setTime(instanceValue, 0);
@ -112,7 +113,6 @@ int main(int argc, char *argv[])
} }
} }
{ {
const mapDistribute& cellMap = map.cellMap(); const mapDistribute& cellMap = map.cellMap();
pointField cc(mesh.cellCentres()); pointField cc(mesh.cellCentres());

View File

@ -91,7 +91,7 @@ int main(int argc, char *argv[])
runTime, runTime,
Foam::IOobject::NO_READ Foam::IOobject::NO_READ
), ),
Xfer<pointField>(points), std::move(points),
shapes, shapes,
boundaryFaces, boundaryFaces,
boundaryPatchNames, boundaryPatchNames,

View File

@ -111,7 +111,7 @@ void testMapDistribute()
} }
// Construct distribute map (destructively) // Construct distribute map (destructively)
mapDistribute map(constructSize, sendMap.xfer(), recvMap.xfer()); mapDistribute map(constructSize, std::move(sendMap), std::move(recvMap));
// Distribute complexData // Distribute complexData
map.distribute(complexData); map.distribute(complexData);

View File

@ -246,15 +246,16 @@ int main(int argc, char *argv[])
writeFaceFaces(localPoints, localFaces, faceFaces); writeFaceFaces(localPoints, localFaces, faceFaces);
} }
// Test construction from Xfer // Move construct
{ {
faceList patchFaces = patch; faceList patchFaces = patch;
pointField allPoints = patch.points(); pointField allPoints = patch.points();
PrimitivePatch<face, List, pointField, point> storedPatch PrimitivePatch<face, List, pointField, point> storedPatch
( (
patchFaces.xfer(), patchFaces,
allPoints.xfer() allPoints,
true
); );
} }

View File

@ -413,9 +413,9 @@ int main(int argc, char *argv[])
surf.writeStats(Info); surf.writeStats(Info);
Info<< endl; Info<< endl;
ModifiableMeshedSurface<face> tsurf(surf.xfer()); ModifiableMeshedSurface<face> tsurf(std::move(surf));
// ModifiableMeshedSurface<face> tsurf; // ModifiableMeshedSurface<face> xtsurf;
// tsurf.reset(surf.xfer()); // xtsurf.transfer(surf);
Info<< "in-progress" << nl; Info<< "in-progress" << nl;
surf.writeStats(Info); surf.writeStats(Info);
@ -515,7 +515,7 @@ int main(int argc, char *argv[])
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
surf.xfer() std::move(surf)
); );
Info<< "writing surfMesh as well: " << surfOut.objectPath() << endl; Info<< "writing surfMesh as well: " << surfOut.objectPath() << endl;
@ -546,7 +546,6 @@ int main(int argc, char *argv[])
surfOut.setInstance(runTime.timeName()); surfOut.setInstance(runTime.timeName());
Info<< "writing surfMesh again well: " << surfOut.objectPath() Info<< "writing surfMesh again well: " << surfOut.objectPath()
<< endl; << endl;
surfOut.write(); surfOut.write();

View File

@ -214,9 +214,9 @@ int main(int argc, char *argv[])
runTime.timeName(), runTime.timeName(),
runTime runTime
), ),
xferCopy(mesh.points()), // could we safely re-use the data? pointField(mesh.points()), // Could we safely re-use the data?
xferCopy(mesh.faces()), faceList(mesh.faces()),
xferCopy(mesh.cells()) cellList(mesh.cells())
); );
// Add the boundary patches // Add the boundary patches

View File

@ -446,11 +446,8 @@ int main(int argc, char *argv[])
const word defaultFacesName = "defaultFaces"; const word defaultFacesName = "defaultFaces";
word defaultFacesType = emptyPolyPatch::typeName; word defaultFacesType = emptyPolyPatch::typeName;
// Create dummy mesh just to find out what are internal/external // Create dummy mesh just to find out what are internal/external faces
// faces auto dummyMesh = autoPtr<polyMesh>::New
autoPtr<polyMesh> dummyMesh
(
new polyMesh
( (
IOobject IOobject
( (
@ -458,15 +455,14 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferCopy(points), pointField(points), // copy
cellShapes, cellShapes,
faceListList(0), faceListList(),
wordList(0), wordList(),
wordList(0), wordList(),
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType,
wordList(0) wordList()
)
); );
@ -605,7 +601,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), std::move(points),
cellShapes, cellShapes,
patchFaces, patchFaces,
patchNames, patchNames,
@ -615,7 +611,7 @@ int main(int argc, char *argv[])
); );
if (cellTypes.size() > 0 || patchNames.size() > 0) if (cellTypes.size() || patchNames.size())
{ {
DynamicList<pointZone*> pz; DynamicList<pointZone*> pz;
DynamicList<faceZone*> fz; DynamicList<faceZone*> fz;

View File

@ -739,7 +739,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), std::move(points),
cellShapes, cellShapes,
boundary, boundary,
patchNames, patchNames,

View File

@ -945,10 +945,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferCopy(pointField()), Zero
xferCopy(faceList()),
xferCopy(labelList()),
xferCopy(labelList())
); );

View File

@ -1175,7 +1175,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), std::move(points),
cellShapes, cellShapes,
patches, patches,
patchNames, patchNames,

View File

@ -853,7 +853,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), std::move(points),
cells, cells,
boundary, boundary,
patchNames, patchNames,

View File

@ -931,7 +931,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), std::move(points),
cells, cells,
boundaryFaces, boundaryFaces,
boundaryPatchNames, boundaryPatchNames,

View File

@ -1128,17 +1128,13 @@ int main(int argc, char *argv[])
<< nl << endl; << nl << endl;
// Create globally numbered surface // Create globally numbered surface
meshedSurface rawSurface meshedSurface rawSurface(polyPoints, boundaryFaces);
(
xferCopy(polyPoints),
xferCopyTo<faceList>(boundaryFaces)
);
// Write locally numbered surface // Write locally numbered surface
meshedSurface meshedSurface
( (
xferCopy(rawSurface.localPoints()), rawSurface.localPoints(),
xferCopy(rawSurface.localFaces()) rawSurface.localFaces()
).write(runTime.path()/"boundaryFaces.obj"); ).write(runTime.path()/"boundaryFaces.obj");
} }
@ -1171,14 +1167,14 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(polyPoints), std::move(polyPoints),
cellVerts, cellVerts,
usedPatchFaceVerts, // boundaryFaces, usedPatchFaceVerts, // boundaryFaces,
usedPatchNames, // boundaryPatchNames, usedPatchNames, // boundaryPatchNames,
wordList(patchNames.size(), polyPatch::typeName), // boundaryPatchTypes, wordList(patchNames.size(), polyPatch::typeName), // boundaryPatchTypes,
"defaultFaces", // defaultFacesName "defaultFaces", // defaultFacesName
polyPatch::typeName, // defaultFacesType, polyPatch::typeName, // defaultFacesType,
wordList(0) // boundaryPatchPhysicalTypes wordList() // boundaryPatchPhysicalTypes
); );
// Remove files now, to ensure all mesh files written are consistent. // Remove files now, to ensure all mesh files written are consistent.

View File

@ -565,7 +565,7 @@ polyMesh pShapeMesh
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), std::move(points),
cellShapes, cellShapes,
boundary, boundary,
patchNames, patchNames,

View File

@ -144,14 +144,14 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), std::move(points),
cells, cells,
faceListList(0), faceListList(),
wordList(0), wordList(),
wordList(0), wordList(),
"defaultFaces", "defaultFaces",
polyPatch::typeName, polyPatch::typeName,
wordList(0) wordList()
); );
// Set the precision of the points data to 10 // Set the precision of the points data to 10

View File

@ -303,7 +303,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), std::move(points),
cells, cells,
patchFaces, patchFaces,
patchNames, patchNames,

View File

@ -247,7 +247,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(newPoints), std::move(newPoints),
cellShapes, cellShapes,
boundary, boundary,
patchNames, patchNames,

View File

@ -318,9 +318,7 @@ int main(int argc, char *argv[])
// Construct mesh with default boundary only // Construct mesh with default boundary only
// //
autoPtr<polyMesh> meshPtr auto meshPtr = autoPtr<polyMesh>::New
(
new polyMesh
( (
IOobject IOobject
( (
@ -328,15 +326,14 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferCopy(points), pointField(points), // Copy of points
cells, cells,
faceListList(0), faceListList(),
wordList(0), // boundaryPatchNames wordList(), // boundaryPatchNames
wordList(0), // boundaryPatchTypes wordList(), // boundaryPatchTypes
"defaultFaces", "defaultFaces",
polyPatch::typeName, polyPatch::typeName,
wordList(0) wordList()
)
); );
const polyMesh& mesh = *meshPtr; const polyMesh& mesh = *meshPtr;
@ -531,7 +528,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), std::move(points),
cells, cells,
patchFaces, patchFaces,
patchNames, patchNames,

View File

@ -68,14 +68,14 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(reader.points()), std::move(reader.points()),
reader.cells(), reader.cells(),
faceListList(0), faceListList(),
wordList(0), wordList(),
wordList(0), wordList(),
"defaultFaces", "defaultFaces",
polyPatch::typeName, polyPatch::typeName,
wordList(0) wordList()
); );
// Set the precision of the points data to 10 // Set the precision of the points data to 10

View File

@ -277,7 +277,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferCopy(blocks.points()), // could we re-use space? pointField(blocks.points()), // Copy, could we re-use space?
blocks.cells(), blocks.cells(),
blocks.patches(), blocks.patches(),
blocks.patchNames(), blocks.patchNames(),

View File

@ -63,7 +63,7 @@ class extrudedMesh
//- Construct and return the extruded mesh points //- Construct and return the extruded mesh points
template<class Face, template<class> class FaceList, class PointField> template<class Face, template<class> class FaceList, class PointField>
Xfer<pointField> extrudedPoints pointField extrudedPoints
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& const extrudeModel&
@ -71,7 +71,7 @@ class extrudedMesh
//- Construct and return the extruded mesh faces //- Construct and return the extruded mesh faces
template<class Face, template<class> class FaceList, class PointField> template<class Face, template<class> class FaceList, class PointField>
Xfer<faceList> extrudedFaces faceList extrudedFaces
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& const extrudeModel&
@ -79,7 +79,7 @@ class extrudedMesh
//- Construct and return the extruded mesh cells //- Construct and return the extruded mesh cells
template<class Face, template<class> class FaceList, class PointField> template<class Face, template<class> class FaceList, class PointField>
Xfer<cellList> extrudedCells cellList extrudedCells
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& const extrudeModel&
@ -87,10 +87,10 @@ class extrudedMesh
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
extrudedMesh(const extrudedMesh&); extrudedMesh(const extrudedMesh&) = delete;
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const extrudedMesh&); void operator=(const extrudedMesh&) = delete;
public: public:

View File

@ -34,7 +34,7 @@ template
template<class> class FaceList, template<class> class FaceList,
class PointField class PointField
> >
Foam::Xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints Foam::pointField Foam::extrudedMesh::extrudedPoints
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& model const extrudeModel& model
@ -47,9 +47,9 @@ Foam::Xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints
pointField ePoints((nLayers + 1)*surfacePoints.size()); pointField ePoints((nLayers + 1)*surfacePoints.size());
for (label layer=0; layer<=nLayers; layer++) for (label layer=0; layer <= nLayers; ++layer)
{ {
label offset = layer*surfacePoints.size(); const label offset = layer*surfacePoints.size();
forAll(surfacePoints, i) forAll(surfacePoints, i)
{ {
@ -62,13 +62,12 @@ Foam::Xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints
} }
} }
// return points for transferring return ePoints;
return xferMove(ePoints);
} }
template<class Face, template<class> class FaceList, class PointField> template<class Face, template<class> class FaceList, class PointField>
Foam::Xfer<Foam::faceList> Foam::extrudedMesh::extrudedFaces Foam::faceList Foam::extrudedMesh::extrudedFaces
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& model const extrudeModel& model
@ -188,13 +187,13 @@ Foam::Xfer<Foam::faceList> Foam::extrudedMesh::extrudedFaces
); );
} }
// return points for transferring
return xferMove(eFaces); return eFaces;
} }
template<class Face, template<class> class FaceList, class PointField> template<class Face, template<class> class FaceList, class PointField>
Foam::Xfer<Foam::cellList> Foam::extrudedMesh::extrudedCells Foam::cellList Foam::extrudedMesh::extrudedCells
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& model const extrudeModel& model
@ -295,8 +294,7 @@ Foam::Xfer<Foam::cellList> Foam::extrudedMesh::extrudedCells
facei++; facei++;
} }
// return points for transferring return eCells;
return xferMove(eCells);
} }

View File

@ -1880,7 +1880,7 @@ int main(int argc, char *argv[])
} }
} }
} }
const primitiveFacePatch extrudePatch(zoneFaces.xfer(), mesh.points()); const primitiveFacePatch extrudePatch(std::move(zoneFaces), mesh.points());
Pstream::listCombineGather(isInternal, orEqOp<bool>()); Pstream::listCombineGather(isInternal, orEqOp<bool>());
@ -2405,10 +2405,7 @@ int main(int argc, char *argv[])
IOobject::AUTO_WRITE, IOobject::AUTO_WRITE,
false false
), ),
xferCopy(pointField()), Zero,
xferCopy(faceList()),
xferCopy(labelList()),
xferCopy(labelList()),
false false
); );

View File

@ -247,7 +247,7 @@ void Foam::patchToPoly2DMesh::addPatchFacesToOwner()
<< nExternalEdges << endl; << nExternalEdges << endl;
} }
owner_ = newOwner.xfer(); owner_.transfer(newOwner);
} }

View File

@ -184,9 +184,7 @@ int main(int argc, char *argv[])
poly2DMesh.createMesh(); poly2DMesh.createMesh();
mesh.reset mesh = autoPtr<polyMesh>::New
(
new polyMesh
( (
IOobject IOobject
( (
@ -197,11 +195,10 @@ int main(int argc, char *argv[])
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
xferMove(poly2DMesh.points()), std::move(poly2DMesh.points()),
xferMove(poly2DMesh.faces()), std::move(poly2DMesh.faces()),
xferMove(poly2DMesh.owner()), std::move(poly2DMesh.owner()),
xferMove(poly2DMesh.neighbour()) std::move(poly2DMesh.neighbour())
)
); );
Info<< "Constructing patches." << endl; Info<< "Constructing patches." << endl;
@ -224,9 +221,7 @@ int main(int argc, char *argv[])
} }
else if (surfaceFormat == POLYMESH2D) else if (surfaceFormat == POLYMESH2D)
{ {
mesh.reset mesh = autoPtr<polyMesh>::New
(
new polyMesh
( (
Foam::IOobject Foam::IOobject
( (
@ -235,7 +230,6 @@ int main(int argc, char *argv[])
runTimeExtruded, runTimeExtruded,
Foam::IOobject::MUST_READ Foam::IOobject::MUST_READ
) )
)
); );
} }

View File

@ -141,14 +141,11 @@ autoPtr<mapDistribute> buildMap
List<Map<label>> compactMap; List<Map<label>> compactMap;
return autoPtr<mapDistribute> return autoPtr<mapDistribute>::New
(
new mapDistribute
( (
globalIndexing, globalIndexing,
pointPoints, pointPoints,
compactMap compactMap
)
); );
} }

View File

@ -593,9 +593,7 @@ Foam::DelaunayMesh<Triangulation>::createMesh
Info<< "Creating mesh" << endl; Info<< "Creating mesh" << endl;
autoPtr<polyMesh> meshPtr auto meshPtr = autoPtr<polyMesh>::New
(
new polyMesh
( (
IOobject IOobject
( (
@ -605,11 +603,10 @@ Foam::DelaunayMesh<Triangulation>::createMesh
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
xferMove(points), std::move(points),
xferMove(faces), std::move(faces),
xferMove(owner), std::move(owner),
xferMove(neighbour) std::move(neighbour)
)
); );
Info<< "Adding patches" << endl; Info<< "Adding patches" << endl;

View File

@ -105,14 +105,11 @@ Foam::DistributedDelaunayMesh<Triangulation>::buildMap
} }
} }
return autoPtr<mapDistribute> return autoPtr<mapDistribute>::New
(
new mapDistribute
( (
constructSize, constructSize,
sendMap.xfer(), std::move(sendMap),
constructMap.xfer() std::move(constructMap)
)
); );
} }

View File

@ -36,9 +36,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(backgroundMeshDecomposition, 0); defineTypeNameAndDebug(backgroundMeshDecomposition, 0);
} }
@ -114,14 +112,11 @@ Foam::autoPtr<Foam::mapDistribute> Foam::backgroundMeshDecomposition::buildMap
} }
} }
return autoPtr<mapDistribute> return autoPtr<mapDistribute>::New
(
new mapDistribute
( (
constructSize, constructSize,
sendMap.xfer(), std::move(sendMap),
constructMap.xfer() std::move(constructMap)
)
); );
} }

View File

@ -727,9 +727,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
labelList cellToDelaunayVertex(removeUnusedCells(owner, neighbour)); labelList cellToDelaunayVertex(removeUnusedCells(owner, neighbour));
cellCentres = pointField(cellCentres, cellToDelaunayVertex); cellCentres = pointField(cellCentres, cellToDelaunayVertex);
autoPtr<polyMesh> meshPtr auto meshPtr = autoPtr<polyMesh>::New
(
new polyMesh
( (
IOobject IOobject
( (
@ -739,11 +737,10 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
xferCopy(pts), pointField(pts), // Copy of points
xferMove(faces), std::move(faces),
xferMove(owner), std::move(owner),
xferMove(neighbour) std::move(neighbour)
)
); );
polyMesh& pMesh = meshPtr(); polyMesh& pMesh = meshPtr();

View File

@ -404,16 +404,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::conformalVoronoiMesh::createDummyMesh
const PtrList<dictionary>& patchDicts const PtrList<dictionary>& patchDicts
) const ) const
{ {
autoPtr<fvMesh> meshPtr auto meshPtr = autoPtr<fvMesh>::New(io, Zero);
(
new fvMesh
(
io,
xferCopy(pointField()),
xferCopy(faceList()),
xferCopy(cellList())
)
);
fvMesh& mesh = meshPtr(); fvMesh& mesh = meshPtr();
List<polyPatch*> patches(patchDicts.size()); List<polyPatch*> patches(patchDicts.size());
@ -827,10 +818,10 @@ void Foam::conformalVoronoiMesh::writeMesh
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
xferMove(points), std::move(points),
xferMove(faces), std::move(faces),
xferMove(owner), std::move(owner),
xferMove(neighbour) std::move(neighbour)
); );
Info<< indent << "Adding patches to mesh" << endl; Info<< indent << "Adding patches to mesh" << endl;

View File

@ -282,12 +282,10 @@ autoPtr<polyMesh> generateHexMesh
word defaultFacesType = polyPatch::typeName; word defaultFacesType = polyPatch::typeName;
wordList patchPhysicalTypes(0); wordList patchPhysicalTypes(0);
return autoPtr<polyMesh> return autoPtr<polyMesh>::New
(
new polyMesh
( (
io, io,
xferMoveTo<pointField>(points), std::move(points),
cellShapes, cellShapes,
boundary, boundary,
patchNames, patchNames,
@ -295,7 +293,6 @@ autoPtr<polyMesh> generateHexMesh
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType,
patchPhysicalTypes patchPhysicalTypes
)
); );
} }

View File

@ -152,10 +152,10 @@ int main(int argc, char *argv[])
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
xferMove(poly2DMesh.points()), std::move(poly2DMesh.points()),
xferMove(poly2DMesh.faces()), std::move(poly2DMesh.faces()),
xferMove(poly2DMesh.owner()), std::move(poly2DMesh.owner()),
xferMove(poly2DMesh.neighbour()) std::move(poly2DMesh.neighbour())
); );
Info<< "Constructing patches." << endl; Info<< "Constructing patches." << endl;

View File

@ -204,7 +204,7 @@ Foam::shortEdgeFilter2D::shortEdgeFilter2D
points2D.clear(); points2D.clear();
ms_ = MeshedSurface<face>(xferMove(points), xferMove(faces)); ms_ = MeshedSurface<face>(std::move(points), std::move(faces));
Info<< "Meshed surface stats before edge filtering :" << endl; Info<< "Meshed surface stats before edge filtering :" << endl;
ms_.writeStats(Info); ms_.writeStats(Info);
@ -533,12 +533,7 @@ Foam::shortEdgeFilter2D::filter()
newFaces.setSize(newFacei); newFaces.setSize(newFacei);
MeshedSurface<face> fMesh MeshedSurface<face> fMesh(std::move(newPoints), std::move(newFaces));
(
xferMove(newPoints),
xferMove(newFaces),
xferCopy(List<surfZone>())
);
updateEdgeRegionMap updateEdgeRegionMap
( (

View File

@ -476,7 +476,7 @@ void extractSurface
// Gather all ZoneIDs // Gather all ZoneIDs
List<labelList> gatheredZones(Pstream::nProcs()); List<labelList> gatheredZones(Pstream::nProcs());
gatheredZones[Pstream::myProcNo()] = compactZones.xfer(); gatheredZones[Pstream::myProcNo()].transfer(compactZones);
Pstream::gatherList(gatheredZones); Pstream::gatherList(gatheredZones);
// On master combine all points, faces, zones // On master combine all points, faces, zones
@ -515,10 +515,10 @@ void extractSurface
UnsortedMeshedSurface<face> unsortedFace UnsortedMeshedSurface<face> unsortedFace
( (
xferMove(allPoints), std::move(allPoints),
xferMove(allFaces), std::move(allFaces),
xferMove(allZones), std::move(allZones),
xferMove(surfZones) surfZones
); );

View File

@ -353,12 +353,12 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
Info<< "Mirroring cell shapes." << endl; Info<< "Mirroring cell shapes." << endl;
Info<< nl << "Creating new mesh" << endl; Info<< nl << "Creating new mesh" << endl;
mirrorMeshPtr_ = new fvMesh mirrorMeshPtr_ = autoPtr<fvMesh>::New
( (
io, io,
xferMove(newPoints), std::move(newPoints),
xferMove(newFaces), std::move(newFaces),
xferMove(newCells) std::move(newCells)
); );
fvMesh& pMesh = *mirrorMeshPtr_; fvMesh& pMesh = *mirrorMeshPtr_;
@ -381,10 +381,4 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::mirrorFvMesh::~mirrorFvMesh()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -55,21 +55,20 @@ class mirrorFvMesh
IOdictionary mirrorMeshDict_; IOdictionary mirrorMeshDict_;
//- Mirrored mesh //- Mirrored mesh
fvMesh* mirrorMeshPtr_; autoPtr<fvMesh> mirrorMeshPtr_;
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct //- Disallow copy construct
mirrorFvMesh(const mirrorFvMesh&); mirrorFvMesh(const mirrorFvMesh&) = delete;
//- Disallow default bitwise assignment //- Disallow copy assignment
void operator=(const mirrorFvMesh&); void operator=(const mirrorFvMesh&) = delete;
public: public:
// Constructors // Constructors
//- Construct from IOobject //- Construct from IOobject
@ -77,7 +76,7 @@ public:
//- Destructor //- Destructor
~mirrorFvMesh(); ~mirrorFvMesh() = default;
// Member Functions // Member Functions

View File

@ -461,10 +461,10 @@ autoPtr<mapPolyMesh> reorderMesh
mesh.resetPrimitives mesh.resetPrimitives
( (
Xfer<pointField>::null(), autoPtr<pointField>(), // <- null: leaves points untouched
xferMove(newFaces), autoPtr<faceList>::New(std::move(newFaces)),
xferMove(newOwner), autoPtr<labelList>::New(std::move(newOwner)),
xferMove(newNeighbour), autoPtr<labelList>::New(std::move(newNeighbour)),
patchSizes, patchSizes,
patchStarts, patchStarts,
true true

View File

@ -521,7 +521,7 @@ int main(int argc, char *argv[])
( (
cutZoneName, cutZoneName,
true // verbose true // verbose
).resetAddressing(faceIds.xfer(), false); ).resetAddressing(std::move(faceIds), false);
// Add the perfect interface mesh modifier // Add the perfect interface mesh modifier
@ -551,7 +551,7 @@ int main(int argc, char *argv[])
( (
mergePatchName + "MasterZone", mergePatchName + "MasterZone",
true // verbose true // verbose
).resetAddressing(faceIds.xfer(), false); ).resetAddressing(std::move(faceIds), false);
// Markup slave face ids // Markup slave face ids
faceIds.setSize(slavePatch.size()); faceIds.setSize(slavePatch.size());
@ -561,7 +561,7 @@ int main(int argc, char *argv[])
( (
mergePatchName + "SlaveZone", mergePatchName + "SlaveZone",
true // verbose true // verbose
).resetAddressing(faceIds.xfer(), false); ).resetAddressing(std::move(faceIds), false);
// Add empty zone for cut faces // Add empty zone for cut faces
mesh.faceZones() mesh.faceZones()

View File

@ -340,9 +340,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
curPointLabels curPointLabels
); );
procMeshPtr.reset procMeshPtr = autoPtr<polyMesh>::New
(
new polyMesh
( (
IOobject IOobject
( (
@ -350,17 +348,14 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
facesInstance(), facesInstance(),
processorDb processorDb
), ),
xferMove(facesInstancePoints), std::move(facesInstancePoints),
xferMove(procFaces), std::move(procFaces),
xferMove(procCells) std::move(procCells)
)
); );
} }
else else
{ {
procMeshPtr.reset procMeshPtr = autoPtr<polyMesh>::New
(
new polyMesh
( (
IOobject IOobject
( (
@ -368,10 +363,9 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
facesInstance(), facesInstance(),
processorDb processorDb
), ),
xferMove(procPoints), std::move(procPoints),
xferMove(procFaces), std::move(procFaces),
xferMove(procCells) std::move(procCells)
)
); );
} }
polyMesh& procMesh = procMeshPtr(); polyMesh& procMesh = procMeshPtr();
@ -751,7 +745,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
xferMove(procPoints) std::move(procPoints)
); );
pointsInstancePoints.write(); pointsInstancePoints.write();
} }

View File

@ -652,9 +652,7 @@ int main(int argc, char *argv[])
runTime, runTime,
IOobject::NO_READ IOobject::NO_READ
), ),
xferCopy(pointField()), Zero
xferCopy(faceList()),
xferCopy(cellList())
) )
); );

View File

@ -166,15 +166,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
// Create dummy mesh. Only used on procs that don't have mesh. // Create dummy mesh. Only used on procs that don't have mesh.
IOobject noReadIO(io); IOobject noReadIO(io);
noReadIO.readOpt() = IOobject::NO_READ; noReadIO.readOpt() = IOobject::NO_READ;
fvMesh dummyMesh fvMesh dummyMesh(noReadIO, Zero, false);
(
noReadIO,
xferCopy(pointField()),
xferCopy(faceList()),
xferCopy(labelList()),
xferCopy(labelList()),
false
);
// Add patches // Add patches
List<polyPatch*> patches(patchEntries.size()); List<polyPatch*> patches(patchEntries.size());
@ -261,8 +253,8 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
// parallel // parallel
//Pout<< "Reading mesh from " << io.objectPath() << endl; //Pout<< "Reading mesh from " << io.objectPath() << endl;
autoPtr<fvMesh> meshPtr(new fvMesh(io)); auto meshPtr = autoPtr<fvMesh>::New(io);
fvMesh& mesh = meshPtr(); fvMesh& mesh = *meshPtr;

View File

@ -279,15 +279,11 @@ Foam::parLagrangianRedistributor::redistributeLagrangianPositions
} }
// Construct map return autoPtr<mapDistributeBase>::New
return autoPtr<mapDistributeBase>
(
new mapDistributeBase
( (
constructSize, constructSize,
subMap.xfer(), std::move(subMap),
constructMap.xfer() std::move(constructMap)
)
); );
} }

View File

@ -125,7 +125,7 @@ void Foam::parLagrangianRedistributor::redistributeLagrangianFields
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
xferMove<Field<Type>>(field) std::move(field)
).write(); ).write();
} }
} }
@ -212,7 +212,7 @@ void Foam::parLagrangianRedistributor::redistributeLagrangianFieldFields
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
xferMove<Field<Field<Type>>>(field) std::move(field)
).write(); ).write();
} }
} }
@ -309,7 +309,7 @@ void Foam::parLagrangianRedistributor::redistributeStoredLagrangianFields
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
xferMove<Field<typename Container::value_type>>(field) std::move(field)
).write(); ).write();
} }
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / 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 License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -1353,10 +1353,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
//} //}
return autoPtr<mapDistributePolyMesh> return autoPtr<mapDistributePolyMesh>::New(std::move(map));
(
new mapDistributePolyMesh(map.xfer())
);
} }
@ -1407,7 +1404,7 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
autoPtr<mapDistributePolyMesh> mapPtr; autoPtr<mapDistributePolyMesh> mapPtr;
if (baseMeshPtr.valid() && baseMeshPtr().nCells()) //baseMeshPtr.valid()) if (baseMeshPtr.valid() && baseMeshPtr().nCells())
{ {
const fvMesh& baseMesh = baseMeshPtr(); const fvMesh& baseMesh = baseMeshPtr();
@ -1417,8 +1414,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
mapDistribute cellMap mapDistribute cellMap
( (
baseMesh.nCells(), baseMesh.nCells(),
cellSubMap.xfer(), std::move(cellSubMap),
cellAddressing.xfer() std::move(cellAddressing)
); );
labelListList faceSubMap(Pstream::nProcs()); labelListList faceSubMap(Pstream::nProcs());
@ -1427,8 +1424,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
mapDistribute faceMap mapDistribute faceMap
( (
baseMesh.nFaces(), baseMesh.nFaces(),
faceSubMap.xfer(), std::move(faceSubMap),
faceAddressing.xfer(), std::move(faceAddressing),
false, //subHasFlip false, //subHasFlip
true //constructHasFlip true //constructHasFlip
); );
@ -1439,8 +1436,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
mapDistribute pointMap mapDistribute pointMap
( (
baseMesh.nPoints(), baseMesh.nPoints(),
pointSubMap.xfer(), std::move(pointSubMap),
pointAddressing.xfer() std::move(pointAddressing)
); );
labelListList patchSubMap(Pstream::nProcs()); labelListList patchSubMap(Pstream::nProcs());
@ -1451,8 +1448,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
mapDistribute patchMap mapDistribute patchMap
( (
baseMesh.boundaryMesh().size(), baseMesh.boundaryMesh().size(),
patchSubMap.xfer(), std::move(patchSubMap),
boundaryAddressing.xfer() std::move(boundaryAddressing)
); );
const label nOldPoints = mesh.nPoints(); const label nOldPoints = mesh.nPoints();
@ -1475,12 +1472,12 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
nOldPoints, nOldPoints,
nOldFaces, nOldFaces,
nOldCells, nOldCells,
oldPatchStarts.xfer(), std::move(oldPatchStarts),
oldPatchNMeshPoints.xfer(), std::move(oldPatchNMeshPoints),
pointMap.xfer(), std::move(pointMap),
faceMap.xfer(), std::move(faceMap),
cellMap.xfer(), std::move(cellMap),
patchMap.xfer() std::move(patchMap)
) )
); );
} }
@ -1493,8 +1490,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
mapDistribute cellMap mapDistribute cellMap
( (
0, 0,
cellSubMap.xfer(), std::move(cellSubMap),
cellConstructMap.xfer() std::move(cellConstructMap)
); );
labelListList faceSubMap(Pstream::nProcs()); labelListList faceSubMap(Pstream::nProcs());
@ -1504,8 +1501,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
mapDistribute faceMap mapDistribute faceMap
( (
0, 0,
faceSubMap.xfer(), std::move(faceSubMap),
faceConstructMap.xfer(), std::move(faceConstructMap),
false, //subHasFlip false, //subHasFlip
true //constructHasFlip true //constructHasFlip
); );
@ -1517,8 +1514,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
mapDistribute pointMap mapDistribute pointMap
( (
0, 0,
pointSubMap.xfer(), std::move(pointSubMap),
pointConstructMap.xfer() std::move(pointConstructMap)
); );
labelListList patchSubMap(Pstream::nProcs()); labelListList patchSubMap(Pstream::nProcs());
@ -1530,8 +1527,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
mapDistribute patchMap mapDistribute patchMap
( (
0, 0,
patchSubMap.xfer(), std::move(patchSubMap),
patchConstructMap.xfer() std::move(patchConstructMap)
); );
const label nOldPoints = mesh.nPoints(); const label nOldPoints = mesh.nPoints();
@ -1554,12 +1551,12 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
nOldPoints, nOldPoints,
nOldFaces, nOldFaces,
nOldCells, nOldCells,
oldPatchStarts.xfer(), std::move(oldPatchStarts),
oldPatchNMeshPoints.xfer(), std::move(oldPatchNMeshPoints),
pointMap.xfer(), std::move(pointMap),
faceMap.xfer(), std::move(faceMap),
cellMap.xfer(), std::move(cellMap),
patchMap.xfer() std::move(patchMap)
) )
); );
} }
@ -1587,7 +1584,6 @@ void readProcAddressing
//{ //{
// Pout<< "Reading addressing from " << io.name() << " at " // Pout<< "Reading addressing from " << io.name() << " at "
// << mesh.facesInstance() << nl << endl; // << mesh.facesInstance() << nl << endl;
// distMap.clear();
// distMap.reset(new IOmapDistributePolyMesh(io)); // distMap.reset(new IOmapDistributePolyMesh(io));
//} //}
//else //else
@ -1604,7 +1600,7 @@ void readProcAddressing
mesh, mesh,
IOobject::READ_IF_PRESENT IOobject::READ_IF_PRESENT
), ),
labelList(0) labelList()
); );
labelIOList faceProcAddressing labelIOList faceProcAddressing
( (
@ -1616,7 +1612,7 @@ void readProcAddressing
mesh, mesh,
IOobject::READ_IF_PRESENT IOobject::READ_IF_PRESENT
), ),
labelList(0) labelList()
); );
labelIOList pointProcAddressing labelIOList pointProcAddressing
( (
@ -1628,7 +1624,7 @@ void readProcAddressing
mesh, mesh,
IOobject::READ_IF_PRESENT IOobject::READ_IF_PRESENT
), ),
labelList(0) labelList()
); );
labelIOList boundaryProcAddressing labelIOList boundaryProcAddressing
( (
@ -1640,7 +1636,7 @@ void readProcAddressing
mesh, mesh,
IOobject::READ_IF_PRESENT IOobject::READ_IF_PRESENT
), ),
labelList(0) labelList()
); );
@ -2580,7 +2576,7 @@ int main(int argc, char *argv[])
runTime, runTime,
IOobject::READ_IF_PRESENT IOobject::READ_IF_PRESENT
), ),
labelList(0) labelList()
); );
if if
( (

View File

@ -49,7 +49,7 @@ Foam::tmp<Foam::Field<Type>> Foam::readParticleField
if (obj != nullptr) if (obj != nullptr)
{ {
IOField<Type> newField(*obj); IOField<Type> newField(*obj);
return tmp<Field<Type>>::New(newField.xfer()); return tmp<Field<Type>>::New(std::move(newField));
} }
FatalErrorInFunction FatalErrorInFunction
@ -77,7 +77,7 @@ void Foam::readFields
{ {
Info<< " reading field " << fieldNames[j] << endl; Info<< " reading field " << fieldNames[j] << endl;
IOField<Type> newField(*obj); IOField<Type> newField(*obj);
values.set(j, new List<Type>(newField.xfer())); values.set(j, new List<Type>(std::move(newField)));
} }
else else
{ {

View File

@ -865,7 +865,7 @@ int main(int argc, char *argv[])
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
globalFaceFaces std::move(globalFaceFaces)
); );
IOglobalFaceFaces.write(); IOglobalFaceFaces.write();
@ -881,7 +881,7 @@ int main(int argc, char *argv[])
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
visibleFaceFaces std::move(visibleFaceFaces)
); );
IOvisibleFaceFaces.write(); IOvisibleFaceFaces.write();
@ -895,7 +895,7 @@ int main(int argc, char *argv[])
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
map.xfer() std::move(map)
); );
IOmapDist.write(); IOmapDist.write();

View File

@ -287,7 +287,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
surf.xfer() std::move(surf)
); );

View File

@ -364,7 +364,7 @@ int main(int argc, char *argv[])
// Gather all ZoneIDs // Gather all ZoneIDs
List<labelList> gatheredZones(Pstream::nProcs()); List<labelList> gatheredZones(Pstream::nProcs());
gatheredZones[Pstream::myProcNo()] = compactZones.xfer(); gatheredZones[Pstream::myProcNo()].transfer(compactZones);
Pstream::gatherList(gatheredZones); Pstream::gatherList(gatheredZones);
// On master combine all points, faces, zones // On master combine all points, faces, zones
@ -404,10 +404,10 @@ int main(int argc, char *argv[])
UnsortedMeshedSurface<face> unsortedFace UnsortedMeshedSurface<face> unsortedFace
( (
xferMove(allPoints), std::move(allPoints),
xferMove(allFaces), std::move(allFaces),
xferMove(allZones), std::move(allZones),
xferMove(surfZones) surfZones
); );

View File

@ -80,7 +80,7 @@ void Foam::searchableSurfaceModifiers::cut::triangulate
patchI patchI
); );
} }
cutSurf = triSurface(tris.xfer(), patches, pts.xfer()); cutSurf = triSurface(tris, patches, pts, true);
} }
@ -331,12 +331,12 @@ bool Foam::searchableSurfaceModifiers::cut::modify
{ {
if (volTypes[i] == volumeType::INSIDE) if (volTypes[i] == volumeType::INSIDE)
{ {
nInside++; ++nInside;
} }
} }
// Add a patch for inside the box // Add a patch for inside the box
if (nInside > 0 && surf3.patches().size() > 0) if (nInside && surf3.patches().size() > 0)
{ {
geometricSurfacePatchList newPatches(surf3.patches()); geometricSurfacePatchList newPatches(surf3.patches());
label sz = newPatches.size(); label sz = newPatches.size();
@ -362,7 +362,7 @@ bool Foam::searchableSurfaceModifiers::cut::modify
} }
} }
pointField newPoints(surf3.points()); pointField newPoints(surf3.points());
surf = triSurface(newTris.xfer(), newPatches, newPoints.xfer()); surf = triSurface(newTris, newPatches, newPoints, true);
changed = true; changed = true;
} }

View File

@ -104,12 +104,12 @@ Foam::treeDataCell::treeDataCell
( (
const bool cacheBb, const bool cacheBb,
const polyMesh& mesh, const polyMesh& mesh,
const Xfer<labelList>& cellLabels, labelList&& cellLabels,
const polyMesh::cellDecomposition decompMode const polyMesh::cellDecomposition decompMode
) )
: :
mesh_(mesh), mesh_(mesh),
cellLabels_(cellLabels), cellLabels_(std::move(cellLabels)),
cacheBb_(cacheBb), cacheBb_(cacheBb),
decompMode_(decompMode) decompMode_(decompMode)
{ {

View File

@ -137,21 +137,21 @@ public:
// Constructors // Constructors
//- Construct from mesh and subset of cells. //- Construct from mesh, copying subset of cells.
treeDataCell treeDataCell
( (
const bool cacheBb, const bool cacheBb,
const polyMesh&, const polyMesh& mesh,
const labelUList&, const labelUList& cellLabels,
const polyMesh::cellDecomposition decompMode const polyMesh::cellDecomposition decompMode
); );
//- Construct from mesh and subset of cells, transferring contents //- Construct from mesh, moving subset of cells
treeDataCell treeDataCell
( (
const bool cacheBb, const bool cacheBb,
const polyMesh&, const polyMesh& mesh,
const Xfer<labelList>&, labelList&& cellLabels,
const polyMesh::cellDecomposition decompMode const polyMesh::cellDecomposition decompMode
); );
@ -159,7 +159,7 @@ public:
treeDataCell treeDataCell
( (
const bool cacheBb, const bool cacheBb,
const polyMesh&, const polyMesh& mesh,
const polyMesh::cellDecomposition decompMode const polyMesh::cellDecomposition decompMode
); );

View File

@ -73,7 +73,7 @@ public:
( (
const UList<T>& posList, const UList<T>& posList,
const UList<T>& negList, const UList<T>& negList,
const Xfer<List<label>>& addr List<label>&& addr
); );
@ -99,9 +99,11 @@ public:
// Edit // Edit
//- Reset addressing //- Copy reset addressing
inline void resetAddressing(const labelUList& addr); inline void resetAddressing(const labelUList& addr);
inline void resetAddressing(const Xfer<List<label>>& addr);
//- Move reset addressing
inline void resetAddressing(List<label>&& addr);
// Member Operators // Member Operators

View File

@ -60,12 +60,12 @@ inline Foam::BiIndirectList<T>::BiIndirectList
( (
const UList<T>& posList, const UList<T>& posList,
const UList<T>& negList, const UList<T>& negList,
const Xfer<List<label>>& addr List<label>&& addr
) )
: :
posList_(const_cast<UList<T>&>(posList)), posList_(const_cast<UList<T>&>(posList)),
negList_(const_cast<UList<T>&>(negList)), negList_(const_cast<UList<T>&>(negList)),
addressing_(addr) addressing_(std::move(addr))
{} {}
@ -120,10 +120,10 @@ inline void Foam::BiIndirectList<T>::resetAddressing
template<class T> template<class T>
inline void Foam::BiIndirectList<T>::resetAddressing inline void Foam::BiIndirectList<T>::resetAddressing
( (
const Xfer<List<label>>& addr List<label>&& addr
) )
{ {
addressing_.transfer(addr()); addressing_.transfer(addr);
} }

View File

@ -99,16 +99,6 @@ Foam::CompactListList<T, Container>::CompactListList
} }
template<class T, class Container>
Foam::CompactListList<T, Container>::CompactListList
(
const Xfer<CompactListList<T, Container>>& lst
)
{
transfer(lst());
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T, class Container> template<class T, class Container>

View File

@ -125,9 +125,6 @@ public:
//- Move construct //- Move construct
inline CompactListList(CompactListList<T, Container>&& lst); inline CompactListList(CompactListList<T, Container>&& lst);
//- Construct by transferring the parameter contents
explicit CompactListList(const Xfer<CompactListList<T, Container>>&);
//- Construct as copy or re-use as specified. //- Construct as copy or re-use as specified.
inline CompactListList(CompactListList<T, Container>& lst, bool reuse); inline CompactListList(CompactListList<T, Container>& lst, bool reuse);
@ -202,9 +199,6 @@ public:
// into this CompactListList and annul the argument list. // into this CompactListList and annul the argument list.
void transfer(CompactListList<T, Container>& lst); void transfer(CompactListList<T, Container>& lst);
//- Transfer the contents to the Xfer container
inline Xfer<CompactListList<T, Container>> xfer();
// Other // Other

View File

@ -196,14 +196,6 @@ inline Foam::label Foam::CompactListList<T, Container>::whichColumn
} }
template<class T, class Container>
inline Foam::Xfer<Foam::CompactListList<T, Container>>
Foam::CompactListList<T, Container>::xfer()
{
return xferMove(*this);
}
template<class T, class Container> template<class T, class Container>
inline void Foam::CompactListList<T, Container>::resize(const label mRows) inline void Foam::CompactListList<T, Container>::resize(const label mRows)
{ {

View File

@ -152,9 +152,6 @@ public:
//- Construct from UIndirectList. Size set to UIndirectList size. //- Construct from UIndirectList. Size set to UIndirectList size.
explicit inline DynamicList(const UIndirectList<T>& lst); explicit inline DynamicList(const UIndirectList<T>& lst);
//- Transfer (move) construct
explicit inline DynamicList(const Xfer<List<T>>& lst);
//- Move construct. //- Move construct.
inline DynamicList(DynamicList<T, SizeMin>&& lst); inline DynamicList(DynamicList<T, SizeMin>&& lst);
@ -242,10 +239,6 @@ public:
//- Transfer contents of the argument SortableList into this. //- Transfer contents of the argument SortableList into this.
inline void transfer(SortableList<T>& lst); inline void transfer(SortableList<T>& lst);
//- Transfer contents to the Xfer container as a plain List
inline Xfer<List<T>> xfer();
//- Append an element to the end of this list. //- Append an element to the end of this list.
inline DynamicList<T, SizeMin>& append(const T& val); inline DynamicList<T, SizeMin>& append(const T& val);
@ -375,6 +368,7 @@ public:
Istream& is, Istream& is,
DynamicList<T, SizeMin>& lst DynamicList<T, SizeMin>& lst
); );
}; };

View File

@ -177,17 +177,6 @@ inline Foam::DynamicList<T, SizeMin>::DynamicList
{} {}
template<class T, int SizeMin>
inline Foam::DynamicList<T, SizeMin>::DynamicList
(
const Xfer<List<T>>& lst
)
:
List<T>(lst),
capacity_(List<T>::size())
{}
template<class T, int SizeMin> template<class T, int SizeMin>
inline Foam::DynamicList<T, SizeMin>::DynamicList inline Foam::DynamicList<T, SizeMin>::DynamicList
( (
@ -470,14 +459,6 @@ Foam::DynamicList<T, SizeMin>::transfer
} }
template<class T, int SizeMin>
inline Foam::Xfer<Foam::List<T>>
Foam::DynamicList<T, SizeMin>::xfer()
{
return xferMoveTo<List<T>>(*this);
}
template<class T, int SizeMin> template<class T, int SizeMin>
inline Foam::DynamicList<T, SizeMin>& inline Foam::DynamicList<T, SizeMin>&
Foam::DynamicList<T, SizeMin>::append Foam::DynamicList<T, SizeMin>::append

View File

@ -76,7 +76,7 @@ protected:
explicit inline IndirectListAddressing(const labelUList& addr); explicit inline IndirectListAddressing(const labelUList& addr);
//- Construct by transferring addressing array //- Construct by transferring addressing array
explicit inline IndirectListAddressing(const Xfer<List<label>>& addr); explicit inline IndirectListAddressing(List<label>&& addr);
// Member Functions // Member Functions
@ -84,9 +84,11 @@ protected:
//- Return the list addressing //- Return the list addressing
inline const List<label>& addressing() const; inline const List<label>& addressing() const;
//- Reset addressing //- Copy reset addressing
inline void resetAddressing(const labelUList& addr); inline void resetAddressing(const labelUList& addr);
inline void resetAddressing(const Xfer<List<label>>& addr);
//- Move reset addressing
inline void resetAddressing(List<label>&& addr);
}; };
@ -125,7 +127,7 @@ public:
inline IndirectList inline IndirectList
( (
const UList<T>& completeList, const UList<T>& completeList,
const Xfer<List<label>>& addr List<label>&& addr
); );
//- Copy constructor //- Copy constructor

View File

@ -36,10 +36,10 @@ inline Foam::IndirectListAddressing::IndirectListAddressing
inline Foam::IndirectListAddressing::IndirectListAddressing inline Foam::IndirectListAddressing::IndirectListAddressing
( (
const Xfer<List<label>>& addr List<label>&& addr
) )
: :
addressing_(addr) addressing_(std::move(addr))
{} {}
@ -63,10 +63,10 @@ template<class T>
inline Foam::IndirectList<T>::IndirectList inline Foam::IndirectList<T>::IndirectList
( (
const UList<T>& completeList, const UList<T>& completeList,
const Xfer<List<label>>& addr List<label>&& addr
) )
: :
IndirectListAddressing(addr), IndirectListAddressing(std::move(addr)),
UIndirectList<T> UIndirectList<T>
( (
completeList, completeList,
@ -125,10 +125,10 @@ inline void Foam::IndirectListAddressing::resetAddressing
inline void Foam::IndirectListAddressing::resetAddressing inline void Foam::IndirectListAddressing::resetAddressing
( (
const Xfer<List<label>>& addr List<label>&& addr
) )
{ {
addressing_.transfer(addr()); addressing_.transfer(addr);
} }

View File

@ -305,13 +305,6 @@ Foam::List<T>::List(std::initializer_list<T> lst)
{} {}
template<class T>
Foam::List<T>::List(const Xfer<List<T>>& lst)
{
transfer(lst());
}
template<class T> template<class T>
Foam::List<T>::List(List<T>&& lst) Foam::List<T>::List(List<T>&& lst)
: :
@ -513,10 +506,13 @@ void Foam::List<T>::operator=(const SLList<T>& lst)
if (len) if (len)
{ {
List_ACCESS(T, (*this), vp);
label i = 0; label i = 0;
for (auto iter = lst.cbegin(); iter != lst.cend(); ++iter) for (auto iter = lst.cbegin(); iter != lst.cend(); ++iter)
{ {
this->operator[](i++) = *iter; vp[i] = *iter;
++i;
} }
} }
} }
@ -617,9 +613,14 @@ void Foam::List<T>::operator=(SLList<T>&& lst)
reAlloc(len); reAlloc(len);
if (len)
{
List_ACCESS(T, (*this), vp);
for (label i = 0; i < len; ++i) for (label i = 0; i < len; ++i)
{ {
this->operator[](i) = std::move(lst.removeHead()); vp[i] = std::move(lst.removeHead());
}
} }
lst.clear(); lst.clear();

View File

@ -43,7 +43,6 @@ SourceFiles
#include "UList.H" #include "UList.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "one.H" #include "one.H"
#include "Xfer.H"
#include "SLListFwd.H" #include "SLListFwd.H"
#include <initializer_list> #include <initializer_list>
@ -173,9 +172,6 @@ public:
//- Construct from an initializer list //- Construct from an initializer list
List(std::initializer_list<T> lst); List(std::initializer_list<T> lst);
//- Transfer (move) construct
List(const Xfer<List<T>>& lst);
//- Move construct from List //- Move construct from List
List(List<T>&& lst); List(List<T>&& lst);
@ -250,9 +246,6 @@ public:
//- and annul the argument list //- and annul the argument list
void transfer(SortableList<T>& lst); void transfer(SortableList<T>& lst);
//- Transfer contents to the Xfer container
inline Xfer<List<T>> xfer();
//- Return subscript-checked element of UList and resizing the list //- Return subscript-checked element of UList and resizing the list
//- if required. //- if required.
inline T& newElmt(const label i); inline T& newElmt(const label i);
@ -310,6 +303,7 @@ public:
Istream& is, Istream& is,
List<T>& L List<T>& L
); );
}; };

View File

@ -149,13 +149,6 @@ inline T& Foam::List<T>::newElmt(const label i)
} }
template<class T>
inline Foam::Xfer<Foam::List<T>> Foam::List<T>::xfer()
{
return xferMove(*this);
}
template<class T> template<class T>
inline void Foam::List<T>::append(const T& val) inline void Foam::List<T>::append(const T& val)
{ {

View File

@ -57,13 +57,6 @@ Foam::PtrList<T>::PtrList(const PtrList<T>& lst, const CloneArg& cloneArg)
} }
template<class T>
Foam::PtrList<T>::PtrList(const Xfer<PtrList<T>>& lst)
{
transfer(lst());
}
template<class T> template<class T>
Foam::PtrList<T>::PtrList(PtrList<T>& lst, bool reuse) Foam::PtrList<T>::PtrList(PtrList<T>& lst, bool reuse)
: :

View File

@ -98,9 +98,6 @@ public:
template<class CloneArg> template<class CloneArg>
PtrList(const PtrList<T>& lst, const CloneArg& cloneArg); PtrList(const PtrList<T>& lst, const CloneArg& cloneArg);
//- Construct by transferring the parameter contents
PtrList(const Xfer<PtrList<T>>& lst);
//- Construct as copy or re-use as specified //- Construct as copy or re-use as specified
PtrList(PtrList<T>& lst, bool reuse); PtrList(PtrList<T>& lst, bool reuse);
@ -144,9 +141,6 @@ public:
//- Transfer into this list and annul the argument list //- Transfer into this list and annul the argument list
inline void transfer(PtrList<T>& lst); inline void transfer(PtrList<T>& lst);
//- Transfer contents to the Xfer container
inline Xfer<PtrList<T>> xfer();
//- Return true if element is set (ie, not a nullptr) //- Return true if element is set (ie, not a nullptr)
inline bool set(const label i) const; inline bool set(const label i) const;
@ -175,6 +169,7 @@ public:
//- Read PtrList from Istream, discarding contents of existing PtrList //- Read PtrList from Istream, discarding contents of existing PtrList
friend Istream& operator>> <T>(Istream& is, PtrList<T>& lst); friend Istream& operator>> <T>(Istream& is, PtrList<T>& lst);
}; };

View File

@ -111,13 +111,6 @@ inline void Foam::PtrList<T>::transfer(PtrList<T>& lst)
} }
template<class T>
inline Foam::Xfer<Foam::PtrList<T>> Foam::PtrList<T>::xfer()
{
return xferMove(*this);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T> template<class T>

View File

@ -80,15 +80,6 @@ Foam::SortableList<T>::SortableList(List<T>&& values)
} }
template<class T>
Foam::SortableList<T>::SortableList(const Xfer<List<T>>& values)
:
List<T>(values)
{
sort();
}
template<class T> template<class T>
template<class InputIterator> template<class InputIterator>
inline Foam::SortableList<T>::SortableList inline Foam::SortableList<T>::SortableList
@ -158,13 +149,6 @@ void Foam::SortableList<T>::swap(SortableList<T>& lst)
} }
template<class T>
Foam::Xfer<Foam::List<T>> Foam::SortableList<T>::xfer()
{
return xferMoveTo<List<T>>(*this);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T> template<class T>
@ -195,7 +179,7 @@ template<class T>
inline void Foam::SortableList<T>::operator=(List<T>&& lst) inline void Foam::SortableList<T>::operator=(List<T>&& lst)
{ {
indices_.clear(); indices_.clear();
List<T>::operator=(std::move(lst)); List<T>::transfer(lst);
} }

View File

@ -95,9 +95,6 @@ public:
//- Construct from an initializer list, sorting immediately //- Construct from an initializer list, sorting immediately
SortableList(std::initializer_list<T> values); SortableList(std::initializer_list<T> values);
//- Construct from transferred List, sorting immediately
explicit SortableList(const Xfer<List<T>>& values);
// Member Functions // Member Functions
@ -129,9 +126,6 @@ public:
//- Swap content with another SortableList in constant time //- Swap content with another SortableList in constant time
inline void swap(SortableList<T>& lst); inline void swap(SortableList<T>& lst);
//- Transfer contents to the Xfer container as a plain List
inline Xfer<List<T>> xfer();
// Member Operators // Member Operators
@ -152,6 +146,7 @@ public:
//- Assignment to an initializer list //- Assignment to an initializer list
void operator=(std::initializer_list<T> lst); void operator=(std::initializer_list<T> lst);
}; };

View File

@ -99,7 +99,7 @@ public:
UPtrList() = default; UPtrList() = default;
//- Construct with specified size, each element initialized to nullptr //- Construct with specified size, each element initialized to nullptr
explicit inline UPtrList(const label nElem); explicit inline UPtrList(const label len);
//- Construct from PtrList, copying addresses of each list element. //- Construct from PtrList, copying addresses of each list element.
// The argument is non-const access since this UPtrList can be used // The argument is non-const access since this UPtrList can be used
@ -109,9 +109,6 @@ public:
//- Construct from UList, taking addresses of each list element //- Construct from UList, taking addresses of each list element
explicit UPtrList(UList<T>& lst); explicit UPtrList(UList<T>& lst);
//- Construct by transferring the parameter contents
inline UPtrList(const Xfer<UPtrList<T>>& lst);
//- Construct as copy or re-use as specified //- Construct as copy or re-use as specified
inline UPtrList(UPtrList<T>& lst, bool reuse); inline UPtrList(UPtrList<T>& lst, bool reuse);
@ -167,9 +164,6 @@ public:
//- Transfer contents into this list and annul the argument //- Transfer contents into this list and annul the argument
inline void transfer(UPtrList<T>& lst); inline void transfer(UPtrList<T>& lst);
//- Transfer contents to the Xfer container
inline Xfer<UPtrList<T>> xfer();
//- Return true if element is set (ie, not a nullptr) //- Return true if element is set (ie, not a nullptr)
inline bool set(const label i) const; inline bool set(const label i) const;
@ -326,6 +320,7 @@ public:
//- Write UPtrList to Ostream //- Write UPtrList to Ostream
friend Ostream& operator<< <T>(Ostream& os, const UPtrList<T>& lst); friend Ostream& operator<< <T>(Ostream& os, const UPtrList<T>& lst);
}; };

View File

@ -26,9 +26,9 @@ License
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class T> template<class T>
inline Foam::UPtrList<T>::UPtrList(const label nElem) inline Foam::UPtrList<T>::UPtrList(const label len)
: :
ptrs_(nElem, reinterpret_cast<T*>(0)) ptrs_(len, reinterpret_cast<T*>(0))
{} {}
@ -46,13 +46,6 @@ inline Foam::UPtrList<T>::UPtrList(UPtrList<T>&& lst)
{} {}
template<class T>
inline Foam::UPtrList<T>::UPtrList(const Xfer<UPtrList<T>>& lst)
{
transfer(lst());
}
template<class T> template<class T>
inline Foam::UPtrList<T>::UPtrList(UPtrList<T>& lst, bool reuse) inline Foam::UPtrList<T>::UPtrList(UPtrList<T>& lst, bool reuse)
: :
@ -175,13 +168,6 @@ inline T* Foam::UPtrList<T>::set(const label i, T* ptr)
} }
template<class T>
inline Foam::Xfer<Foam::UPtrList<T>> Foam::UPtrList<T>::xfer()
{
return xferMove(*this);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T> template<class T>
@ -190,9 +176,8 @@ inline const T& Foam::UPtrList<T>::operator[](const label i) const
if (!ptrs_[i]) if (!ptrs_[i])
{ {
FatalErrorInFunction FatalErrorInFunction
<< "hanging pointer at index " << i << "cannot dereference nullptr at index " << i
<< " (size " << size() << " (size " << size() << ")"
<< "), cannot dereference"
<< abort(FatalError); << abort(FatalError);
} }
@ -206,9 +191,8 @@ inline T& Foam::UPtrList<T>::operator[](const label i)
if (!ptrs_[i]) if (!ptrs_[i])
{ {
FatalErrorInFunction FatalErrorInFunction
<< "hanging pointer at index " << i << "cannot dereference nullptr at index " << i
<< " (size " << size() << " (size " << size() << ")"
<< "), cannot dereference"
<< abort(FatalError); << abort(FatalError);
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -127,7 +127,7 @@ template<class T, class BaseType>
Foam::CompactIOField<T, BaseType>::CompactIOField Foam::CompactIOField<T, BaseType>::CompactIOField
( (
const IOobject& io, const IOobject& io,
const Field<T>& list const UList<T>& content
) )
: :
regIOobject(io) regIOobject(io)
@ -142,7 +142,7 @@ Foam::CompactIOField<T, BaseType>::CompactIOField
} }
else else
{ {
Field<T>::operator=(list); Field<T>::operator=(content);
} }
} }
@ -151,12 +151,12 @@ template<class T, class BaseType>
Foam::CompactIOField<T, BaseType>::CompactIOField Foam::CompactIOField<T, BaseType>::CompactIOField
( (
const IOobject& io, const IOobject& io,
const Xfer<Field<T>>& list Field<T>&& content
) )
: :
regIOobject(io) regIOobject(io)
{ {
Field<T>::transfer(list()); Field<T>::transfer(content);
if if
( (
@ -169,14 +169,6 @@ Foam::CompactIOField<T, BaseType>::CompactIOField
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T, class BaseType>
Foam::CompactIOField<T, BaseType>::~CompactIOField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T, class BaseType> template<class T, class BaseType>
@ -191,22 +183,20 @@ bool Foam::CompactIOField<T, BaseType>::writeObject
if (fmt == IOstream::ASCII) if (fmt == IOstream::ASCII)
{ {
// Change type to be non-compact format type // Change type to be non-compact format type
const word oldTypeName = typeName; const word oldTypeName(typeName);
const_cast<word&>(typeName) = IOField<T>::typeName; const_cast<word&>(typeName) = IOField<T>::typeName;
bool good = regIOobject::writeObject(fmt, ver, cmp, valid); bool good = regIOobject::writeObject(IOstream::ASCII, ver, cmp, valid);
// Change type back // Change type back
const_cast<word&>(typeName) = oldTypeName; const_cast<word&>(typeName) = oldTypeName;
return good; return good;
} }
else
{
return regIOobject::writeObject(fmt, ver, cmp, valid); return regIOobject::writeObject(fmt, ver, cmp, valid);
} }
}
template<class T, class BaseType> template<class T, class BaseType>
@ -228,13 +218,6 @@ void Foam::CompactIOField<T, BaseType>::operator=
} }
template<class T, class BaseType>
void Foam::CompactIOField<T, BaseType>::operator=(const Field<T>& rhs)
{
Field<T>::operator=(rhs);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class T, class BaseType> template<class T, class BaseType>

View File

@ -47,7 +47,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of friend functions and operators // Forward declarations
template<class T, class BaseType> class CompactIOField; template<class T, class BaseType> class CompactIOField;
template<class T, class BaseType> Istream& operator>> template<class T, class BaseType> Istream& operator>>
@ -85,28 +85,30 @@ public:
// Constructors // Constructors
//- Default copy construct
CompactIOField(const CompactIOField&) = default;
//- Construct from IOobject //- Construct from IOobject
CompactIOField(const IOobject&); explicit CompactIOField(const IOobject& io);
//- Construct from IOobject; does local processor require reading? //- Construct from IOobject; does local processor require reading?
CompactIOField(const IOobject&, const bool valid); CompactIOField(const IOobject& io, const bool valid);
//- Construct from IOobject and size //- Construct from IOobject and size
CompactIOField(const IOobject&, const label); CompactIOField(const IOobject& io, const label size);
//- Construct from IOobject and a Field //- Construct from IOobject and a List/Field content
CompactIOField(const IOobject&, const Field<T>&); CompactIOField(const IOobject& io, const UList<T>& content);
//- Construct by transferring the Field contents //- Construct by transferring the Field contents
CompactIOField(const IOobject&, const Xfer<Field<T>>&); CompactIOField(const IOobject& io, Field<T>&& content);
// Destructor //- Destructor
virtual ~CompactIOField() = default;
virtual ~CompactIOField();
// Member functions // Member Functions
virtual bool writeObject virtual bool writeObject
( (
@ -116,14 +118,16 @@ public:
const bool valid const bool valid
) const; ) const;
virtual bool writeData(Ostream&) const; virtual bool writeData(Ostream& os) const;
// Member operators // Member Operators
void operator=(const CompactIOField<T, BaseType>&); //- Copy assignment of entries
void operator=(const CompactIOField<T, BaseType>& rhs);
void operator=(const Field<T>&); //- Copy or move assignment of entries
using Field<T>::operator=;
}; };

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -61,7 +61,7 @@ bool Foam::CompactIOList<T, BaseType>::overflows() const
label size = 0; label size = 0;
forAll(*this, i) forAll(*this, i)
{ {
label oldSize = size; const label oldSize = size;
size += this->operator[](i).size(); size += this->operator[](i).size();
if (size < oldSize) if (size < oldSize)
{ {
@ -94,7 +94,7 @@ template<class T, class BaseType>
Foam::CompactIOList<T, BaseType>::CompactIOList Foam::CompactIOList<T, BaseType>::CompactIOList
( (
const IOobject& io, const IOobject& io,
const label size const label len
) )
: :
regIOobject(io) regIOobject(io)
@ -109,7 +109,7 @@ Foam::CompactIOList<T, BaseType>::CompactIOList
} }
else else
{ {
List<T>::setSize(size); List<T>::setSize(len);
} }
} }
@ -118,7 +118,7 @@ template<class T, class BaseType>
Foam::CompactIOList<T, BaseType>::CompactIOList Foam::CompactIOList<T, BaseType>::CompactIOList
( (
const IOobject& io, const IOobject& io,
const List<T>& list const UList<T>& content
) )
: :
regIOobject(io) regIOobject(io)
@ -133,7 +133,7 @@ Foam::CompactIOList<T, BaseType>::CompactIOList
} }
else else
{ {
List<T>::operator=(list); List<T>::operator=(content);
} }
} }
@ -142,12 +142,12 @@ template<class T, class BaseType>
Foam::CompactIOList<T, BaseType>::CompactIOList Foam::CompactIOList<T, BaseType>::CompactIOList
( (
const IOobject& io, const IOobject& io,
const Xfer<List<T>>& list List<T>&& content
) )
: :
regIOobject(io) regIOobject(io)
{ {
List<T>::transfer(list()); List<T>::transfer(content);
if if
( (
@ -160,14 +160,6 @@ Foam::CompactIOList<T, BaseType>::CompactIOList
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T, class BaseType>
Foam::CompactIOList<T, BaseType>::~CompactIOList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T, class BaseType> template<class T, class BaseType>
@ -233,13 +225,6 @@ void Foam::CompactIOList<T, BaseType>::operator=
} }
template<class T, class BaseType>
void Foam::CompactIOList<T, BaseType>::operator=(const List<T>& rhs)
{
List<T>::operator=(rhs);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class T, class BaseType> template<class T, class BaseType>
@ -293,7 +278,7 @@ Foam::Ostream& Foam::operator<<
start[0] = 0; start[0] = 0;
for (label i = 1; i < start.size(); i++) for (label i = 1; i < start.size(); i++)
{ {
label prev = start[i-1]; const label prev = start[i-1];
start[i] = prev+L[i-1].size(); start[i] = prev+L[i-1].size();
if (start[i] < prev) if (start[i] < prev)

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -47,10 +47,9 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations
class Istream; class Istream;
class Ostream; class Ostream;
// Forward declaration of friend functions and operators
template<class T, class BaseType> class CompactIOList; template<class T, class BaseType> class CompactIOList;
template<class T, class BaseType> Istream& operator>> template<class T, class BaseType> Istream& operator>>
@ -90,25 +89,27 @@ public:
// Constructors // Constructors
//- Default copy construct
CompactIOList(const CompactIOList&) = default;
//- Construct from IOobject //- Construct from IOobject
CompactIOList(const IOobject&); explicit CompactIOList(const IOobject& io);
//- Construct from IOobject and size of CompactIOList //- Construct from IOobject and default length of CompactIOList
CompactIOList(const IOobject&, const label); CompactIOList(const IOobject& io, const label len);
//- Construct from IOobject and a List //- Construct from IOobject and List content
CompactIOList(const IOobject&, const List<T>&); CompactIOList(const IOobject& io, const UList<T>& content);
//- Construct by transferring the List contents
CompactIOList(const IOobject&, const Xfer<List<T>>&);
//- Construct by transferring the List content
CompactIOList(const IOobject& io, List<T>&& content);
// Destructor // Destructor
virtual ~CompactIOList(); virtual ~CompactIOList() = default;
// Member functions // Member Functions
virtual bool writeObject virtual bool writeObject
( (
@ -121,11 +122,13 @@ public:
virtual bool writeData(Ostream&) const; virtual bool writeData(Ostream&) const;
// Member operators // Member Operators
void operator=(const CompactIOList<T, BaseType>&); //- Copy assignment of entries
void operator=(const CompactIOList<T, BaseType>& rhs);
void operator=(const List<T>&); //- Copy or move assignment of entries
using List<T>::operator=;
// IOstream operators // IOstream operators

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -58,7 +58,7 @@ template<class Type>
Foam::GlobalIOField<Type>::GlobalIOField Foam::GlobalIOField<Type>::GlobalIOField
( (
const IOobject& io, const IOobject& io,
const Field<Type>& f const UList<Type>& content
) )
: :
regIOobject(io) regIOobject(io)
@ -68,7 +68,7 @@ Foam::GlobalIOField<Type>::GlobalIOField
if (!readHeaderOk(IOstream::BINARY, typeName)) if (!readHeaderOk(IOstream::BINARY, typeName))
{ {
Field<Type>::operator=(f); Field<Type>::operator=(content);
} }
} }
@ -77,7 +77,7 @@ template<class Type>
Foam::GlobalIOField<Type>::GlobalIOField Foam::GlobalIOField<Type>::GlobalIOField
( (
const IOobject& io, const IOobject& io,
const Xfer<Field<Type>>& f Field<Type>&& content
) )
: :
regIOobject(io) regIOobject(io)
@ -85,17 +85,38 @@ Foam::GlobalIOField<Type>::GlobalIOField
// Check for MUST_READ_IF_MODIFIED // Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOField<Type>>(); warnNoRereading<GlobalIOField<Type>>();
Field<Type>::transfer(f()); Field<Type>::transfer(content);
readHeaderOk(IOstream::BINARY, typeName); readHeaderOk(IOstream::BINARY, typeName);
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::GlobalIOField<Type>::~GlobalIOField() Foam::GlobalIOField<Type>::GlobalIOField
{} (
const IOobject& io,
const tmp<Field<Type>>& tfld
)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOField<Type>>();
const bool reuse = tfld.movable();
if (reuse)
{
Field<Type>::transfer(tfld.ref());
}
if (!readHeaderOk(IOstream::BINARY, typeName))
{
Field<Type>::operator=(tfld());
}
tfld.clear();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -124,11 +145,4 @@ void Foam::GlobalIOField<Type>::operator=(const GlobalIOField<Type>& rhs)
} }
template<class Type>
void Foam::GlobalIOField<Type>::operator=(const Field<Type>& rhs)
{
Field<Type>::operator=(rhs);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -61,24 +61,30 @@ public:
// Constructors // Constructors
//- Default copy construct
GlobalIOField(const GlobalIOField&) = default;
//- Construct from IOobject //- Construct from IOobject
GlobalIOField(const IOobject&); explicit GlobalIOField(const IOobject& io);
//- Construct from IOobject and size (does not set values) //- Construct from IOobject and size (does not set values)
GlobalIOField(const IOobject&, const label size); GlobalIOField(const IOobject& io, const label size);
//- Construct from components //- Construct from IOobject and a List/Field content
GlobalIOField(const IOobject&, const Field<Type>&); GlobalIOField(const IOobject& io, const UList<Type>& content);
//- Construct by transferring the Field contents //- Construct by transferring the Field content
GlobalIOField(const IOobject&, const Xfer<Field<Type>>&); GlobalIOField(const IOobject& io, Field<Type>&& content);
//- Construct by copying/moving tmp content
GlobalIOField(const IOobject& io, const tmp<Field<Type>>& tf);
//- Destructor //- Destructor
virtual ~GlobalIOField(); virtual ~GlobalIOField() = default;
// Member functions // Member Functions
//- Is object global //- Is object global
virtual bool global() const virtual bool global() const
@ -87,24 +93,27 @@ public:
} }
//- Return complete path + object name if the file exists //- Return complete path + object name if the file exists
// either in the case/processor or case otherwise null //- either in the case/processor or case, otherwise null
virtual fileName filePath() const virtual fileName filePath() const
{ {
return globalFilePath(type()); return globalFilePath(type());
} }
//- ReadData function required for regIOobject read operation //- The readData method for regIOobject read operation
virtual bool readData(Istream&); virtual bool readData(Istream& is);
//- WriteData function required for regIOobject write operation //- The writeData method for regIOobject write operation
bool writeData(Ostream&) const; bool writeData(Ostream& os) const;
// Member operators // Member Operators
void operator=(const GlobalIOField<Type>&); //- Copy assignment of entries
void operator=(const GlobalIOField<Type>& rhs);
//- Copy or move assignment of entries
using Field<Type>::operator=;
void operator=(const Field<Type>&);
}; };

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -55,7 +55,11 @@ Foam::GlobalIOList<Type>::GlobalIOList(const IOobject& io, const label size)
template<class Type> template<class Type>
Foam::GlobalIOList<Type>::GlobalIOList(const IOobject& io, const List<Type>& f) Foam::GlobalIOList<Type>::GlobalIOList
(
const IOobject& io,
const UList<Type>& content
)
: :
regIOobject(io) regIOobject(io)
{ {
@ -64,7 +68,7 @@ Foam::GlobalIOList<Type>::GlobalIOList(const IOobject& io, const List<Type>& f)
if (!readHeaderOk(IOstream::BINARY, typeName)) if (!readHeaderOk(IOstream::BINARY, typeName))
{ {
List<Type>::operator=(f); List<Type>::operator=(content);
} }
} }
@ -73,7 +77,7 @@ template<class Type>
Foam::GlobalIOList<Type>::GlobalIOList Foam::GlobalIOList<Type>::GlobalIOList
( (
const IOobject& io, const IOobject& io,
const Xfer<List<Type>>& f List<Type>&& content
) )
: :
regIOobject(io) regIOobject(io)
@ -81,19 +85,12 @@ Foam::GlobalIOList<Type>::GlobalIOList
// Check for MUST_READ_IF_MODIFIED // Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOList<Type>>(); warnNoRereading<GlobalIOList<Type>>();
List<Type>::transfer(f()); List<Type>::transfer(content);
readHeaderOk(IOstream::BINARY, typeName); readHeaderOk(IOstream::BINARY, typeName);
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class Type>
Foam::GlobalIOList<Type>::~GlobalIOList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
@ -120,11 +117,4 @@ void Foam::GlobalIOList<Type>::operator=(const GlobalIOList<Type>& rhs)
} }
template<class Type>
void Foam::GlobalIOList<Type>::operator=(const List<Type>& rhs)
{
List<Type>::operator=(rhs);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -53,7 +53,6 @@ class GlobalIOList
public regIOobject, public regIOobject,
public List<Type> public List<Type>
{ {
public: public:
TypeName("List"); TypeName("List");
@ -61,24 +60,27 @@ public:
// Constructors // Constructors
//- Construct from IOobject //- Default copy construct
GlobalIOList(const IOobject&); GlobalIOList(const GlobalIOList&) = default;
//- Construct from IOobject //- Construct from IOobject
GlobalIOList(const IOobject&, const label size); explicit GlobalIOList(const IOobject& io);
//- Construct from IOobject
GlobalIOList(const IOobject& io, const label size);
//- Construct from IOobject and a List //- Construct from IOobject and a List
GlobalIOList(const IOobject&, const List<Type>&); GlobalIOList(const IOobject& io, const UList<Type>& content);
//- Construct by transferring the List contents //- Construct by transferring the List content
GlobalIOList(const IOobject&, const Xfer<List<Type>>&); GlobalIOList(const IOobject& io, List<Type>&& content);
//- Destructor //- Destructor
virtual ~GlobalIOList(); virtual ~GlobalIOList() = default;
// Member functions // Member Functions
//- Is object global //- Is object global
virtual bool global() const virtual bool global() const
@ -93,18 +95,20 @@ public:
return globalFilePath(type()); return globalFilePath(type());
} }
//- ReadData function required for regIOobject read operation //- The readData method for regIOobject read operation
virtual bool readData(Istream&); virtual bool readData(Istream& is);
//- WriteData function required for regIOobject write operation //- The writeData method for regIOobject write operation
bool writeData(Ostream&) const; bool writeData(Ostream& os) const;
// Member operators // Member Operators
void operator=(const GlobalIOList<Type>&); //- Copy assignment of entries
void operator=(const GlobalIOList<Type>& rhs);
void operator=(const List<Type>&); //- Copy or move assignment of entries
using List<Type>::operator=;
}; };

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -115,7 +115,7 @@ Foam::IOField<Type>::IOField(const IOobject& io, const label size)
template<class Type> template<class Type>
Foam::IOField<Type>::IOField(const IOobject& io, const Field<Type>& f) Foam::IOField<Type>::IOField(const IOobject& io, const UList<Type>& content)
: :
regIOobject(io) regIOobject(io)
{ {
@ -136,20 +136,20 @@ Foam::IOField<Type>::IOField(const IOobject& io, const Field<Type>& f)
} }
else else
{ {
Field<Type>::operator=(f); Field<Type>::operator=(content);
} }
} }
template<class Type> template<class Type>
Foam::IOField<Type>::IOField(const IOobject& io, const Xfer<Field<Type>>& f) Foam::IOField<Type>::IOField(const IOobject& io, Field<Type>&& content)
: :
regIOobject(io) regIOobject(io)
{ {
// Check for MUST_READ_IF_MODIFIED // Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOField<Type>>(); warnNoRereading<IOField<Type>>();
Field<Type>::transfer(f()); Field<Type>::transfer(content);
if if
( (
@ -166,11 +166,38 @@ Foam::IOField<Type>::IOField(const IOobject& io, const Xfer<Field<Type>>& f)
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::IOField<Type>::~IOField() Foam::IOField<Type>::IOField(const IOobject& io, const tmp<Field<Type>>& tfld)
{} :
regIOobject(io)
{
const bool reuse = tfld.movable();
if (reuse)
{
Field<Type>::transfer(tfld.ref());
}
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
close();
}
else if (!reuse)
{
Field<Type>::operator=(tfld());
}
tfld.clear();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -190,11 +217,4 @@ void Foam::IOField<Type>::operator=(const IOField<Type>& rhs)
} }
template<class Type>
void Foam::IOField<Type>::operator=(const Field<Type>& rhs)
{
Field<Type>::operator=(rhs);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -53,7 +53,6 @@ class IOField
public regIOobject, public regIOobject,
public Field<Type> public Field<Type>
{ {
public: public:
TypeName("Field"); TypeName("Field");
@ -61,36 +60,44 @@ public:
// Constructors // Constructors
//- Default copy construct
IOField(const IOField&) = default;
//- Construct from IOobject //- Construct from IOobject
IOField(const IOobject&); explicit IOField(const IOobject& io);
//- Construct from IOobject; does local processor require reading? //- Construct from IOobject; does local processor require reading?
IOField(const IOobject&, const bool valid); IOField(const IOobject& io, const bool valid);
//- Construct from IOobject and size (does not set values) //- Construct from IOobject and size (does not set values)
IOField(const IOobject&, const label size); IOField(const IOobject& io, const label size);
//- Construct from components //- Construct from IOobject and a List/Field content
IOField(const IOobject&, const Field<Type>&); IOField(const IOobject& io, const UList<Type>& content);
//- Construct by transferring the Field contents //- Construct by transferring the Field content
IOField(const IOobject&, const Xfer<Field<Type>>&); IOField(const IOobject& io, Field<Type>&& content);
//- Construct by copying/moving tmp content
IOField(const IOobject& io, const tmp<Field<Type>>& tfld);
//- Destructor //- Destructor
virtual ~IOField(); virtual ~IOField() = default;
// Member functions // Member Functions
bool writeData(Ostream&) const; bool writeData(Ostream& os) const;
// Member operators // Member Operators
void operator=(const IOField<Type>&); //- Copy assignment of entries
void operator=(const IOField<Type>& rhs);
void operator=(const Field<Type>&); //- Copy or move assignment of entries
using Field<Type>::operator=;
}; };

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -51,7 +51,7 @@ Foam::IOList<T>::IOList(const IOobject& io)
template<class T> template<class T>
Foam::IOList<T>::IOList(const IOobject& io, const label size) Foam::IOList<T>::IOList(const IOobject& io, const label len)
: :
regIOobject(io) regIOobject(io)
{ {
@ -72,13 +72,13 @@ Foam::IOList<T>::IOList(const IOobject& io, const label size)
} }
else else
{ {
List<T>::setSize(size); List<T>::setSize(len);
} }
} }
template<class T> template<class T>
Foam::IOList<T>::IOList(const IOobject& io, const List<T>& list) Foam::IOList<T>::IOList(const IOobject& io, const UList<T>& content)
: :
regIOobject(io) regIOobject(io)
{ {
@ -99,20 +99,20 @@ Foam::IOList<T>::IOList(const IOobject& io, const List<T>& list)
} }
else else
{ {
List<T>::operator=(list); List<T>::operator=(content);
} }
} }
template<class T> template<class T>
Foam::IOList<T>::IOList(const IOobject& io, const Xfer<List<T>>& list) Foam::IOList<T>::IOList(const IOobject& io, List<T>&& content)
: :
regIOobject(io) regIOobject(io)
{ {
// Check for MUST_READ_IF_MODIFIED // Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOList<T>>(); warnNoRereading<IOList<T>>();
List<T>::transfer(list()); List<T>::transfer(content);
if if
( (
@ -129,13 +129,6 @@ Foam::IOList<T>::IOList(const IOobject& io, const Xfer<List<T>>& list)
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T>
Foam::IOList<T>::~IOList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T> template<class T>
@ -154,11 +147,4 @@ void Foam::IOList<T>::operator=(const IOList<T>& rhs)
} }
template<class T>
void Foam::IOList<T>::operator=(const List<T>& rhs)
{
List<T>::operator=(rhs);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -53,7 +53,6 @@ class IOList
public regIOobject, public regIOobject,
public List<T> public List<T>
{ {
public: public:
//- Runtime type information //- Runtime type information
@ -62,33 +61,39 @@ public:
// Constructors // Constructors
//- Default copy construct
IOList(const IOList&) = default;
//- Construct from IOobject //- Construct from IOobject
IOList(const IOobject&); explicit IOList(const IOobject& io);
//- Construct from IOobject and size of IOList //- Construct from IOobject and size of IOList
IOList(const IOobject&, const label); IOList(const IOobject& io, const label len);
//- Construct from IOobject and a List //- Construct from IOobject and a copy of UList content
IOList(const IOobject&, const List<T>&); IOList(const IOobject& io, const UList<T>& content);
//- Construct by transferring the List contents //- Construct by transferring the List content
IOList(const IOobject&, const Xfer<List<T>>&); IOList(const IOobject& io, List<T>&& content);
//- Destructor //- Destructor
virtual ~IOList(); virtual ~IOList() = default;
// Member functions // Member Functions
bool writeData(Ostream&) const; bool writeData(Ostream& os) const;
// Member operators // Member Operators
void operator=(const IOList<T>&); //- Copy assignment of entries
void operator=(const IOList<T>& rhs);
//- Copy or move assignment of entries
using List<T>::operator=;
void operator=(const List<T>&);
}; };

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -77,7 +77,7 @@ Foam::IOMap<T>::IOMap(const IOobject& io, const label size)
template<class T> template<class T>
Foam::IOMap<T>::IOMap(const IOobject& io, const Map<T>& map) Foam::IOMap<T>::IOMap(const IOobject& io, const Map<T>& content)
: :
regIOobject(io) regIOobject(io)
{ {
@ -98,17 +98,17 @@ Foam::IOMap<T>::IOMap(const IOobject& io, const Map<T>& map)
} }
else else
{ {
Map<T>::operator=(map); Map<T>::operator=(content);
} }
} }
template<class T> template<class T>
Foam::IOMap<T>::IOMap(const IOobject& io, const Xfer<Map<T>>& map) Foam::IOMap<T>::IOMap(const IOobject& io, Map<T>&& content)
: :
regIOobject(io) regIOobject(io)
{ {
Map<T>::transfer(map()); Map<T>::transfer(content);
if if
( (
@ -128,13 +128,6 @@ Foam::IOMap<T>::IOMap(const IOobject& io, const Xfer<Map<T>>& map)
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T>
Foam::IOMap<T>::~IOMap()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T> template<class T>
@ -153,11 +146,4 @@ void Foam::IOMap<T>::operator=(const IOMap<T>& rhs)
} }
template<class T>
void Foam::IOMap<T>::operator=(const Map<T>& rhs)
{
Map<T>::operator=(rhs);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -54,7 +54,6 @@ class IOMap
public regIOobject, public regIOobject,
public Map<T> public Map<T>
{ {
public: public:
//- Runtime type information //- Runtime type information
@ -63,26 +62,29 @@ public:
// Constructors // Constructors
//- Default copy construct
IOMap(const IOMap&) = default;
//- Construct from IOobject //- Construct from IOobject
IOMap(const IOobject&); explicit IOMap(const IOobject& io);
//- Construct from IOobject and size of Map //- Construct from IOobject and size of Map
IOMap(const IOobject&, const label); IOMap(const IOobject& io, const label size);
//- Construct from IOobject and a Map //- Construct from IOobject and a copy of Map content
IOMap(const IOobject&, const Map<T>&); IOMap(const IOobject&, const Map<T>& content);
//- Construct by transferring the Map contents //- Construct by transferring the Map content
IOMap(const IOobject&, const Xfer<Map<T>>&); IOMap(const IOobject&, Map<T>&& content);
//- Destructor //- Destructor
virtual ~IOMap(); virtual ~IOMap() = default;
// Member functions // Member Functions
bool writeData(Ostream&) const; bool writeData(Ostream& os) const;
//- Is object global //- Is object global
virtual bool global() const virtual bool global() const
@ -97,13 +99,13 @@ public:
return globalFilePath(type()); return globalFilePath(type());
} }
// Member operators // Member Operators
//- Assignment of other IOMap's entries to this IOMap //- Copy assignment of entries
void operator=(const IOMap<T>&); void operator=(const IOMap<T>& rhs);
//- Assignment of other Map's entries to this IOMap //- Copy or move assignment of entries
void operator=(const Map<T>&); using Map<T>::operator=;
}; };

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -75,10 +75,10 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io)
template<class T> template<class T>
Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const label s) Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const label len)
: :
regIOobject(io), regIOobject(io),
PtrList<T>(s) PtrList<T>(len)
{ {
if (io.readOpt() != IOobject::NO_READ) if (io.readOpt() != IOobject::NO_READ)
{ {
@ -90,7 +90,7 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const label s)
template<class T> template<class T>
Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const PtrList<T>& list) Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const PtrList<T>& content)
: :
regIOobject(io) regIOobject(io)
{ {
@ -111,17 +111,17 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const PtrList<T>& list)
} }
else else
{ {
PtrList<T>::operator=(list); PtrList<T>::operator=(content);
} }
} }
template<class T> template<class T>
Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const Xfer<PtrList<T>>& list) Foam::IOPtrList<T>::IOPtrList(const IOobject& io, PtrList<T>&& content)
: :
regIOobject(io) regIOobject(io)
{ {
PtrList<T>::transfer(list()); PtrList<T>::transfer(content);
if if
( (
@ -141,13 +141,6 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const Xfer<PtrList<T>>& list)
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T>
Foam::IOPtrList<T>::~IOPtrList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T> template<class T>
@ -165,4 +158,5 @@ void Foam::IOPtrList<T>::operator=(const IOPtrList<T>& rhs)
PtrList<T>::operator=(rhs); PtrList<T>::operator=(rhs);
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -53,7 +53,6 @@ class IOPtrList
public regIOobject, public regIOobject,
public PtrList<T> public PtrList<T>
{ {
public: public:
//- Runtime type information //- Runtime type information
@ -62,35 +61,42 @@ public:
// Constructors // Constructors
//- Construct from IOobject using given Istream constructor class //- Default copy construct
template<class INew> IOPtrList(const IOPtrList&) = default;
IOPtrList(const IOobject&, const INew&);
//- Construct from IOobject //- Construct from IOobject
IOPtrList(const IOobject&); explicit IOPtrList(const IOobject& io);
//- Construct from IOobject using given Istream constructor class
template<class INew>
IOPtrList(const IOobject& io, const INew& inewt);
//- Construct from IOobject with given size //- Construct from IOobject with given size
IOPtrList(const IOobject&, const label); IOPtrList(const IOobject& io, const label len);
//- Construct from IOobject and a PtrList //- Construct from IOobject and a copy of PtrList content
IOPtrList(const IOobject&, const PtrList<T>&); IOPtrList(const IOobject& io, const PtrList<T>& content);
//- Construct by transferring the PtrList contents //- Construct by transferring the PtrList content
IOPtrList(const IOobject&, const Xfer<PtrList<T>>&); IOPtrList(const IOobject& io, PtrList<T>&& content);
//- Destructor //- Destructor
virtual ~IOPtrList(); virtual ~IOPtrList() = default;
// Member functions // Member Functions
bool writeData(Ostream&) const; bool writeData(Ostream& os) const;
// Member operators // Member Operators
void operator=(const IOPtrList<T>&); //- Copy assignment of entries
void operator=(const IOPtrList<T>& rhs);
//- Copy or move assignment of entries
using PtrList<T>::operator=;
}; };

View File

@ -122,7 +122,7 @@ Foam::decomposedBlockData::decomposedBlockData
( (
const label comm, const label comm,
const IOobject& io, const IOobject& io,
const Xfer<List<char>>& list, List<char>&& list,
const UPstream::commsTypes commsType const UPstream::commsTypes commsType
) )
: :
@ -140,7 +140,7 @@ Foam::decomposedBlockData::decomposedBlockData
<< endl; << endl;
} }
List<char>::transfer(list()); List<char>::transfer(list);
if if
( (

View File

@ -87,7 +87,7 @@ public:
decomposedBlockData decomposedBlockData
( (
const label comm, const label comm,
const IOobject&, const IOobject& io,
const UPstream::commsTypes = UPstream::commsTypes::scheduled const UPstream::commsTypes = UPstream::commsTypes::scheduled
); );
@ -95,17 +95,17 @@ public:
decomposedBlockData decomposedBlockData
( (
const label comm, const label comm,
const IOobject&, const IOobject& io,
const UList<char>&, const UList<char>& list,
const UPstream::commsTypes = UPstream::commsTypes::scheduled const UPstream::commsTypes = UPstream::commsTypes::scheduled
); );
//- Construct by transferring the IOList contents //- Construct by transferring the List contents
decomposedBlockData decomposedBlockData
( (
const label comm, const label comm,
const IOobject&, const IOobject& io,
const Xfer<List<char>>&, List<char>&& list,
const UPstream::commsTypes = UPstream::commsTypes::scheduled const UPstream::commsTypes = UPstream::commsTypes::scheduled
); );

View File

@ -98,13 +98,13 @@ public:
ITstream ITstream
( (
const string& name, const string& name,
const Xfer<List<token>>& tokens, List<token>&& tokens,
streamFormat format=ASCII, streamFormat format=ASCII,
versionNumber version=currentVersion versionNumber version=currentVersion
) )
: :
Istream(format, version), Istream(format, version),
tokenList(tokens), tokenList(std::move(tokens)),
name_(name), name_(name),
tokenIndex_(0) tokenIndex_(0)
{ {

View File

@ -83,13 +83,6 @@ protected:
UIListStreamAllocator(List<char>::data(), List<char>::size()) UIListStreamAllocator(List<char>::data(), List<char>::size())
{} {}
//- Transfer (move) construct
IListStreamAllocator(const Xfer<List<char>>& buffer)
:
List<char>(buffer),
UIListStreamAllocator(List<char>::data(), List<char>::size())
{}
// Protected Member Functions // Protected Member Functions
@ -110,12 +103,6 @@ public:
//- The current get position in the buffer //- The current get position in the buffer
using UIListStreamAllocator::size; using UIListStreamAllocator::size;
inline void swap(List<char>& list)
{
List<char>::swap(list);
reset_gbuffer();
}
//- Clear storage //- Clear storage
inline void clearStorage() inline void clearStorage()
{ {
@ -123,12 +110,11 @@ public:
reset_gbuffer(); reset_gbuffer();
} }
//- Transfer contents to the Xfer container as a plain List //- Transfer contents to other list
inline Xfer<List<char>> xfer() inline void swap(List<char>& list)
{ {
Xfer<List<char>> moved = List<char>::xfer(); List<char>::swap(list);
reset_gbuffer(); reset_gbuffer();
return moved;
} }
}; };
@ -191,20 +177,6 @@ public:
{} {}
//- Transfer (move) construct
IListStream
(
const Xfer<List<char>>& buffer,
streamFormat format=ASCII,
versionNumber version=currentVersion,
const Foam::string& name="input"
)
:
allocator_type(buffer),
ISstream(stream_, name, format, version)
{}
// Member functions // Member functions
//- The current get position in the buffer //- The current get position in the buffer

Some files were not shown because too many files have changed in this diff Show More