C++11 conformance and consistency: Added "move" constructors and assignment operators to OpenFOAM containers
Replaced all uses of complex Xfer class with C++11 "move" constructors and assignment operators. Removed the now redundant Xfer class. This substantial changes improves consistency between OpenFOAM and the C++11 STL containers and algorithms, reduces memory allocation and copy overhead when returning containers from functions and simplifies maintenance of the core libraries significantly.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -334,7 +334,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
surf.xfer()
|
||||
move(surf)
|
||||
);
|
||||
|
||||
Info<< "writing surfMesh as well: " << surfOut.objectPath() << endl;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -284,7 +284,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
surf.xfer()
|
||||
move(surf)
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -308,7 +308,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Gather all ZoneIDs
|
||||
List<labelList> gatheredZones(Pstream::nProcs());
|
||||
gatheredZones[Pstream::myProcNo()] = compactZones.xfer();
|
||||
gatheredZones[Pstream::myProcNo()] = move(compactZones);
|
||||
Pstream::gatherList(gatheredZones);
|
||||
|
||||
// On master combine all points, faces, zones
|
||||
@ -347,10 +347,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
UnsortedMeshedSurface<face> unsortedFace
|
||||
(
|
||||
xferMove(allPoints),
|
||||
xferMove(allFaces),
|
||||
xferMove(allZones),
|
||||
xferMove(surfZones)
|
||||
move(allPoints),
|
||||
move(allFaces),
|
||||
move(allZones),
|
||||
move(surfZones)
|
||||
);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user