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:
Henry Weller
2019-05-25 17:40:39 +01:00
parent 0889ff91c7
commit 30bea84fac
323 changed files with 3238 additions and 2500 deletions

View File

@ -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
@ -203,7 +203,7 @@ bool Foam::functionObjects::fieldValues::volFieldValue::writeValues
IOobject::NO_READ,
IOobject::NO_WRITE
),
weightField*values
(weightField*values).ref()
).write();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -107,7 +107,7 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::pRef
}
else
{
return std::move(tp);
return move(tp);
}
}
@ -126,7 +126,7 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::pDyn
}
else
{
return std::move(tp);
return move(tp);
}
}
@ -154,7 +154,7 @@ Foam::functionObjects::pressure::coeff
}
else
{
return std::move(tp);
return move(tp);
}
}

View File

@ -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
@ -477,8 +477,8 @@ bool Foam::functionObjects::streamLine::write()
const mapDistribute distMap
(
globalTrackIDs.size(),
sendMap.xfer(),
recvMap.xfer()
move(sendMap),
move(recvMap)
);

View File

@ -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
@ -68,7 +68,7 @@ Foam::wordList Foam::functionObjects::forces::createFileNames
}
}
return names;
return move(names);
}