mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -1,8 +1,5 @@
|
||||
Info<< "Constructing single cell mesh" << nl << endl;
|
||||
|
||||
labelList owner(6, label(0));
|
||||
labelList neighbour(0);
|
||||
|
||||
pointField points(8);
|
||||
points[0] = vector(0, 0, 0);
|
||||
points[1] = vector(1, 0, 0);
|
||||
@ -24,10 +21,10 @@ fvMesh mesh
|
||||
runTime,
|
||||
IOobject::READ_IF_PRESENT
|
||||
),
|
||||
xferMove<pointField>(points),
|
||||
faces.xfer(),
|
||||
owner.xfer(),
|
||||
neighbour.xfer()
|
||||
std::move(points),
|
||||
std::move(faces),
|
||||
labelList(6, Zero), // owner
|
||||
labelList() // neighbour
|
||||
);
|
||||
|
||||
List<polyPatch*> patches(1);
|
||||
|
||||
@ -180,7 +180,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
std::cout<< "iter: " << typeid(*iter).name() << '\n';
|
||||
|
||||
Info<< "elem = " << *(*iter) << endl;
|
||||
// Info<< "elem = " << *(*iter) << endl;
|
||||
}
|
||||
|
||||
std::cout<< "iter type: "
|
||||
|
||||
@ -194,13 +194,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
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("dlC", dlC, true);
|
||||
|
||||
DynamicList<label> dlD(lstB.xfer());
|
||||
DynamicList<label> dlD(std::move(lstB));
|
||||
|
||||
Info<< "Transfer construct from normal list" << endl;
|
||||
printInfo("lstB", lstB, true);
|
||||
@ -279,7 +279,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "list in: " << flatOutput(list1) << nl
|
||||
<< "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);
|
||||
Info<< "list in: " << flatOutput(input2) << nl
|
||||
<< "list out: " << flatOutput(list2) << endl;
|
||||
|
||||
@ -102,7 +102,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
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 << "input string:";
|
||||
|
||||
@ -95,7 +95,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
inplaceReverseList(addresses);
|
||||
|
||||
idl1.resetAddressing(addresses.xfer());
|
||||
idl1.resetAddressing(std::move(addresses));
|
||||
|
||||
printInfo(idl1);
|
||||
|
||||
|
||||
@ -190,8 +190,8 @@ int main(int argc, char *argv[])
|
||||
list2.setSize(10, vector(1, 2, 3));
|
||||
Info<< "list2: " << list2 << endl;
|
||||
|
||||
List<vector> list3(list2.xfer());
|
||||
Info<< "Transferred via the xfer() method" << endl;
|
||||
List<vector> list3(std::move(list2));
|
||||
Info<< "Move construct" << endl;
|
||||
Info<< "list2: " << list2 << nl
|
||||
<< "list3: " << list3 << endl;
|
||||
|
||||
|
||||
@ -129,7 +129,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
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:";
|
||||
printInfo(obuf);
|
||||
@ -141,6 +147,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Create from other storage types
|
||||
|
||||
List<char> written;
|
||||
Info<< nl;
|
||||
{
|
||||
Info<<"create std::move(List)" << endl;
|
||||
@ -163,35 +170,9 @@ int main(int argc, char *argv[])
|
||||
toString(Info, list) << endl;
|
||||
|
||||
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
|
||||
written = buf1.xfer();
|
||||
buf1.swap(written);
|
||||
|
||||
printInfo(buf1);
|
||||
}
|
||||
|
||||
@ -147,8 +147,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<<"list1: " << list1 << endl;
|
||||
|
||||
PtrList<Scalar> list3(list1.xfer());
|
||||
Info<< "Transferred via the xfer() method" << endl;
|
||||
PtrList<Scalar> list3(std::move(list1));
|
||||
Info<<"Move constructed" << endl;
|
||||
|
||||
Info<<"list1: " << list1 << nl
|
||||
<<"list2: " << list2 << nl
|
||||
|
||||
@ -71,7 +71,7 @@ int main(int argc, char *argv[])
|
||||
<< "keys: " << dict1.keys() << nl
|
||||
<< "patterns: " << dict1.keys(true) << endl;
|
||||
|
||||
dictionary dict2(dict1.xfer());
|
||||
dictionary dict2(std::move(dict1));
|
||||
|
||||
Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc() << nl
|
||||
<< "dict2.toc(): " << dict2.name() << " " << dict2.toc()
|
||||
|
||||
@ -51,19 +51,20 @@ int main(int argc, char *argv[])
|
||||
const scalar instanceValue(0.005);
|
||||
|
||||
|
||||
IOobject io
|
||||
IOmapDistributePolyMesh map
|
||||
(
|
||||
"procAddressing",
|
||||
instance,
|
||||
fvMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject
|
||||
(
|
||||
"procAddressing",
|
||||
instance,
|
||||
fvMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
IOmapDistributePolyMesh map(io);
|
||||
|
||||
{
|
||||
// Load the instance mesh
|
||||
runTime.setTime(instanceValue, 0);
|
||||
@ -112,7 +113,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
const mapDistribute& cellMap = map.cellMap();
|
||||
pointField cc(mesh.cellCentres());
|
||||
|
||||
@ -91,7 +91,7 @@ int main(int argc, char *argv[])
|
||||
runTime,
|
||||
Foam::IOobject::NO_READ
|
||||
),
|
||||
Xfer<pointField>(points),
|
||||
std::move(points),
|
||||
shapes,
|
||||
boundaryFaces,
|
||||
boundaryPatchNames,
|
||||
|
||||
@ -111,7 +111,7 @@ void testMapDistribute()
|
||||
}
|
||||
|
||||
// Construct distribute map (destructively)
|
||||
mapDistribute map(constructSize, sendMap.xfer(), recvMap.xfer());
|
||||
mapDistribute map(constructSize, std::move(sendMap), std::move(recvMap));
|
||||
|
||||
// Distribute complexData
|
||||
map.distribute(complexData);
|
||||
|
||||
@ -246,15 +246,16 @@ int main(int argc, char *argv[])
|
||||
writeFaceFaces(localPoints, localFaces, faceFaces);
|
||||
}
|
||||
|
||||
// Test construction from Xfer
|
||||
// Move construct
|
||||
{
|
||||
faceList patchFaces = patch;
|
||||
pointField allPoints = patch.points();
|
||||
|
||||
PrimitivePatch<face, List, pointField, point> storedPatch
|
||||
(
|
||||
patchFaces.xfer(),
|
||||
allPoints.xfer()
|
||||
patchFaces,
|
||||
allPoints,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -413,9 +413,9 @@ int main(int argc, char *argv[])
|
||||
surf.writeStats(Info);
|
||||
Info<< endl;
|
||||
|
||||
ModifiableMeshedSurface<face> tsurf(surf.xfer());
|
||||
// ModifiableMeshedSurface<face> tsurf;
|
||||
// tsurf.reset(surf.xfer());
|
||||
ModifiableMeshedSurface<face> tsurf(std::move(surf));
|
||||
// ModifiableMeshedSurface<face> xtsurf;
|
||||
// xtsurf.transfer(surf);
|
||||
|
||||
Info<< "in-progress" << nl;
|
||||
surf.writeStats(Info);
|
||||
@ -515,7 +515,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
surf.xfer()
|
||||
std::move(surf)
|
||||
);
|
||||
|
||||
Info<< "writing surfMesh as well: " << surfOut.objectPath() << endl;
|
||||
@ -546,7 +546,6 @@ int main(int argc, char *argv[])
|
||||
surfOut.setInstance(runTime.timeName());
|
||||
|
||||
|
||||
|
||||
Info<< "writing surfMesh again well: " << surfOut.objectPath()
|
||||
<< endl;
|
||||
surfOut.write();
|
||||
|
||||
@ -214,9 +214,9 @@ int main(int argc, char *argv[])
|
||||
runTime.timeName(),
|
||||
runTime
|
||||
),
|
||||
xferCopy(mesh.points()), // could we safely re-use the data?
|
||||
xferCopy(mesh.faces()),
|
||||
xferCopy(mesh.cells())
|
||||
pointField(mesh.points()), // Could we safely re-use the data?
|
||||
faceList(mesh.faces()),
|
||||
cellList(mesh.cells())
|
||||
);
|
||||
|
||||
// Add the boundary patches
|
||||
|
||||
@ -446,27 +446,23 @@ int main(int argc, char *argv[])
|
||||
const word defaultFacesName = "defaultFaces";
|
||||
word defaultFacesType = emptyPolyPatch::typeName;
|
||||
|
||||
// Create dummy mesh just to find out what are internal/external
|
||||
// faces
|
||||
autoPtr<polyMesh> dummyMesh
|
||||
// Create dummy mesh just to find out what are internal/external faces
|
||||
auto dummyMesh = autoPtr<polyMesh>::New
|
||||
(
|
||||
new polyMesh
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dummyMesh",
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferCopy(points),
|
||||
cellShapes,
|
||||
faceListList(0),
|
||||
wordList(0),
|
||||
wordList(0),
|
||||
defaultFacesName,
|
||||
defaultFacesType,
|
||||
wordList(0)
|
||||
)
|
||||
"dummyMesh",
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
pointField(points), // copy
|
||||
cellShapes,
|
||||
faceListList(),
|
||||
wordList(),
|
||||
wordList(),
|
||||
defaultFacesName,
|
||||
defaultFacesType,
|
||||
wordList()
|
||||
);
|
||||
|
||||
|
||||
@ -605,7 +601,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cellShapes,
|
||||
patchFaces,
|
||||
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<faceZone*> fz;
|
||||
|
||||
@ -739,7 +739,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cellShapes,
|
||||
boundary,
|
||||
patchNames,
|
||||
|
||||
@ -945,10 +945,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferCopy(pointField()),
|
||||
xferCopy(faceList()),
|
||||
xferCopy(labelList()),
|
||||
xferCopy(labelList())
|
||||
Zero
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -1175,7 +1175,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cellShapes,
|
||||
patches,
|
||||
patchNames,
|
||||
|
||||
@ -853,7 +853,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cells,
|
||||
boundary,
|
||||
patchNames,
|
||||
|
||||
@ -931,7 +931,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cells,
|
||||
boundaryFaces,
|
||||
boundaryPatchNames,
|
||||
|
||||
@ -1128,17 +1128,13 @@ int main(int argc, char *argv[])
|
||||
<< nl << endl;
|
||||
|
||||
// Create globally numbered surface
|
||||
meshedSurface rawSurface
|
||||
(
|
||||
xferCopy(polyPoints),
|
||||
xferCopyTo<faceList>(boundaryFaces)
|
||||
);
|
||||
meshedSurface rawSurface(polyPoints, boundaryFaces);
|
||||
|
||||
// Write locally numbered surface
|
||||
meshedSurface
|
||||
(
|
||||
xferCopy(rawSurface.localPoints()),
|
||||
xferCopy(rawSurface.localFaces())
|
||||
rawSurface.localPoints(),
|
||||
rawSurface.localFaces()
|
||||
).write(runTime.path()/"boundaryFaces.obj");
|
||||
}
|
||||
|
||||
@ -1171,14 +1167,14 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(polyPoints),
|
||||
std::move(polyPoints),
|
||||
cellVerts,
|
||||
usedPatchFaceVerts, // boundaryFaces,
|
||||
usedPatchNames, // boundaryPatchNames,
|
||||
usedPatchFaceVerts, // boundaryFaces,
|
||||
usedPatchNames, // boundaryPatchNames,
|
||||
wordList(patchNames.size(), polyPatch::typeName), // boundaryPatchTypes,
|
||||
"defaultFaces", // defaultFacesName
|
||||
polyPatch::typeName, // defaultFacesType,
|
||||
wordList(0) // boundaryPatchPhysicalTypes
|
||||
"defaultFaces", // defaultFacesName
|
||||
polyPatch::typeName, // defaultFacesType,
|
||||
wordList() // boundaryPatchPhysicalTypes
|
||||
);
|
||||
|
||||
// Remove files now, to ensure all mesh files written are consistent.
|
||||
|
||||
@ -565,7 +565,7 @@ polyMesh pShapeMesh
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cellShapes,
|
||||
boundary,
|
||||
patchNames,
|
||||
|
||||
@ -144,14 +144,14 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cells,
|
||||
faceListList(0),
|
||||
wordList(0),
|
||||
wordList(0),
|
||||
faceListList(),
|
||||
wordList(),
|
||||
wordList(),
|
||||
"defaultFaces",
|
||||
polyPatch::typeName,
|
||||
wordList(0)
|
||||
wordList()
|
||||
);
|
||||
|
||||
// Set the precision of the points data to 10
|
||||
|
||||
@ -303,7 +303,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cells,
|
||||
patchFaces,
|
||||
patchNames,
|
||||
|
||||
@ -247,7 +247,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(newPoints),
|
||||
std::move(newPoints),
|
||||
cellShapes,
|
||||
boundary,
|
||||
patchNames,
|
||||
|
||||
@ -318,25 +318,22 @@ int main(int argc, char *argv[])
|
||||
// Construct mesh with default boundary only
|
||||
//
|
||||
|
||||
autoPtr<polyMesh> meshPtr
|
||||
auto meshPtr = autoPtr<polyMesh>::New
|
||||
(
|
||||
new polyMesh
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
polyMesh::defaultRegion,
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferCopy(points),
|
||||
cells,
|
||||
faceListList(0),
|
||||
wordList(0), // boundaryPatchNames
|
||||
wordList(0), // boundaryPatchTypes
|
||||
"defaultFaces",
|
||||
polyPatch::typeName,
|
||||
wordList(0)
|
||||
)
|
||||
polyMesh::defaultRegion,
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
pointField(points), // Copy of points
|
||||
cells,
|
||||
faceListList(),
|
||||
wordList(), // boundaryPatchNames
|
||||
wordList(), // boundaryPatchTypes
|
||||
"defaultFaces",
|
||||
polyPatch::typeName,
|
||||
wordList()
|
||||
);
|
||||
const polyMesh& mesh = *meshPtr;
|
||||
|
||||
@ -531,7 +528,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cells,
|
||||
patchFaces,
|
||||
patchNames,
|
||||
|
||||
@ -68,14 +68,14 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(reader.points()),
|
||||
std::move(reader.points()),
|
||||
reader.cells(),
|
||||
faceListList(0),
|
||||
wordList(0),
|
||||
wordList(0),
|
||||
faceListList(),
|
||||
wordList(),
|
||||
wordList(),
|
||||
"defaultFaces",
|
||||
polyPatch::typeName,
|
||||
wordList(0)
|
||||
wordList()
|
||||
);
|
||||
|
||||
// Set the precision of the points data to 10
|
||||
|
||||
@ -277,7 +277,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferCopy(blocks.points()), // could we re-use space?
|
||||
pointField(blocks.points()), // Copy, could we re-use space?
|
||||
blocks.cells(),
|
||||
blocks.patches(),
|
||||
blocks.patchNames(),
|
||||
|
||||
@ -63,7 +63,7 @@ class extrudedMesh
|
||||
|
||||
//- Construct and return the extruded mesh points
|
||||
template<class Face, template<class> class FaceList, class PointField>
|
||||
Xfer<pointField> extrudedPoints
|
||||
pointField extrudedPoints
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel&
|
||||
@ -71,7 +71,7 @@ class extrudedMesh
|
||||
|
||||
//- Construct and return the extruded mesh faces
|
||||
template<class Face, template<class> class FaceList, class PointField>
|
||||
Xfer<faceList> extrudedFaces
|
||||
faceList extrudedFaces
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel&
|
||||
@ -79,7 +79,7 @@ class extrudedMesh
|
||||
|
||||
//- Construct and return the extruded mesh cells
|
||||
template<class Face, template<class> class FaceList, class PointField>
|
||||
Xfer<cellList> extrudedCells
|
||||
cellList extrudedCells
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel&
|
||||
@ -87,10 +87,10 @@ class extrudedMesh
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
extrudedMesh(const extrudedMesh&);
|
||||
extrudedMesh(const extrudedMesh&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const extrudedMesh&);
|
||||
void operator=(const extrudedMesh&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -34,7 +34,7 @@ template
|
||||
template<class> class FaceList,
|
||||
class PointField
|
||||
>
|
||||
Foam::Xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints
|
||||
Foam::pointField Foam::extrudedMesh::extrudedPoints
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel& model
|
||||
@ -47,9 +47,9 @@ Foam::Xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints
|
||||
|
||||
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)
|
||||
{
|
||||
@ -62,13 +62,12 @@ Foam::Xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints
|
||||
}
|
||||
}
|
||||
|
||||
// return points for transferring
|
||||
return xferMove(ePoints);
|
||||
return ePoints;
|
||||
}
|
||||
|
||||
|
||||
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 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>
|
||||
Foam::Xfer<Foam::cellList> Foam::extrudedMesh::extrudedCells
|
||||
Foam::cellList Foam::extrudedMesh::extrudedCells
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel& model
|
||||
@ -295,8 +294,7 @@ Foam::Xfer<Foam::cellList> Foam::extrudedMesh::extrudedCells
|
||||
facei++;
|
||||
}
|
||||
|
||||
// return points for transferring
|
||||
return xferMove(eCells);
|
||||
return eCells;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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>());
|
||||
@ -2405,10 +2405,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::AUTO_WRITE,
|
||||
false
|
||||
),
|
||||
xferCopy(pointField()),
|
||||
xferCopy(faceList()),
|
||||
xferCopy(labelList()),
|
||||
xferCopy(labelList()),
|
||||
Zero,
|
||||
false
|
||||
);
|
||||
|
||||
|
||||
@ -247,7 +247,7 @@ void Foam::patchToPoly2DMesh::addPatchFacesToOwner()
|
||||
<< nExternalEdges << endl;
|
||||
}
|
||||
|
||||
owner_ = newOwner.xfer();
|
||||
owner_.transfer(newOwner);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -184,24 +184,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
poly2DMesh.createMesh();
|
||||
|
||||
mesh.reset
|
||||
mesh = autoPtr<polyMesh>::New
|
||||
(
|
||||
new polyMesh
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
polyMesh::defaultRegion,
|
||||
runTimeExtruded.constant(),
|
||||
runTimeExtruded,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
xferMove(poly2DMesh.points()),
|
||||
xferMove(poly2DMesh.faces()),
|
||||
xferMove(poly2DMesh.owner()),
|
||||
xferMove(poly2DMesh.neighbour())
|
||||
)
|
||||
polyMesh::defaultRegion,
|
||||
runTimeExtruded.constant(),
|
||||
runTimeExtruded,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
std::move(poly2DMesh.points()),
|
||||
std::move(poly2DMesh.faces()),
|
||||
std::move(poly2DMesh.owner()),
|
||||
std::move(poly2DMesh.neighbour())
|
||||
);
|
||||
|
||||
Info<< "Constructing patches." << endl;
|
||||
@ -224,17 +221,14 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if (surfaceFormat == POLYMESH2D)
|
||||
{
|
||||
mesh.reset
|
||||
mesh = autoPtr<polyMesh>::New
|
||||
(
|
||||
new polyMesh
|
||||
Foam::IOobject
|
||||
(
|
||||
Foam::IOobject
|
||||
(
|
||||
Foam::polyMesh::defaultRegion,
|
||||
runTimeExtruded.timeName(),
|
||||
runTimeExtruded,
|
||||
Foam::IOobject::MUST_READ
|
||||
)
|
||||
Foam::polyMesh::defaultRegion,
|
||||
runTimeExtruded.timeName(),
|
||||
runTimeExtruded,
|
||||
Foam::IOobject::MUST_READ
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -141,14 +141,11 @@ autoPtr<mapDistribute> buildMap
|
||||
|
||||
List<Map<label>> compactMap;
|
||||
|
||||
return autoPtr<mapDistribute>
|
||||
return autoPtr<mapDistribute>::New
|
||||
(
|
||||
new mapDistribute
|
||||
(
|
||||
globalIndexing,
|
||||
pointPoints,
|
||||
compactMap
|
||||
)
|
||||
globalIndexing,
|
||||
pointPoints,
|
||||
compactMap
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -593,23 +593,20 @@ Foam::DelaunayMesh<Triangulation>::createMesh
|
||||
|
||||
Info<< "Creating mesh" << endl;
|
||||
|
||||
autoPtr<polyMesh> meshPtr
|
||||
auto meshPtr = autoPtr<polyMesh>::New
|
||||
(
|
||||
new polyMesh
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
name,
|
||||
time().timeName(),
|
||||
time(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
xferMove(points),
|
||||
xferMove(faces),
|
||||
xferMove(owner),
|
||||
xferMove(neighbour)
|
||||
)
|
||||
name,
|
||||
time().timeName(),
|
||||
time(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
std::move(points),
|
||||
std::move(faces),
|
||||
std::move(owner),
|
||||
std::move(neighbour)
|
||||
);
|
||||
|
||||
Info<< "Adding patches" << endl;
|
||||
|
||||
@ -105,14 +105,11 @@ Foam::DistributedDelaunayMesh<Triangulation>::buildMap
|
||||
}
|
||||
}
|
||||
|
||||
return autoPtr<mapDistribute>
|
||||
return autoPtr<mapDistribute>::New
|
||||
(
|
||||
new mapDistribute
|
||||
(
|
||||
constructSize,
|
||||
sendMap.xfer(),
|
||||
constructMap.xfer()
|
||||
)
|
||||
constructSize,
|
||||
std::move(sendMap),
|
||||
std::move(constructMap)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -36,9 +36,7 @@ License
|
||||
|
||||
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,
|
||||
sendMap.xfer(),
|
||||
constructMap.xfer()
|
||||
)
|
||||
constructSize,
|
||||
std::move(sendMap),
|
||||
std::move(constructMap)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -727,23 +727,20 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
|
||||
labelList cellToDelaunayVertex(removeUnusedCells(owner, neighbour));
|
||||
cellCentres = pointField(cellCentres, cellToDelaunayVertex);
|
||||
|
||||
autoPtr<polyMesh> meshPtr
|
||||
auto meshPtr = autoPtr<polyMesh>::New
|
||||
(
|
||||
new polyMesh
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"foamyHexMesh_temporary",
|
||||
runTime_.timeName(),
|
||||
runTime_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
xferCopy(pts),
|
||||
xferMove(faces),
|
||||
xferMove(owner),
|
||||
xferMove(neighbour)
|
||||
)
|
||||
"foamyHexMesh_temporary",
|
||||
runTime_.timeName(),
|
||||
runTime_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
pointField(pts), // Copy of points
|
||||
std::move(faces),
|
||||
std::move(owner),
|
||||
std::move(neighbour)
|
||||
);
|
||||
|
||||
polyMesh& pMesh = meshPtr();
|
||||
|
||||
@ -404,16 +404,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::conformalVoronoiMesh::createDummyMesh
|
||||
const PtrList<dictionary>& patchDicts
|
||||
) const
|
||||
{
|
||||
autoPtr<fvMesh> meshPtr
|
||||
(
|
||||
new fvMesh
|
||||
(
|
||||
io,
|
||||
xferCopy(pointField()),
|
||||
xferCopy(faceList()),
|
||||
xferCopy(cellList())
|
||||
)
|
||||
);
|
||||
auto meshPtr = autoPtr<fvMesh>::New(io, Zero);
|
||||
fvMesh& mesh = meshPtr();
|
||||
|
||||
List<polyPatch*> patches(patchDicts.size());
|
||||
@ -827,10 +818,10 @@ void Foam::conformalVoronoiMesh::writeMesh
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
xferMove(points),
|
||||
xferMove(faces),
|
||||
xferMove(owner),
|
||||
xferMove(neighbour)
|
||||
std::move(points),
|
||||
std::move(faces),
|
||||
std::move(owner),
|
||||
std::move(neighbour)
|
||||
);
|
||||
|
||||
Info<< indent << "Adding patches to mesh" << endl;
|
||||
|
||||
@ -282,20 +282,17 @@ autoPtr<polyMesh> generateHexMesh
|
||||
word defaultFacesType = polyPatch::typeName;
|
||||
wordList patchPhysicalTypes(0);
|
||||
|
||||
return autoPtr<polyMesh>
|
||||
return autoPtr<polyMesh>::New
|
||||
(
|
||||
new polyMesh
|
||||
(
|
||||
io,
|
||||
xferMoveTo<pointField>(points),
|
||||
cellShapes,
|
||||
boundary,
|
||||
patchNames,
|
||||
patchTypes,
|
||||
defaultFacesName,
|
||||
defaultFacesType,
|
||||
patchPhysicalTypes
|
||||
)
|
||||
io,
|
||||
std::move(points),
|
||||
cellShapes,
|
||||
boundary,
|
||||
patchNames,
|
||||
patchTypes,
|
||||
defaultFacesName,
|
||||
defaultFacesType,
|
||||
patchPhysicalTypes
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -152,10 +152,10 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
xferMove(poly2DMesh.points()),
|
||||
xferMove(poly2DMesh.faces()),
|
||||
xferMove(poly2DMesh.owner()),
|
||||
xferMove(poly2DMesh.neighbour())
|
||||
std::move(poly2DMesh.points()),
|
||||
std::move(poly2DMesh.faces()),
|
||||
std::move(poly2DMesh.owner()),
|
||||
std::move(poly2DMesh.neighbour())
|
||||
);
|
||||
|
||||
Info<< "Constructing patches." << endl;
|
||||
|
||||
@ -204,7 +204,7 @@ Foam::shortEdgeFilter2D::shortEdgeFilter2D
|
||||
|
||||
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;
|
||||
ms_.writeStats(Info);
|
||||
@ -533,12 +533,7 @@ Foam::shortEdgeFilter2D::filter()
|
||||
|
||||
newFaces.setSize(newFacei);
|
||||
|
||||
MeshedSurface<face> fMesh
|
||||
(
|
||||
xferMove(newPoints),
|
||||
xferMove(newFaces),
|
||||
xferCopy(List<surfZone>())
|
||||
);
|
||||
MeshedSurface<face> fMesh(std::move(newPoints), std::move(newFaces));
|
||||
|
||||
updateEdgeRegionMap
|
||||
(
|
||||
|
||||
@ -476,7 +476,7 @@ void extractSurface
|
||||
|
||||
// Gather all ZoneIDs
|
||||
List<labelList> gatheredZones(Pstream::nProcs());
|
||||
gatheredZones[Pstream::myProcNo()] = compactZones.xfer();
|
||||
gatheredZones[Pstream::myProcNo()].transfer(compactZones);
|
||||
Pstream::gatherList(gatheredZones);
|
||||
|
||||
// On master combine all points, faces, zones
|
||||
@ -515,10 +515,10 @@ void extractSurface
|
||||
|
||||
UnsortedMeshedSurface<face> unsortedFace
|
||||
(
|
||||
xferMove(allPoints),
|
||||
xferMove(allFaces),
|
||||
xferMove(allZones),
|
||||
xferMove(surfZones)
|
||||
std::move(allPoints),
|
||||
std::move(allFaces),
|
||||
std::move(allZones),
|
||||
surfZones
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -353,12 +353,12 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
||||
Info<< "Mirroring cell shapes." << endl;
|
||||
|
||||
Info<< nl << "Creating new mesh" << endl;
|
||||
mirrorMeshPtr_ = new fvMesh
|
||||
mirrorMeshPtr_ = autoPtr<fvMesh>::New
|
||||
(
|
||||
io,
|
||||
xferMove(newPoints),
|
||||
xferMove(newFaces),
|
||||
xferMove(newCells)
|
||||
std::move(newPoints),
|
||||
std::move(newFaces),
|
||||
std::move(newCells)
|
||||
);
|
||||
|
||||
fvMesh& pMesh = *mirrorMeshPtr_;
|
||||
@ -381,10 +381,4 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::mirrorFvMesh::~mirrorFvMesh()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -55,21 +55,20 @@ class mirrorFvMesh
|
||||
IOdictionary mirrorMeshDict_;
|
||||
|
||||
//- Mirrored mesh
|
||||
fvMesh* mirrorMeshPtr_;
|
||||
autoPtr<fvMesh> mirrorMeshPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
mirrorFvMesh(const mirrorFvMesh&);
|
||||
//- Disallow copy construct
|
||||
mirrorFvMesh(const mirrorFvMesh&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const mirrorFvMesh&);
|
||||
//- Disallow copy assignment
|
||||
void operator=(const mirrorFvMesh&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from IOobject
|
||||
@ -77,7 +76,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
~mirrorFvMesh();
|
||||
~mirrorFvMesh() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -461,10 +461,10 @@ autoPtr<mapPolyMesh> reorderMesh
|
||||
|
||||
mesh.resetPrimitives
|
||||
(
|
||||
Xfer<pointField>::null(),
|
||||
xferMove(newFaces),
|
||||
xferMove(newOwner),
|
||||
xferMove(newNeighbour),
|
||||
autoPtr<pointField>(), // <- null: leaves points untouched
|
||||
autoPtr<faceList>::New(std::move(newFaces)),
|
||||
autoPtr<labelList>::New(std::move(newOwner)),
|
||||
autoPtr<labelList>::New(std::move(newNeighbour)),
|
||||
patchSizes,
|
||||
patchStarts,
|
||||
true
|
||||
|
||||
@ -521,7 +521,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
cutZoneName,
|
||||
true // verbose
|
||||
).resetAddressing(faceIds.xfer(), false);
|
||||
).resetAddressing(std::move(faceIds), false);
|
||||
|
||||
|
||||
// Add the perfect interface mesh modifier
|
||||
@ -551,7 +551,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
mergePatchName + "MasterZone",
|
||||
true // verbose
|
||||
).resetAddressing(faceIds.xfer(), false);
|
||||
).resetAddressing(std::move(faceIds), false);
|
||||
|
||||
// Markup slave face ids
|
||||
faceIds.setSize(slavePatch.size());
|
||||
@ -561,7 +561,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
mergePatchName + "SlaveZone",
|
||||
true // verbose
|
||||
).resetAddressing(faceIds.xfer(), false);
|
||||
).resetAddressing(std::move(faceIds), false);
|
||||
|
||||
// Add empty zone for cut faces
|
||||
mesh.faceZones()
|
||||
|
||||
@ -340,38 +340,32 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
|
||||
curPointLabels
|
||||
);
|
||||
|
||||
procMeshPtr.reset
|
||||
procMeshPtr = autoPtr<polyMesh>::New
|
||||
(
|
||||
new polyMesh
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->polyMesh::name(), // region of undecomposed mesh
|
||||
facesInstance(),
|
||||
processorDb
|
||||
),
|
||||
xferMove(facesInstancePoints),
|
||||
xferMove(procFaces),
|
||||
xferMove(procCells)
|
||||
)
|
||||
this->polyMesh::name(), // region of undecomposed mesh
|
||||
facesInstance(),
|
||||
processorDb
|
||||
),
|
||||
std::move(facesInstancePoints),
|
||||
std::move(procFaces),
|
||||
std::move(procCells)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
procMeshPtr.reset
|
||||
procMeshPtr = autoPtr<polyMesh>::New
|
||||
(
|
||||
new polyMesh
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->polyMesh::name(), // region of undecomposed mesh
|
||||
facesInstance(),
|
||||
processorDb
|
||||
),
|
||||
xferMove(procPoints),
|
||||
xferMove(procFaces),
|
||||
xferMove(procCells)
|
||||
)
|
||||
this->polyMesh::name(), // region of undecomposed mesh
|
||||
facesInstance(),
|
||||
processorDb
|
||||
),
|
||||
std::move(procPoints),
|
||||
std::move(procFaces),
|
||||
std::move(procCells)
|
||||
);
|
||||
}
|
||||
polyMesh& procMesh = procMeshPtr();
|
||||
@ -751,7 +745,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
xferMove(procPoints)
|
||||
std::move(procPoints)
|
||||
);
|
||||
pointsInstancePoints.write();
|
||||
}
|
||||
|
||||
@ -652,9 +652,7 @@ int main(int argc, char *argv[])
|
||||
runTime,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
xferCopy(pointField()),
|
||||
xferCopy(faceList()),
|
||||
xferCopy(cellList())
|
||||
Zero
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -166,15 +166,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
|
||||
// Create dummy mesh. Only used on procs that don't have mesh.
|
||||
IOobject noReadIO(io);
|
||||
noReadIO.readOpt() = IOobject::NO_READ;
|
||||
fvMesh dummyMesh
|
||||
(
|
||||
noReadIO,
|
||||
xferCopy(pointField()),
|
||||
xferCopy(faceList()),
|
||||
xferCopy(labelList()),
|
||||
xferCopy(labelList()),
|
||||
false
|
||||
);
|
||||
fvMesh dummyMesh(noReadIO, Zero, false);
|
||||
|
||||
// Add patches
|
||||
List<polyPatch*> patches(patchEntries.size());
|
||||
@ -261,8 +253,8 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
|
||||
// parallel
|
||||
|
||||
//Pout<< "Reading mesh from " << io.objectPath() << endl;
|
||||
autoPtr<fvMesh> meshPtr(new fvMesh(io));
|
||||
fvMesh& mesh = meshPtr();
|
||||
auto meshPtr = autoPtr<fvMesh>::New(io);
|
||||
fvMesh& mesh = *meshPtr;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -279,15 +279,11 @@ Foam::parLagrangianRedistributor::redistributeLagrangianPositions
|
||||
}
|
||||
|
||||
|
||||
// Construct map
|
||||
return autoPtr<mapDistributeBase>
|
||||
return autoPtr<mapDistributeBase>::New
|
||||
(
|
||||
new mapDistributeBase
|
||||
(
|
||||
constructSize,
|
||||
subMap.xfer(),
|
||||
constructMap.xfer()
|
||||
)
|
||||
constructSize,
|
||||
std::move(subMap),
|
||||
std::move(constructMap)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@ void Foam::parLagrangianRedistributor::redistributeLagrangianFields
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
xferMove<Field<Type>>(field)
|
||||
std::move(field)
|
||||
).write();
|
||||
}
|
||||
}
|
||||
@ -212,7 +212,7 @@ void Foam::parLagrangianRedistributor::redistributeLagrangianFieldFields
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
xferMove<Field<Field<Type>>>(field)
|
||||
std::move(field)
|
||||
).write();
|
||||
}
|
||||
}
|
||||
@ -309,7 +309,7 @@ void Foam::parLagrangianRedistributor::redistributeStoredLagrangianFields
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
xferMove<Field<typename Container::value_type>>(field)
|
||||
std::move(field)
|
||||
).write();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -1353,10 +1353,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
||||
//}
|
||||
|
||||
|
||||
return autoPtr<mapDistributePolyMesh>
|
||||
(
|
||||
new mapDistributePolyMesh(map.xfer())
|
||||
);
|
||||
return autoPtr<mapDistributePolyMesh>::New(std::move(map));
|
||||
}
|
||||
|
||||
|
||||
@ -1407,7 +1404,7 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
|
||||
|
||||
autoPtr<mapDistributePolyMesh> mapPtr;
|
||||
|
||||
if (baseMeshPtr.valid() && baseMeshPtr().nCells()) //baseMeshPtr.valid())
|
||||
if (baseMeshPtr.valid() && baseMeshPtr().nCells())
|
||||
{
|
||||
const fvMesh& baseMesh = baseMeshPtr();
|
||||
|
||||
@ -1417,8 +1414,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
|
||||
mapDistribute cellMap
|
||||
(
|
||||
baseMesh.nCells(),
|
||||
cellSubMap.xfer(),
|
||||
cellAddressing.xfer()
|
||||
std::move(cellSubMap),
|
||||
std::move(cellAddressing)
|
||||
);
|
||||
|
||||
labelListList faceSubMap(Pstream::nProcs());
|
||||
@ -1427,8 +1424,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
|
||||
mapDistribute faceMap
|
||||
(
|
||||
baseMesh.nFaces(),
|
||||
faceSubMap.xfer(),
|
||||
faceAddressing.xfer(),
|
||||
std::move(faceSubMap),
|
||||
std::move(faceAddressing),
|
||||
false, //subHasFlip
|
||||
true //constructHasFlip
|
||||
);
|
||||
@ -1439,8 +1436,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
|
||||
mapDistribute pointMap
|
||||
(
|
||||
baseMesh.nPoints(),
|
||||
pointSubMap.xfer(),
|
||||
pointAddressing.xfer()
|
||||
std::move(pointSubMap),
|
||||
std::move(pointAddressing)
|
||||
);
|
||||
|
||||
labelListList patchSubMap(Pstream::nProcs());
|
||||
@ -1451,8 +1448,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
|
||||
mapDistribute patchMap
|
||||
(
|
||||
baseMesh.boundaryMesh().size(),
|
||||
patchSubMap.xfer(),
|
||||
boundaryAddressing.xfer()
|
||||
std::move(patchSubMap),
|
||||
std::move(boundaryAddressing)
|
||||
);
|
||||
|
||||
const label nOldPoints = mesh.nPoints();
|
||||
@ -1475,12 +1472,12 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
|
||||
nOldPoints,
|
||||
nOldFaces,
|
||||
nOldCells,
|
||||
oldPatchStarts.xfer(),
|
||||
oldPatchNMeshPoints.xfer(),
|
||||
pointMap.xfer(),
|
||||
faceMap.xfer(),
|
||||
cellMap.xfer(),
|
||||
patchMap.xfer()
|
||||
std::move(oldPatchStarts),
|
||||
std::move(oldPatchNMeshPoints),
|
||||
std::move(pointMap),
|
||||
std::move(faceMap),
|
||||
std::move(cellMap),
|
||||
std::move(patchMap)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1493,8 +1490,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
|
||||
mapDistribute cellMap
|
||||
(
|
||||
0,
|
||||
cellSubMap.xfer(),
|
||||
cellConstructMap.xfer()
|
||||
std::move(cellSubMap),
|
||||
std::move(cellConstructMap)
|
||||
);
|
||||
|
||||
labelListList faceSubMap(Pstream::nProcs());
|
||||
@ -1504,8 +1501,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
|
||||
mapDistribute faceMap
|
||||
(
|
||||
0,
|
||||
faceSubMap.xfer(),
|
||||
faceConstructMap.xfer(),
|
||||
std::move(faceSubMap),
|
||||
std::move(faceConstructMap),
|
||||
false, //subHasFlip
|
||||
true //constructHasFlip
|
||||
);
|
||||
@ -1517,8 +1514,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
|
||||
mapDistribute pointMap
|
||||
(
|
||||
0,
|
||||
pointSubMap.xfer(),
|
||||
pointConstructMap.xfer()
|
||||
std::move(pointSubMap),
|
||||
std::move(pointConstructMap)
|
||||
);
|
||||
|
||||
labelListList patchSubMap(Pstream::nProcs());
|
||||
@ -1530,8 +1527,8 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
|
||||
mapDistribute patchMap
|
||||
(
|
||||
0,
|
||||
patchSubMap.xfer(),
|
||||
patchConstructMap.xfer()
|
||||
std::move(patchSubMap),
|
||||
std::move(patchConstructMap)
|
||||
);
|
||||
|
||||
const label nOldPoints = mesh.nPoints();
|
||||
@ -1554,12 +1551,12 @@ autoPtr<mapDistributePolyMesh> createReconstructMap
|
||||
nOldPoints,
|
||||
nOldFaces,
|
||||
nOldCells,
|
||||
oldPatchStarts.xfer(),
|
||||
oldPatchNMeshPoints.xfer(),
|
||||
pointMap.xfer(),
|
||||
faceMap.xfer(),
|
||||
cellMap.xfer(),
|
||||
patchMap.xfer()
|
||||
std::move(oldPatchStarts),
|
||||
std::move(oldPatchNMeshPoints),
|
||||
std::move(pointMap),
|
||||
std::move(faceMap),
|
||||
std::move(cellMap),
|
||||
std::move(patchMap)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1587,7 +1584,6 @@ void readProcAddressing
|
||||
//{
|
||||
// Pout<< "Reading addressing from " << io.name() << " at "
|
||||
// << mesh.facesInstance() << nl << endl;
|
||||
// distMap.clear();
|
||||
// distMap.reset(new IOmapDistributePolyMesh(io));
|
||||
//}
|
||||
//else
|
||||
@ -1604,7 +1600,7 @@ void readProcAddressing
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT
|
||||
),
|
||||
labelList(0)
|
||||
labelList()
|
||||
);
|
||||
labelIOList faceProcAddressing
|
||||
(
|
||||
@ -1616,7 +1612,7 @@ void readProcAddressing
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT
|
||||
),
|
||||
labelList(0)
|
||||
labelList()
|
||||
);
|
||||
labelIOList pointProcAddressing
|
||||
(
|
||||
@ -1628,7 +1624,7 @@ void readProcAddressing
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT
|
||||
),
|
||||
labelList(0)
|
||||
labelList()
|
||||
);
|
||||
labelIOList boundaryProcAddressing
|
||||
(
|
||||
@ -1640,7 +1636,7 @@ void readProcAddressing
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT
|
||||
),
|
||||
labelList(0)
|
||||
labelList()
|
||||
);
|
||||
|
||||
|
||||
@ -2580,7 +2576,7 @@ int main(int argc, char *argv[])
|
||||
runTime,
|
||||
IOobject::READ_IF_PRESENT
|
||||
),
|
||||
labelList(0)
|
||||
labelList()
|
||||
);
|
||||
if
|
||||
(
|
||||
|
||||
@ -49,7 +49,7 @@ Foam::tmp<Foam::Field<Type>> Foam::readParticleField
|
||||
if (obj != nullptr)
|
||||
{
|
||||
IOField<Type> newField(*obj);
|
||||
return tmp<Field<Type>>::New(newField.xfer());
|
||||
return tmp<Field<Type>>::New(std::move(newField));
|
||||
}
|
||||
|
||||
FatalErrorInFunction
|
||||
@ -77,7 +77,7 @@ void Foam::readFields
|
||||
{
|
||||
Info<< " reading field " << fieldNames[j] << endl;
|
||||
IOField<Type> newField(*obj);
|
||||
values.set(j, new List<Type>(newField.xfer()));
|
||||
values.set(j, new List<Type>(std::move(newField)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -865,7 +865,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
globalFaceFaces
|
||||
std::move(globalFaceFaces)
|
||||
);
|
||||
IOglobalFaceFaces.write();
|
||||
|
||||
@ -881,7 +881,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
visibleFaceFaces
|
||||
std::move(visibleFaceFaces)
|
||||
);
|
||||
IOvisibleFaceFaces.write();
|
||||
|
||||
@ -895,7 +895,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
map.xfer()
|
||||
std::move(map)
|
||||
);
|
||||
|
||||
IOmapDist.write();
|
||||
|
||||
@ -287,7 +287,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
surf.xfer()
|
||||
std::move(surf)
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -364,7 +364,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Gather all ZoneIDs
|
||||
List<labelList> gatheredZones(Pstream::nProcs());
|
||||
gatheredZones[Pstream::myProcNo()] = compactZones.xfer();
|
||||
gatheredZones[Pstream::myProcNo()].transfer(compactZones);
|
||||
Pstream::gatherList(gatheredZones);
|
||||
|
||||
// On master combine all points, faces, zones
|
||||
@ -404,10 +404,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
UnsortedMeshedSurface<face> unsortedFace
|
||||
(
|
||||
xferMove(allPoints),
|
||||
xferMove(allFaces),
|
||||
xferMove(allZones),
|
||||
xferMove(surfZones)
|
||||
std::move(allPoints),
|
||||
std::move(allFaces),
|
||||
std::move(allZones),
|
||||
surfZones
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ void Foam::searchableSurfaceModifiers::cut::triangulate
|
||||
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)
|
||||
{
|
||||
nInside++;
|
||||
++nInside;
|
||||
}
|
||||
}
|
||||
|
||||
// Add a patch for inside the box
|
||||
if (nInside > 0 && surf3.patches().size() > 0)
|
||||
if (nInside && surf3.patches().size() > 0)
|
||||
{
|
||||
geometricSurfacePatchList newPatches(surf3.patches());
|
||||
label sz = newPatches.size();
|
||||
@ -362,7 +362,7 @@ bool Foam::searchableSurfaceModifiers::cut::modify
|
||||
}
|
||||
}
|
||||
pointField newPoints(surf3.points());
|
||||
surf = triSurface(newTris.xfer(), newPatches, newPoints.xfer());
|
||||
surf = triSurface(newTris, newPatches, newPoints, true);
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
@ -104,12 +104,12 @@ Foam::treeDataCell::treeDataCell
|
||||
(
|
||||
const bool cacheBb,
|
||||
const polyMesh& mesh,
|
||||
const Xfer<labelList>& cellLabels,
|
||||
labelList&& cellLabels,
|
||||
const polyMesh::cellDecomposition decompMode
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
cellLabels_(cellLabels),
|
||||
cellLabels_(std::move(cellLabels)),
|
||||
cacheBb_(cacheBb),
|
||||
decompMode_(decompMode)
|
||||
{
|
||||
|
||||
@ -137,21 +137,21 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh and subset of cells.
|
||||
//- Construct from mesh, copying subset of cells.
|
||||
treeDataCell
|
||||
(
|
||||
const bool cacheBb,
|
||||
const polyMesh&,
|
||||
const labelUList&,
|
||||
const polyMesh& mesh,
|
||||
const labelUList& cellLabels,
|
||||
const polyMesh::cellDecomposition decompMode
|
||||
);
|
||||
|
||||
//- Construct from mesh and subset of cells, transferring contents
|
||||
//- Construct from mesh, moving subset of cells
|
||||
treeDataCell
|
||||
(
|
||||
const bool cacheBb,
|
||||
const polyMesh&,
|
||||
const Xfer<labelList>&,
|
||||
const polyMesh& mesh,
|
||||
labelList&& cellLabels,
|
||||
const polyMesh::cellDecomposition decompMode
|
||||
);
|
||||
|
||||
@ -159,7 +159,7 @@ public:
|
||||
treeDataCell
|
||||
(
|
||||
const bool cacheBb,
|
||||
const polyMesh&,
|
||||
const polyMesh& mesh,
|
||||
const polyMesh::cellDecomposition decompMode
|
||||
);
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ public:
|
||||
(
|
||||
const UList<T>& posList,
|
||||
const UList<T>& negList,
|
||||
const Xfer<List<label>>& addr
|
||||
List<label>&& addr
|
||||
);
|
||||
|
||||
|
||||
@ -99,9 +99,11 @@ public:
|
||||
|
||||
// Edit
|
||||
|
||||
//- Reset addressing
|
||||
//- Copy reset addressing
|
||||
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
|
||||
|
||||
@ -60,12 +60,12 @@ inline Foam::BiIndirectList<T>::BiIndirectList
|
||||
(
|
||||
const UList<T>& posList,
|
||||
const UList<T>& negList,
|
||||
const Xfer<List<label>>& addr
|
||||
List<label>&& addr
|
||||
)
|
||||
:
|
||||
posList_(const_cast<UList<T>&>(posList)),
|
||||
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>
|
||||
inline void Foam::BiIndirectList<T>::resetAddressing
|
||||
(
|
||||
const Xfer<List<label>>& addr
|
||||
List<label>&& addr
|
||||
)
|
||||
{
|
||||
addressing_.transfer(addr());
|
||||
addressing_.transfer(addr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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 * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
|
||||
@ -125,9 +125,6 @@ public:
|
||||
//- Move construct
|
||||
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.
|
||||
inline CompactListList(CompactListList<T, Container>& lst, bool reuse);
|
||||
|
||||
@ -202,9 +199,6 @@ public:
|
||||
// into this CompactListList and annul the argument list.
|
||||
void transfer(CompactListList<T, Container>& lst);
|
||||
|
||||
//- Transfer the contents to the Xfer container
|
||||
inline Xfer<CompactListList<T, Container>> xfer();
|
||||
|
||||
|
||||
// Other
|
||||
|
||||
|
||||
@ -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>
|
||||
inline void Foam::CompactListList<T, Container>::resize(const label mRows)
|
||||
{
|
||||
|
||||
@ -152,9 +152,6 @@ public:
|
||||
//- Construct from UIndirectList. Size set to UIndirectList size.
|
||||
explicit inline DynamicList(const UIndirectList<T>& lst);
|
||||
|
||||
//- Transfer (move) construct
|
||||
explicit inline DynamicList(const Xfer<List<T>>& lst);
|
||||
|
||||
//- Move construct.
|
||||
inline DynamicList(DynamicList<T, SizeMin>&& lst);
|
||||
|
||||
@ -242,10 +239,6 @@ public:
|
||||
//- Transfer contents of the argument SortableList into this.
|
||||
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.
|
||||
inline DynamicList<T, SizeMin>& append(const T& val);
|
||||
|
||||
@ -375,6 +368,7 @@ public:
|
||||
Istream& is,
|
||||
DynamicList<T, SizeMin>& lst
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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>
|
||||
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>
|
||||
inline Foam::DynamicList<T, SizeMin>&
|
||||
Foam::DynamicList<T, SizeMin>::append
|
||||
|
||||
@ -76,7 +76,7 @@ protected:
|
||||
explicit inline IndirectListAddressing(const labelUList& addr);
|
||||
|
||||
//- Construct by transferring addressing array
|
||||
explicit inline IndirectListAddressing(const Xfer<List<label>>& addr);
|
||||
explicit inline IndirectListAddressing(List<label>&& addr);
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -84,9 +84,11 @@ protected:
|
||||
//- Return the list addressing
|
||||
inline const List<label>& addressing() const;
|
||||
|
||||
//- Reset addressing
|
||||
//- Copy reset addressing
|
||||
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
|
||||
(
|
||||
const UList<T>& completeList,
|
||||
const Xfer<List<label>>& addr
|
||||
List<label>&& addr
|
||||
);
|
||||
|
||||
//- Copy constructor
|
||||
|
||||
@ -36,10 +36,10 @@ 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
|
||||
(
|
||||
const UList<T>& completeList,
|
||||
const Xfer<List<label>>& addr
|
||||
List<label>&& addr
|
||||
)
|
||||
:
|
||||
IndirectListAddressing(addr),
|
||||
IndirectListAddressing(std::move(addr)),
|
||||
UIndirectList<T>
|
||||
(
|
||||
completeList,
|
||||
@ -125,10 +125,10 @@ inline void Foam::IndirectListAddressing::resetAddressing
|
||||
|
||||
inline void Foam::IndirectListAddressing::resetAddressing
|
||||
(
|
||||
const Xfer<List<label>>& addr
|
||||
List<label>&& addr
|
||||
)
|
||||
{
|
||||
addressing_.transfer(addr());
|
||||
addressing_.transfer(addr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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>
|
||||
Foam::List<T>::List(List<T>&& lst)
|
||||
:
|
||||
@ -513,10 +506,13 @@ void Foam::List<T>::operator=(const SLList<T>& lst)
|
||||
|
||||
if (len)
|
||||
{
|
||||
List_ACCESS(T, (*this), vp);
|
||||
|
||||
label i = 0;
|
||||
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);
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
if (len)
|
||||
{
|
||||
this->operator[](i) = std::move(lst.removeHead());
|
||||
List_ACCESS(T, (*this), vp);
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
vp[i] = std::move(lst.removeHead());
|
||||
}
|
||||
}
|
||||
|
||||
lst.clear();
|
||||
|
||||
@ -43,7 +43,6 @@ SourceFiles
|
||||
#include "UList.H"
|
||||
#include "autoPtr.H"
|
||||
#include "one.H"
|
||||
#include "Xfer.H"
|
||||
#include "SLListFwd.H"
|
||||
|
||||
#include <initializer_list>
|
||||
@ -173,9 +172,6 @@ public:
|
||||
//- Construct from an initializer list
|
||||
List(std::initializer_list<T> lst);
|
||||
|
||||
//- Transfer (move) construct
|
||||
List(const Xfer<List<T>>& lst);
|
||||
|
||||
//- Move construct from List
|
||||
List(List<T>&& lst);
|
||||
|
||||
@ -250,9 +246,6 @@ public:
|
||||
//- and annul the argument list
|
||||
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
|
||||
//- if required.
|
||||
inline T& newElmt(const label i);
|
||||
@ -310,6 +303,7 @@ public:
|
||||
Istream& is,
|
||||
List<T>& L
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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>
|
||||
inline void Foam::List<T>::append(const T& val)
|
||||
{
|
||||
|
||||
@ -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>
|
||||
Foam::PtrList<T>::PtrList(PtrList<T>& lst, bool reuse)
|
||||
:
|
||||
|
||||
@ -98,9 +98,6 @@ public:
|
||||
template<class 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
|
||||
PtrList(PtrList<T>& lst, bool reuse);
|
||||
|
||||
@ -144,9 +141,6 @@ public:
|
||||
//- Transfer into this list and annul the argument list
|
||||
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)
|
||||
inline bool set(const label i) const;
|
||||
|
||||
@ -175,6 +169,7 @@ public:
|
||||
|
||||
//- Read PtrList from Istream, discarding contents of existing PtrList
|
||||
friend Istream& operator>> <T>(Istream& is, PtrList<T>& lst);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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 * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
|
||||
@ -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 InputIterator>
|
||||
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 * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
@ -195,7 +179,7 @@ template<class T>
|
||||
inline void Foam::SortableList<T>::operator=(List<T>&& lst)
|
||||
{
|
||||
indices_.clear();
|
||||
List<T>::operator=(std::move(lst));
|
||||
List<T>::transfer(lst);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -95,9 +95,6 @@ public:
|
||||
//- Construct from an initializer list, sorting immediately
|
||||
SortableList(std::initializer_list<T> values);
|
||||
|
||||
//- Construct from transferred List, sorting immediately
|
||||
explicit SortableList(const Xfer<List<T>>& values);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -129,9 +126,6 @@ public:
|
||||
//- Swap content with another SortableList in constant time
|
||||
inline void swap(SortableList<T>& lst);
|
||||
|
||||
//- Transfer contents to the Xfer container as a plain List
|
||||
inline Xfer<List<T>> xfer();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
@ -152,6 +146,7 @@ public:
|
||||
|
||||
//- Assignment to an initializer list
|
||||
void operator=(std::initializer_list<T> lst);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ public:
|
||||
UPtrList() = default;
|
||||
|
||||
//- 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.
|
||||
// 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
|
||||
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
|
||||
inline UPtrList(UPtrList<T>& lst, bool reuse);
|
||||
|
||||
@ -167,9 +164,6 @@ public:
|
||||
//- Transfer contents into this list and annul the argument
|
||||
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)
|
||||
inline bool set(const label i) const;
|
||||
|
||||
@ -326,6 +320,7 @@ public:
|
||||
|
||||
//- Write UPtrList to Ostream
|
||||
friend Ostream& operator<< <T>(Ostream& os, const UPtrList<T>& lst);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -26,9 +26,9 @@ License
|
||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||
|
||||
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>
|
||||
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 * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
@ -190,9 +176,8 @@ inline const T& Foam::UPtrList<T>::operator[](const label i) const
|
||||
if (!ptrs_[i])
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "hanging pointer at index " << i
|
||||
<< " (size " << size()
|
||||
<< "), cannot dereference"
|
||||
<< "cannot dereference nullptr at index " << i
|
||||
<< " (size " << size() << ")"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
@ -206,9 +191,8 @@ inline T& Foam::UPtrList<T>::operator[](const label i)
|
||||
if (!ptrs_[i])
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "hanging pointer at index " << i
|
||||
<< " (size " << size()
|
||||
<< "), cannot dereference"
|
||||
<< "cannot dereference nullptr at index " << i
|
||||
<< " (size " << size() << ")"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -127,7 +127,7 @@ template<class T, class BaseType>
|
||||
Foam::CompactIOField<T, BaseType>::CompactIOField
|
||||
(
|
||||
const IOobject& io,
|
||||
const Field<T>& list
|
||||
const UList<T>& content
|
||||
)
|
||||
:
|
||||
regIOobject(io)
|
||||
@ -142,7 +142,7 @@ Foam::CompactIOField<T, BaseType>::CompactIOField
|
||||
}
|
||||
else
|
||||
{
|
||||
Field<T>::operator=(list);
|
||||
Field<T>::operator=(content);
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,12 +151,12 @@ template<class T, class BaseType>
|
||||
Foam::CompactIOField<T, BaseType>::CompactIOField
|
||||
(
|
||||
const IOobject& io,
|
||||
const Xfer<Field<T>>& list
|
||||
Field<T>&& content
|
||||
)
|
||||
:
|
||||
regIOobject(io)
|
||||
{
|
||||
Field<T>::transfer(list());
|
||||
Field<T>::transfer(content);
|
||||
|
||||
if
|
||||
(
|
||||
@ -169,14 +169,6 @@ Foam::CompactIOField<T, BaseType>::CompactIOField
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class BaseType>
|
||||
Foam::CompactIOField<T, BaseType>::~CompactIOField()
|
||||
{}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class BaseType>
|
||||
@ -191,21 +183,19 @@ bool Foam::CompactIOField<T, BaseType>::writeObject
|
||||
if (fmt == IOstream::ASCII)
|
||||
{
|
||||
// Change type to be non-compact format type
|
||||
const word oldTypeName = typeName;
|
||||
const word oldTypeName(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
|
||||
const_cast<word&>(typeName) = oldTypeName;
|
||||
|
||||
return good;
|
||||
}
|
||||
else
|
||||
{
|
||||
return regIOobject::writeObject(fmt, ver, cmp, valid);
|
||||
}
|
||||
|
||||
return regIOobject::writeObject(fmt, ver, cmp, valid);
|
||||
}
|
||||
|
||||
|
||||
@ -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 * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class BaseType>
|
||||
|
||||
@ -47,7 +47,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
// Forward declarations
|
||||
template<class T, class BaseType> class CompactIOField;
|
||||
|
||||
template<class T, class BaseType> Istream& operator>>
|
||||
@ -85,28 +85,30 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default copy construct
|
||||
CompactIOField(const CompactIOField&) = default;
|
||||
|
||||
//- Construct from IOobject
|
||||
CompactIOField(const IOobject&);
|
||||
explicit CompactIOField(const IOobject& io);
|
||||
|
||||
//- 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
|
||||
CompactIOField(const IOobject&, const label);
|
||||
CompactIOField(const IOobject& io, const label size);
|
||||
|
||||
//- Construct from IOobject and a Field
|
||||
CompactIOField(const IOobject&, const Field<T>&);
|
||||
//- Construct from IOobject and a List/Field content
|
||||
CompactIOField(const IOobject& io, const UList<T>& content);
|
||||
|
||||
//- Construct by transferring the Field contents
|
||||
CompactIOField(const IOobject&, const Xfer<Field<T>>&);
|
||||
CompactIOField(const IOobject& io, Field<T>&& content);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~CompactIOField();
|
||||
//- Destructor
|
||||
virtual ~CompactIOField() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
virtual bool writeObject
|
||||
(
|
||||
@ -116,14 +118,16 @@ public:
|
||||
const bool valid
|
||||
) 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=;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -61,7 +61,7 @@ bool Foam::CompactIOList<T, BaseType>::overflows() const
|
||||
label size = 0;
|
||||
forAll(*this, i)
|
||||
{
|
||||
label oldSize = size;
|
||||
const label oldSize = size;
|
||||
size += this->operator[](i).size();
|
||||
if (size < oldSize)
|
||||
{
|
||||
@ -94,7 +94,7 @@ template<class T, class BaseType>
|
||||
Foam::CompactIOList<T, BaseType>::CompactIOList
|
||||
(
|
||||
const IOobject& io,
|
||||
const label size
|
||||
const label len
|
||||
)
|
||||
:
|
||||
regIOobject(io)
|
||||
@ -109,7 +109,7 @@ Foam::CompactIOList<T, BaseType>::CompactIOList
|
||||
}
|
||||
else
|
||||
{
|
||||
List<T>::setSize(size);
|
||||
List<T>::setSize(len);
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ template<class T, class BaseType>
|
||||
Foam::CompactIOList<T, BaseType>::CompactIOList
|
||||
(
|
||||
const IOobject& io,
|
||||
const List<T>& list
|
||||
const UList<T>& content
|
||||
)
|
||||
:
|
||||
regIOobject(io)
|
||||
@ -133,7 +133,7 @@ Foam::CompactIOList<T, BaseType>::CompactIOList
|
||||
}
|
||||
else
|
||||
{
|
||||
List<T>::operator=(list);
|
||||
List<T>::operator=(content);
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,12 +142,12 @@ template<class T, class BaseType>
|
||||
Foam::CompactIOList<T, BaseType>::CompactIOList
|
||||
(
|
||||
const IOobject& io,
|
||||
const Xfer<List<T>>& list
|
||||
List<T>&& content
|
||||
)
|
||||
:
|
||||
regIOobject(io)
|
||||
{
|
||||
List<T>::transfer(list());
|
||||
List<T>::transfer(content);
|
||||
|
||||
if
|
||||
(
|
||||
@ -160,14 +160,6 @@ Foam::CompactIOList<T, BaseType>::CompactIOList
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class BaseType>
|
||||
Foam::CompactIOList<T, BaseType>::~CompactIOList()
|
||||
{}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
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 * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class BaseType>
|
||||
@ -293,7 +278,7 @@ Foam::Ostream& Foam::operator<<
|
||||
start[0] = 0;
|
||||
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();
|
||||
|
||||
if (start[i] < prev)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -47,10 +47,9 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
class Istream;
|
||||
class Ostream;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
template<class T, class BaseType> class CompactIOList;
|
||||
|
||||
template<class T, class BaseType> Istream& operator>>
|
||||
@ -90,25 +89,27 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default copy construct
|
||||
CompactIOList(const CompactIOList&) = default;
|
||||
|
||||
//- Construct from IOobject
|
||||
CompactIOList(const IOobject&);
|
||||
explicit CompactIOList(const IOobject& io);
|
||||
|
||||
//- Construct from IOobject and size of CompactIOList
|
||||
CompactIOList(const IOobject&, const label);
|
||||
//- Construct from IOobject and default length of CompactIOList
|
||||
CompactIOList(const IOobject& io, const label len);
|
||||
|
||||
//- Construct from IOobject and a List
|
||||
CompactIOList(const IOobject&, const List<T>&);
|
||||
|
||||
//- Construct by transferring the List contents
|
||||
CompactIOList(const IOobject&, const Xfer<List<T>>&);
|
||||
//- Construct from IOobject and List content
|
||||
CompactIOList(const IOobject& io, const UList<T>& content);
|
||||
|
||||
//- Construct by transferring the List content
|
||||
CompactIOList(const IOobject& io, List<T>&& content);
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~CompactIOList();
|
||||
virtual ~CompactIOList() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
virtual bool writeObject
|
||||
(
|
||||
@ -121,11 +122,13 @@ public:
|
||||
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
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -58,7 +58,7 @@ template<class Type>
|
||||
Foam::GlobalIOField<Type>::GlobalIOField
|
||||
(
|
||||
const IOobject& io,
|
||||
const Field<Type>& f
|
||||
const UList<Type>& content
|
||||
)
|
||||
:
|
||||
regIOobject(io)
|
||||
@ -68,7 +68,7 @@ Foam::GlobalIOField<Type>::GlobalIOField
|
||||
|
||||
if (!readHeaderOk(IOstream::BINARY, typeName))
|
||||
{
|
||||
Field<Type>::operator=(f);
|
||||
Field<Type>::operator=(content);
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ template<class Type>
|
||||
Foam::GlobalIOField<Type>::GlobalIOField
|
||||
(
|
||||
const IOobject& io,
|
||||
const Xfer<Field<Type>>& f
|
||||
Field<Type>&& content
|
||||
)
|
||||
:
|
||||
regIOobject(io)
|
||||
@ -85,17 +85,38 @@ Foam::GlobalIOField<Type>::GlobalIOField
|
||||
// Check for MUST_READ_IF_MODIFIED
|
||||
warnNoRereading<GlobalIOField<Type>>();
|
||||
|
||||
Field<Type>::transfer(f());
|
||||
Field<Type>::transfer(content);
|
||||
|
||||
readHeaderOk(IOstream::BINARY, typeName);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
||||
|
||||
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 * * * * * * * * * * * * * //
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -61,24 +61,30 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default copy construct
|
||||
GlobalIOField(const GlobalIOField&) = default;
|
||||
|
||||
//- Construct from IOobject
|
||||
GlobalIOField(const IOobject&);
|
||||
explicit GlobalIOField(const IOobject& io);
|
||||
|
||||
//- 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
|
||||
GlobalIOField(const IOobject&, const Field<Type>&);
|
||||
//- Construct from IOobject and a List/Field content
|
||||
GlobalIOField(const IOobject& io, const UList<Type>& content);
|
||||
|
||||
//- Construct by transferring the Field contents
|
||||
GlobalIOField(const IOobject&, const Xfer<Field<Type>>&);
|
||||
//- Construct by transferring the Field content
|
||||
GlobalIOField(const IOobject& io, Field<Type>&& content);
|
||||
|
||||
//- Construct by copying/moving tmp content
|
||||
GlobalIOField(const IOobject& io, const tmp<Field<Type>>& tf);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~GlobalIOField();
|
||||
virtual ~GlobalIOField() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
//- Is object global
|
||||
virtual bool global() const
|
||||
@ -87,24 +93,27 @@ public:
|
||||
}
|
||||
|
||||
//- 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
|
||||
{
|
||||
return globalFilePath(type());
|
||||
}
|
||||
|
||||
//- ReadData function required for regIOobject read operation
|
||||
virtual bool readData(Istream&);
|
||||
//- The readData method for regIOobject read operation
|
||||
virtual bool readData(Istream& is);
|
||||
|
||||
//- WriteData function required for regIOobject write operation
|
||||
bool writeData(Ostream&) const;
|
||||
//- The writeData method for regIOobject write operation
|
||||
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>&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -55,7 +55,11 @@ Foam::GlobalIOList<Type>::GlobalIOList(const IOobject& io, const label size)
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
@ -64,7 +68,7 @@ Foam::GlobalIOList<Type>::GlobalIOList(const IOobject& io, const List<Type>& f)
|
||||
|
||||
if (!readHeaderOk(IOstream::BINARY, typeName))
|
||||
{
|
||||
List<Type>::operator=(f);
|
||||
List<Type>::operator=(content);
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +77,7 @@ template<class Type>
|
||||
Foam::GlobalIOList<Type>::GlobalIOList
|
||||
(
|
||||
const IOobject& io,
|
||||
const Xfer<List<Type>>& f
|
||||
List<Type>&& content
|
||||
)
|
||||
:
|
||||
regIOobject(io)
|
||||
@ -81,19 +85,12 @@ Foam::GlobalIOList<Type>::GlobalIOList
|
||||
// Check for MUST_READ_IF_MODIFIED
|
||||
warnNoRereading<GlobalIOList<Type>>();
|
||||
|
||||
List<Type>::transfer(f());
|
||||
List<Type>::transfer(content);
|
||||
|
||||
readHeaderOk(IOstream::BINARY, typeName);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::GlobalIOList<Type>::~GlobalIOList()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -53,7 +53,6 @@ class GlobalIOList
|
||||
public regIOobject,
|
||||
public List<Type>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
TypeName("List");
|
||||
@ -61,24 +60,27 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from IOobject
|
||||
GlobalIOList(const IOobject&);
|
||||
//- Default copy construct
|
||||
GlobalIOList(const GlobalIOList&) = default;
|
||||
|
||||
//- 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
|
||||
GlobalIOList(const IOobject&, const List<Type>&);
|
||||
GlobalIOList(const IOobject& io, const UList<Type>& content);
|
||||
|
||||
//- Construct by transferring the List contents
|
||||
GlobalIOList(const IOobject&, const Xfer<List<Type>>&);
|
||||
//- Construct by transferring the List content
|
||||
GlobalIOList(const IOobject& io, List<Type>&& content);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~GlobalIOList();
|
||||
virtual ~GlobalIOList() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
//- Is object global
|
||||
virtual bool global() const
|
||||
@ -93,18 +95,20 @@ public:
|
||||
return globalFilePath(type());
|
||||
}
|
||||
|
||||
//- ReadData function required for regIOobject read operation
|
||||
virtual bool readData(Istream&);
|
||||
//- The readData method for regIOobject read operation
|
||||
virtual bool readData(Istream& is);
|
||||
|
||||
//- WriteData function required for regIOobject write operation
|
||||
bool writeData(Ostream&) const;
|
||||
//- The writeData method for regIOobject write operation
|
||||
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=;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -115,7 +115,7 @@ Foam::IOField<Type>::IOField(const IOobject& io, const label size)
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
@ -136,20 +136,20 @@ Foam::IOField<Type>::IOField(const IOobject& io, const Field<Type>& f)
|
||||
}
|
||||
else
|
||||
{
|
||||
Field<Type>::operator=(f);
|
||||
Field<Type>::operator=(content);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
// Check for MUST_READ_IF_MODIFIED
|
||||
warnNoRereading<IOField<Type>>();
|
||||
|
||||
Field<Type>::transfer(f());
|
||||
Field<Type>::transfer(content);
|
||||
|
||||
if
|
||||
(
|
||||
@ -166,11 +166,38 @@ Foam::IOField<Type>::IOField(const IOobject& io, const Xfer<Field<Type>>& f)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
||||
|
||||
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 * * * * * * * * * * * * * //
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -53,7 +53,6 @@ class IOField
|
||||
public regIOobject,
|
||||
public Field<Type>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
TypeName("Field");
|
||||
@ -61,36 +60,44 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default copy construct
|
||||
IOField(const IOField&) = default;
|
||||
|
||||
//- Construct from IOobject
|
||||
IOField(const IOobject&);
|
||||
explicit IOField(const IOobject& io);
|
||||
|
||||
//- 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)
|
||||
IOField(const IOobject&, const label size);
|
||||
IOField(const IOobject& io, const label size);
|
||||
|
||||
//- Construct from components
|
||||
IOField(const IOobject&, const Field<Type>&);
|
||||
//- Construct from IOobject and a List/Field content
|
||||
IOField(const IOobject& io, const UList<Type>& content);
|
||||
|
||||
//- Construct by transferring the Field contents
|
||||
IOField(const IOobject&, const Xfer<Field<Type>>&);
|
||||
//- Construct by transferring the Field content
|
||||
IOField(const IOobject& io, Field<Type>&& content);
|
||||
|
||||
//- Construct by copying/moving tmp content
|
||||
IOField(const IOobject& io, const tmp<Field<Type>>& tfld);
|
||||
|
||||
|
||||
//- 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=;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -51,7 +51,7 @@ Foam::IOList<T>::IOList(const IOobject& io)
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
@ -72,13 +72,13 @@ Foam::IOList<T>::IOList(const IOobject& io, const label size)
|
||||
}
|
||||
else
|
||||
{
|
||||
List<T>::setSize(size);
|
||||
List<T>::setSize(len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
@ -99,20 +99,20 @@ Foam::IOList<T>::IOList(const IOobject& io, const List<T>& list)
|
||||
}
|
||||
else
|
||||
{
|
||||
List<T>::operator=(list);
|
||||
List<T>::operator=(content);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
// Check for MUST_READ_IF_MODIFIED
|
||||
warnNoRereading<IOList<T>>();
|
||||
|
||||
List<T>::transfer(list());
|
||||
List<T>::transfer(content);
|
||||
|
||||
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 * * * * * * * * * * * * * //
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -53,7 +53,6 @@ class IOList
|
||||
public regIOobject,
|
||||
public List<T>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -62,33 +61,39 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default copy construct
|
||||
IOList(const IOList&) = default;
|
||||
|
||||
//- Construct from IOobject
|
||||
IOList(const IOobject&);
|
||||
explicit IOList(const IOobject& io);
|
||||
|
||||
//- 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
|
||||
IOList(const IOobject&, const List<T>&);
|
||||
//- Construct from IOobject and a copy of UList content
|
||||
IOList(const IOobject& io, const UList<T>& content);
|
||||
|
||||
//- Construct by transferring the List contents
|
||||
IOList(const IOobject&, const Xfer<List<T>>&);
|
||||
//- Construct by transferring the List content
|
||||
IOList(const IOobject& io, List<T>&& content);
|
||||
|
||||
|
||||
//- 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>&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -77,7 +77,7 @@ Foam::IOMap<T>::IOMap(const IOobject& io, const label size)
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
@ -98,17 +98,17 @@ Foam::IOMap<T>::IOMap(const IOobject& io, const Map<T>& map)
|
||||
}
|
||||
else
|
||||
{
|
||||
Map<T>::operator=(map);
|
||||
Map<T>::operator=(content);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
Map<T>::transfer(map());
|
||||
Map<T>::transfer(content);
|
||||
|
||||
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 * * * * * * * * * * * * * //
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -45,7 +45,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IOMap Declaration
|
||||
Class IOMap Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T>
|
||||
@ -54,7 +54,6 @@ class IOMap
|
||||
public regIOobject,
|
||||
public Map<T>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -63,26 +62,29 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default copy construct
|
||||
IOMap(const IOMap&) = default;
|
||||
|
||||
//- Construct from IOobject
|
||||
IOMap(const IOobject&);
|
||||
explicit IOMap(const IOobject& io);
|
||||
|
||||
//- 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
|
||||
IOMap(const IOobject&, const Map<T>&);
|
||||
//- Construct from IOobject and a copy of Map content
|
||||
IOMap(const IOobject&, const Map<T>& content);
|
||||
|
||||
//- Construct by transferring the Map contents
|
||||
IOMap(const IOobject&, const Xfer<Map<T>>&);
|
||||
//- Construct by transferring the Map content
|
||||
IOMap(const IOobject&, Map<T>&& content);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~IOMap();
|
||||
virtual ~IOMap() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
bool writeData(Ostream&) const;
|
||||
bool writeData(Ostream& os) const;
|
||||
|
||||
//- Is object global
|
||||
virtual bool global() const
|
||||
@ -97,13 +99,13 @@ public:
|
||||
return globalFilePath(type());
|
||||
}
|
||||
|
||||
// Member operators
|
||||
// Member Operators
|
||||
|
||||
//- Assignment of other IOMap's entries to this IOMap
|
||||
void operator=(const IOMap<T>&);
|
||||
//- Copy assignment of entries
|
||||
void operator=(const IOMap<T>& rhs);
|
||||
|
||||
//- Assignment of other Map's entries to this IOMap
|
||||
void operator=(const Map<T>&);
|
||||
//- Copy or move assignment of entries
|
||||
using Map<T>::operator=;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -75,10 +75,10 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io)
|
||||
|
||||
|
||||
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),
|
||||
PtrList<T>(s)
|
||||
PtrList<T>(len)
|
||||
{
|
||||
if (io.readOpt() != IOobject::NO_READ)
|
||||
{
|
||||
@ -90,7 +90,7 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const label s)
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
@ -111,17 +111,17 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const PtrList<T>& list)
|
||||
}
|
||||
else
|
||||
{
|
||||
PtrList<T>::operator=(list);
|
||||
PtrList<T>::operator=(content);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
PtrList<T>::transfer(list());
|
||||
PtrList<T>::transfer(content);
|
||||
|
||||
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 * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
@ -165,4 +158,5 @@ void Foam::IOPtrList<T>::operator=(const IOPtrList<T>& rhs)
|
||||
PtrList<T>::operator=(rhs);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -53,7 +53,6 @@ class IOPtrList
|
||||
public regIOobject,
|
||||
public PtrList<T>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -62,35 +61,42 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from IOobject using given Istream constructor class
|
||||
template<class INew>
|
||||
IOPtrList(const IOobject&, const INew&);
|
||||
//- Default copy construct
|
||||
IOPtrList(const IOPtrList&) = default;
|
||||
|
||||
//- 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
|
||||
IOPtrList(const IOobject&, const label);
|
||||
IOPtrList(const IOobject& io, const label len);
|
||||
|
||||
//- Construct from IOobject and a PtrList
|
||||
IOPtrList(const IOobject&, const PtrList<T>&);
|
||||
//- Construct from IOobject and a copy of PtrList content
|
||||
IOPtrList(const IOobject& io, const PtrList<T>& content);
|
||||
|
||||
//- Construct by transferring the PtrList contents
|
||||
IOPtrList(const IOobject&, const Xfer<PtrList<T>>&);
|
||||
//- Construct by transferring the PtrList content
|
||||
IOPtrList(const IOobject& io, PtrList<T>&& content);
|
||||
|
||||
|
||||
//- 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=;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ Foam::decomposedBlockData::decomposedBlockData
|
||||
(
|
||||
const label comm,
|
||||
const IOobject& io,
|
||||
const Xfer<List<char>>& list,
|
||||
List<char>&& list,
|
||||
const UPstream::commsTypes commsType
|
||||
)
|
||||
:
|
||||
@ -140,7 +140,7 @@ Foam::decomposedBlockData::decomposedBlockData
|
||||
<< endl;
|
||||
}
|
||||
|
||||
List<char>::transfer(list());
|
||||
List<char>::transfer(list);
|
||||
|
||||
if
|
||||
(
|
||||
|
||||
@ -87,7 +87,7 @@ public:
|
||||
decomposedBlockData
|
||||
(
|
||||
const label comm,
|
||||
const IOobject&,
|
||||
const IOobject& io,
|
||||
const UPstream::commsTypes = UPstream::commsTypes::scheduled
|
||||
);
|
||||
|
||||
@ -95,17 +95,17 @@ public:
|
||||
decomposedBlockData
|
||||
(
|
||||
const label comm,
|
||||
const IOobject&,
|
||||
const UList<char>&,
|
||||
const IOobject& io,
|
||||
const UList<char>& list,
|
||||
const UPstream::commsTypes = UPstream::commsTypes::scheduled
|
||||
);
|
||||
|
||||
//- Construct by transferring the IOList contents
|
||||
//- Construct by transferring the List contents
|
||||
decomposedBlockData
|
||||
(
|
||||
const label comm,
|
||||
const IOobject&,
|
||||
const Xfer<List<char>>&,
|
||||
const IOobject& io,
|
||||
List<char>&& list,
|
||||
const UPstream::commsTypes = UPstream::commsTypes::scheduled
|
||||
);
|
||||
|
||||
|
||||
@ -98,13 +98,13 @@ public:
|
||||
ITstream
|
||||
(
|
||||
const string& name,
|
||||
const Xfer<List<token>>& tokens,
|
||||
List<token>&& tokens,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
)
|
||||
:
|
||||
Istream(format, version),
|
||||
tokenList(tokens),
|
||||
tokenList(std::move(tokens)),
|
||||
name_(name),
|
||||
tokenIndex_(0)
|
||||
{
|
||||
|
||||
@ -83,13 +83,6 @@ protected:
|
||||
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
|
||||
|
||||
@ -110,12 +103,6 @@ public:
|
||||
//- The current get position in the buffer
|
||||
using UIListStreamAllocator::size;
|
||||
|
||||
inline void swap(List<char>& list)
|
||||
{
|
||||
List<char>::swap(list);
|
||||
reset_gbuffer();
|
||||
}
|
||||
|
||||
//- Clear storage
|
||||
inline void clearStorage()
|
||||
{
|
||||
@ -123,12 +110,11 @@ public:
|
||||
reset_gbuffer();
|
||||
}
|
||||
|
||||
//- Transfer contents to the Xfer container as a plain List
|
||||
inline Xfer<List<char>> xfer()
|
||||
//- Transfer contents to other list
|
||||
inline void swap(List<char>& list)
|
||||
{
|
||||
Xfer<List<char>> moved = List<char>::xfer();
|
||||
List<char>::swap(list);
|
||||
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
|
||||
|
||||
//- The current get position in the buffer
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user