ENH: new/revised emplace_back() [for DynamicList/List/PtrDynList/PtrList]

- returns reference as per C++17 std::vector

STYLE: drop unused, redundant DynamicField remove() method
This commit is contained in:
Mark Olesen
2023-01-26 11:24:25 +01:00
parent c1cdacc0b4
commit 7c60c80edd
28 changed files with 179 additions and 135 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -67,14 +68,14 @@ int main(int argc, char *argv[])
{
scalar factor = pI/scalar(size);
pointList.append(0.99*point(factor, factor, factor));
pointFieldList[pI] = 0.99*point(factor, factor, factor);
pointList.push_back(0.99*point::uniform(factor));
pointFieldList[pI] = 0.99*point::uniform(factor);
}
for (label i=0; i<5; ++i)
{
pointList.append(point(0.95, 0.95,0.95));
pointFieldList.append(point(0.95, 0.95,0.95));
pointList.emplace_back(0.95, 0.95, 0.95);
pointFieldList.emplace_back(0.95, 0.95, 0.95);
}
Info<< "Time to construct lists of points: "
@ -148,7 +149,7 @@ int main(int argc, char *argv[])
// Test point insertion
label index = pointList.size();
pointList.append(p);
pointList.push_back(p);
Info<< nl << "Inserting point " << p << " with index " << index << endl;
@ -159,7 +160,7 @@ int main(int argc, char *argv[])
<< tree.findNearest(p, 0.4) << endl;
index = pointList.size();
pointList.append(p);
pointList.push_back(p);
Info<< "Inserting same point " << p << " with index " << index << endl;